summary refs log tree commit diff
path: root/nixos/modules/services/computing/slurm/slurm.nix
diff options
context:
space:
mode:
authorOrivej Desh <orivej@gmx.fr>2018-06-03 12:15:25 +0000
committerOrivej Desh <orivej@gmx.fr>2018-06-03 12:15:25 +0000
commit420827170c2843ec1fd44f08353d3782e9bc31e3 (patch)
tree9e2db2693adfe86d9d9084f1d095479265321a81 /nixos/modules/services/computing/slurm/slurm.nix
parentccd8ac22869b7db8317a480314b13557b89c4ed9 (diff)
parent448d7d648d1a2e8aacc85f9d0abc90643ca2e89b (diff)
downloadnixlib-420827170c2843ec1fd44f08353d3782e9bc31e3.tar
nixlib-420827170c2843ec1fd44f08353d3782e9bc31e3.tar.gz
nixlib-420827170c2843ec1fd44f08353d3782e9bc31e3.tar.bz2
nixlib-420827170c2843ec1fd44f08353d3782e9bc31e3.tar.lz
nixlib-420827170c2843ec1fd44f08353d3782e9bc31e3.tar.xz
nixlib-420827170c2843ec1fd44f08353d3782e9bc31e3.tar.zst
nixlib-420827170c2843ec1fd44f08353d3782e9bc31e3.zip
Merge branch 'master' into staging
* master: (25 commits)
  prosody: 0.10.1 -> 0.10.2
  mpd: fix spelling in description
  pulseaudio-ctl: init at 1.66
  qt: remove install_name_tool stuff
  multimc: 0.6.1 -> 0.6.2
  lib: test for bitAnd, bitOr, bitXor
  pandas: fix check with the current pytest
  qt: fixup from c4cac55d6979ccdbc48cf0daf26e44c79cf5d0f9
  calibre: 2.24.1 -> 2.25.0
  spotify: 1.0.79.223.g92622cc2-21 -> 1.0.80.480.g51b03ac3-13 (#41356)
  libbsd-freedesktop: re-init at 0.9.1, use for samba
  sbt: 1.1.4 -> 1.1.6
  nixos/slurm: remove propagatedBuidInputs from slurmWrapped
  gitkraken: 3.6.1 -> 3.6.3
  pass-import: export PREFIX, set PASSWORD_STORE_BIN
  pass: Add pass-audit extension
  slurm: add maintainer
  nixos/slurm: update test, add test for enableStools
  slurm: add freeipmi, readline, libssh2, fix hwloc
  nixos/slurm: Add man pages to wrapedSlurm
  ...
Diffstat (limited to 'nixos/modules/services/computing/slurm/slurm.nix')
-rw-r--r--nixos/modules/services/computing/slurm/slurm.nix65
1 files changed, 56 insertions, 9 deletions
diff --git a/nixos/modules/services/computing/slurm/slurm.nix b/nixos/modules/services/computing/slurm/slurm.nix
index 3e513ab15717..1e1c5bc9f035 100644
--- a/nixos/modules/services/computing/slurm/slurm.nix
+++ b/nixos/modules/services/computing/slurm/slurm.nix
@@ -6,7 +6,7 @@ let
 
   cfg = config.services.slurm;
   # configuration file can be generated by http://slurm.schedmd.com/configurator.html
-  configFile = pkgs.writeText "slurm.conf"
+  configFile = pkgs.writeTextDir "slurm.conf"
     ''
       ${optionalString (cfg.controlMachine != null) ''controlMachine=${cfg.controlMachine}''}
       ${optionalString (cfg.controlAddr != null) ''controlAddr=${cfg.controlAddr}''}
@@ -17,10 +17,25 @@ let
       ${cfg.extraConfig}
     '';
 
-  plugStackConfig = pkgs.writeText "plugstack.conf"
+  plugStackConfig = pkgs.writeTextDir "plugstack.conf"
     ''
       ${optionalString cfg.enableSrunX11 ''optional ${pkgs.slurm-spank-x11}/lib/x11.so''}
+      ${cfg.extraPlugstackConfig}
     '';
+
+
+  cgroupConfig = pkgs.writeTextDir "cgroup.conf"
+   ''
+     ${cfg.extraCgroupConfig}
+   '';
+
+  # slurm expects some additional config files to be
+  # in the same directory as slurm.conf
+  etcSlurm = pkgs.symlinkJoin {
+    name = "etc-slurm";
+    paths = [ configFile cgroupConfig plugStackConfig ];
+  };
+
 in
 
 {
@@ -46,7 +61,17 @@ in
 
       client = {
         enable = mkEnableOption "slurm client daemon";
+      };
 
+      enableStools = mkOption {
+        type = types.bool;
+        default = false;
+        description = ''
+          Wether to provide a slurm.conf file.
+          Enable this option if you do not run a slurm daemon on this host
+          (i.e. <literal>server.enable</literal> and <literal>client.enable</literal> are <literal>false</literal>)
+          but you still want to run slurm commands from this host.
+        '';
       };
 
       package = mkOption {
@@ -97,7 +122,7 @@ in
         example = "debug Nodes=linux[1-32] Default=YES MaxTime=INFINITE State=UP";
         description = ''
           Name by which the partition may be referenced. Note that now you have
-          to write patrition's parameters after the name.
+          to write the partition's parameters after the name.
         '';
       };
 
@@ -107,8 +132,10 @@ in
         description = ''
           If enabled srun will accept the option "--x11" to allow for X11 forwarding
           from within an interactive session or a batch job. This activates the
-          slurm-spank-x11 module. Note that this requires 'services.openssh.forwardX11'
-          to be enabled on the compute nodes.
+          slurm-spank-x11 module. Note that this option also enables
+          'services.openssh.forwardX11' on the client.
+
+          This option requires slurm to be compiled without native X11 support.
         '';
       };
 
@@ -130,6 +157,23 @@ in
           the end of the slurm configuration file.
         '';
       };
+
+      extraPlugstackConfig = mkOption {
+        default = "";
+        type = types.lines;
+        description = ''
+          Extra configuration that will be added to the end of <literal>plugstack.conf</literal>.
+        '';
+      };
+
+      extraCgroupConfig = mkOption {
+        default = "";
+        type = types.lines;
+        description = ''
+          Extra configuration for <literal>cgroup.conf</literal>. This file is
+          used when <literal>procTrackType=proctrack/cgroup</literal>.
+        '';
+      };
     };
 
   };
@@ -142,8 +186,6 @@ in
       wrappedSlurm = pkgs.stdenv.mkDerivation {
         name = "wrappedSlurm";
 
-        propagatedBuildInputs = [ cfg.package configFile ];
-
         builder = pkgs.writeText "builder.sh" ''
           source $stdenv/setup
           mkdir -p $out/bin
@@ -155,17 +197,20 @@ in
           #!/bin/sh
           if [ -z "$SLURM_CONF" ]
           then
-            SLURM_CONF="${configFile}" "$EXE" "\$@"
+            SLURM_CONF="${etcSlurm}/slurm.conf" "$EXE" "\$@"
           else
             "$EXE" "\$0"
           fi
           EOT
             chmod +x "$wrappername"
           done
+
+          mkdir -p $out/share
+          ln -s ${getBin cfg.package}/share/man $out/share/man
         '';
       };
 
-  in mkIf (cfg.client.enable || cfg.server.enable) {
+  in mkIf (cfg.enableStools || cfg.client.enable || cfg.server.enable) {
 
     environment.systemPackages = [ wrappedSlurm ];
 
@@ -190,6 +235,8 @@ in
       '';
     };
 
+    services.openssh.forwardX11 = mkIf cfg.client.enable (mkDefault true);
+
     systemd.services.slurmctld = mkIf (cfg.server.enable) {
       path = with pkgs; [ wrappedSlurm munge coreutils ]
         ++ lib.optional cfg.enableSrunX11 slurm-spank-x11;