···
cfg = config.services.slurm;
# configuration file can be generated by http://slurm.schedmd.com/configurator.html
9
-
configFile = pkgs.writeText "slurm.conf"
9
+
configFile = pkgs.writeTextDir "slurm.conf"
${optionalString (cfg.controlMachine != null) ''controlMachine=${cfg.controlMachine}''}
${optionalString (cfg.controlAddr != null) ''controlAddr=${cfg.controlAddr}''}
···
20
-
plugStackConfig = pkgs.writeText "plugstack.conf"
20
+
plugStackConfig = pkgs.writeTextDir "plugstack.conf"
${optionalString cfg.enableSrunX11 ''optional ${pkgs.slurm-spank-x11}/lib/x11.so''}
23
+
${cfg.extraPlugstackConfig}
27
+
cgroupConfig = pkgs.writeTextDir "cgroup.conf"
29
+
${cfg.extraCgroupConfig}
32
+
# slurm expects some additional config files to be
33
+
# in the same directory as slurm.conf
34
+
etcSlurm = pkgs.symlinkJoin {
36
+
paths = [ configFile cgroupConfig plugStackConfig ];
···
enable = mkEnableOption "slurm client daemon";
66
+
enableStools = mkOption {
70
+
Wether to provide a slurm.conf file.
71
+
Enable this option if you do not run a slurm daemon on this host
72
+
(i.e. <literal>server.enable</literal> and <literal>client.enable</literal> are <literal>false</literal>)
73
+
but you still want to run slurm commands from this host.
···
example = "debug Nodes=linux[1-32] Default=YES MaxTime=INFINITE State=UP";
Name by which the partition may be referenced. Note that now you have
100
-
to write patrition's parameters after the name.
125
+
to write the partition's parameters after the name.
···
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
110
-
slurm-spank-x11 module. Note that this requires 'services.openssh.forwardX11'
111
-
to be enabled on the compute nodes.
135
+
slurm-spank-x11 module. Note that this option also enables
136
+
'services.openssh.forwardX11' on the client.
···
the end of the slurm configuration file.
159
+
extraPlugstackConfig = mkOption {
161
+
type = types.lines;
163
+
Extra configuration that will be added to the end of <literal>plugstack.conf</literal>.
167
+
extraCgroupConfig = mkOption {
169
+
type = types.lines;
171
+
Extra configuration for <literal>cgroup.conf</literal>. This file is
172
+
used when <literal>procTrackType=proctrack/cgroup</literal>.
···
wrappedSlurm = pkgs.stdenv.mkDerivation {
145
-
propagatedBuildInputs = [ cfg.package configFile ];
187
+
propagatedBuildInputs = [ cfg.package etcSlurm ];
builder = pkgs.writeText "builder.sh" ''
···
158
-
SLURM_CONF="${configFile}" "$EXE" "\$@"
200
+
SLURM_CONF="${etcSlurm}/slurm.conf" "$EXE" "\$@"
···
168
-
in mkIf (cfg.client.enable || cfg.server.enable) {
210
+
in mkIf (cfg.enableStools || cfg.client.enable || cfg.server.enable) {
environment.systemPackages = [ wrappedSlurm ];
···
235
+
services.openssh.forwardX11 = mkIf cfg.client.enable (mkDefault true);
systemd.services.slurmctld = mkIf (cfg.server.enable) {
path = with pkgs; [ wrappedSlurm munge coreutils ]