Rename project to muscle
Some checks failed
Build and test / test (push) Has been cancelled
Build and test / docs (push) Has been cancelled
Build and test / check-license (push) Has been cancelled
Build and test / check (push) Has been cancelled
Build and test / build (push) Has been cancelled

This commit is contained in:
2025-11-26 03:38:31 +09:00
parent 805c2d11ff
commit 027af5c456
16 changed files with 87 additions and 87 deletions

View File

@@ -25,11 +25,11 @@ buildFunction {
nativeBuildInputs = [ installShellFiles ];
postInstall = let
commands = lib.mapCartesianProduct ({ shell, command }: ''
"$out/bin/${mainProgram}" generate-completions --shell "${shell}" --command "${command}" > "$TMP/mysqladm.${shell}"
installShellCompletion "--${shell}" --cmd "${command}" "$TMP/mysqladm.${shell}"
"$out/bin/${mainProgram}" generate-completions --shell "${shell}" --command "${command}" > "$TMP/muscle.${shell}"
installShellCompletion "--${shell}" --cmd "${command}" "$TMP/muscle.${shell}"
'') {
shell = [ "bash" "zsh" "fish" ];
command = [ "mysqladm" "mysql-dbadm" "mysql-useradm" ];
command = [ "muscle" "mysql-dbadm" "mysql-useradm" ];
};
in lib.concatStringsSep "\n" commands;

View File

@@ -1,24 +1,24 @@
{ config, pkgs, lib, ... }:
let
cfg = config.services.mysqladm-rs;
cfg = config.services.muscle;
format = pkgs.formats.toml { };
in
{
options.services.mysqladm-rs = {
enable = lib.mkEnableOption "Enable mysqladm-rs";
options.services.muscle = {
enable = lib.mkEnableOption "Enable muscle";
package = lib.mkPackageOption pkgs "mysqladm-rs" { };
package = lib.mkPackageOption pkgs "muscle" { };
createLocalDatabaseUser = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Create a local database user for mysqladm-rs";
description = "Create a local database user for muscle";
};
logLevel = lib.mkOption {
type = lib.types.enum [ "quiet" "error" "warn" "info" "debug" "trace" ];
default = "debug";
description = "Log level for mysqladm-rs";
description = "Log level for muscle";
apply = level: {
"quiet" = "-q";
"error" = "";
@@ -37,8 +37,8 @@ in
server = {
socket_path = lib.mkOption {
type = lib.types.path;
default = "/run/mysqladm/mysqladm.sock";
description = "Path to the mysqladm socket";
default = "/run/muscle/muscle.sock";
description = "Path to the muscle socket";
};
};
@@ -60,7 +60,7 @@ in
};
username = lib.mkOption {
type = lib.types.str;
default = "mysqladm";
default = "muscle";
description = "MySQL username";
};
passwordFile = lib.mkOption {
@@ -79,12 +79,12 @@ in
};
};
config = lib.mkIf config.services.mysqladm-rs.enable {
config = lib.mkIf config.services.muscle.enable {
environment.systemPackages = [ cfg.package ];
environment.etc."mysqladm/config.toml".source = let
environment.etc."muscle/config.toml".source = let
nullStrippedConfig = lib.filterAttrsRecursive (_: v: v != null) cfg.settings;
in format.generate "mysqladm-rs.conf" nullStrippedConfig;
in format.generate "muscle.conf" nullStrippedConfig;
services.mysql.ensureUsers = lib.mkIf cfg.createLocalDatabaseUser [
{
@@ -96,10 +96,10 @@ in
}
];
systemd.services."mysqladm" = {
systemd.services."muscle" = {
description = "MySQL administration tool for non-admin users";
restartTriggers = [ config.environment.etc."mysqladm/config.toml".source ];
requires = [ "mysqladm.socket" ];
restartTriggers = [ config.environment.etc."muscle/config.toml".source ];
requires = [ "muscle.socket" ];
serviceConfig = {
Type = "notify";
ExecStart = "${lib.getExe cfg.package} ${cfg.logLevel} server --systemd socket-activate";
@@ -108,12 +108,12 @@ in
# Although this is a multi-instance unit, the constant `User` field is needed
# for authentication via mysql's auth_socket plugin to work.
User = "mysqladm";
Group = "mysqladm";
User = "muscle";
Group = "muscle";
DynamicUser = true;
ConfigurationDirectory = "mysqladm";
RuntimeDirectory = "mysqladm";
ConfigurationDirectory = "muscle";
RuntimeDirectory = "muscle";
# This is required to read unix user/group details.
PrivateUsers = false;
@@ -166,7 +166,7 @@ in
};
};
systemd.sockets."mysqladm" = {
systemd.sockets."muscle" = {
description = "MySQL administration tool for non-admin users";
wantedBy = [ "sockets.target" ];
socketConfig = {