about summary refs log tree commit diff
path: root/nixos/modules/services/computing
diff options
context:
space:
mode:
authorMarkus Kowalewski <markus.kowalewski@gmail.com>2019-11-10 21:28:09 +0100
committerMarkus Kowalewski <markus.kowalewski@gmail.com>2019-11-10 21:28:09 +0100
commit472e165b563f87c99275385b1a6979b7f3c01668 (patch)
treea9f1a3e1ff0585de81d110ddca43c6974f7cf013 /nixos/modules/services/computing
parent8219a3b7135f11035884df8196136f69f522bca1 (diff)
downloadnixlib-472e165b563f87c99275385b1a6979b7f3c01668.tar
nixlib-472e165b563f87c99275385b1a6979b7f3c01668.tar.gz
nixlib-472e165b563f87c99275385b1a6979b7f3c01668.tar.bz2
nixlib-472e165b563f87c99275385b1a6979b7f3c01668.tar.lz
nixlib-472e165b563f87c99275385b1a6979b7f3c01668.tar.xz
nixlib-472e165b563f87c99275385b1a6979b7f3c01668.tar.zst
nixlib-472e165b563f87c99275385b1a6979b7f3c01668.zip
nixos/slurm: add option for external slurmdbd.conf
Slurmdbd requires a password database which is stored in slurmdbd.conf.
A seperate config file avoids that the password ends up in the nix store.

Slurmdbd does 19.5 does not support MySQL socket conections.
Adapated the slurm test to provide username and password.
Diffstat (limited to 'nixos/modules/services/computing')
-rw-r--r--nixos/modules/services/computing/slurm/slurm.nix39
1 files changed, 38 insertions, 1 deletions
diff --git a/nixos/modules/services/computing/slurm/slurm.nix b/nixos/modules/services/computing/slurm/slurm.nix
index 28907c13c242..c70d999ca96d 100644
--- a/nixos/modules/services/computing/slurm/slurm.nix
+++ b/nixos/modules/services/computing/slurm/slurm.nix
@@ -39,6 +39,8 @@ let
      DbdHost=${cfg.dbdserver.dbdHost}
      SlurmUser=${cfg.user}
      StorageType=accounting_storage/mysql
+     StorageUser=${cfg.dbdserver.storageUser}
+     ${optionalString (cfg.dbdserver.storagePass != null) "StoragePass=${cfg.dbdserver.storagePass}"}
      ${cfg.dbdserver.extraConfig}
    '';
 
@@ -85,6 +87,37 @@ in
           '';
         };
 
+        storageUser = mkOption {
+          type = types.str;
+          default = cfg.user;
+          description = ''
+            Database user name.
+          '';
+        };
+
+        storagePass = mkOption {
+          type = types.nullOr types.str;
+          default = null;
+          description = ''
+            Database password. Note that this password will be publicable
+            readable in the nix store. Use <option>configFile</option>
+            to store the and config file and password outside the nix store.
+          '';
+        };
+
+        configFile = mkOption {
+          type = types.nullOr types.str;
+          default = null;
+          description = ''
+            Path to <literal>slurmdbd.conf</literal>. The password for the database connection
+            is stored in the config file. Use this option to specfify a path
+            outside the nix store. If this option is unset a configuration file
+            will be generated. See also:
+            <citerefentry><refentrytitle>slurmdbd.conf</refentrytitle>
+            <manvolnum>8</manvolnum></citerefentry>.
+          '';
+        };
+
         extraConfig = mkOption {
           type = types.lines;
           default = "";
@@ -360,7 +393,11 @@ in
       requires = [ "munged.service" "mysql.service" ];
 
       # slurm strips the last component off the path
-      environment.SLURM_CONF = "${slurmdbdConf}/slurm.conf";
+      environment.SLURM_CONF =
+        if (cfg.dbdserver.configFile == null) then
+          "${slurmdbdConf}/slurm.conf"
+        else
+          cfg.dbdserver.configFile;
 
       serviceConfig = {
         Type = "forking";