summary refs log tree commit diff
path: root/nixos/modules/services/computing/slurm/slurm.nix
diff options
context:
space:
mode:
authorArseniy Seroka <ars.seroka@gmail.com>2015-03-01 04:12:13 +0300
committerArseniy Seroka <ars.seroka@gmail.com>2015-03-07 00:26:57 +0300
commit0b1cc3cd5198afd07a918d206e3b73ad4ac42930 (patch)
treec98c3ad18c28b33febe90babea3f1595f1412eed /nixos/modules/services/computing/slurm/slurm.nix
parent69e59e99629c3ddf6d0b1070e80662e95e663cf9 (diff)
downloadnixpkgs-0b1cc3cd5198afd07a918d206e3b73ad4ac42930.tar
nixpkgs-0b1cc3cd5198afd07a918d206e3b73ad4ac42930.tar.gz
nixpkgs-0b1cc3cd5198afd07a918d206e3b73ad4ac42930.tar.bz2
nixpkgs-0b1cc3cd5198afd07a918d206e3b73ad4ac42930.tar.lz
nixpkgs-0b1cc3cd5198afd07a918d206e3b73ad4ac42930.tar.xz
nixpkgs-0b1cc3cd5198afd07a918d206e3b73ad4ac42930.tar.zst
nixpkgs-0b1cc3cd5198afd07a918d206e3b73ad4ac42930.zip
slurm: impl simple service
Diffstat (limited to 'nixos/modules/services/computing/slurm/slurm.nix')
-rw-r--r--nixos/modules/services/computing/slurm/slurm.nix99
1 files changed, 99 insertions, 0 deletions
diff --git a/nixos/modules/services/computing/slurm/slurm.nix b/nixos/modules/services/computing/slurm/slurm.nix
new file mode 100644
index 00000000000..9c8261c6df1
--- /dev/null
+++ b/nixos/modules/services/computing/slurm/slurm.nix
@@ -0,0 +1,99 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+  cfg = config.services.slurm;
+  # configuration file can be generated by http://slurm.schedmd.com/configurator.html
+  configFile = pkgs.writeText "slurm.conf" 
+    ''
+    ${cfg.extraConfig}
+    '';
+in
+
+{
+
+  ###### interface
+
+  options = {
+
+    services.slurm = {
+
+      server = {
+        enable = mkOption {
+          default = false;
+          type = types.bool;
+          description = ''
+            Whether to enable slurm control daemon.
+          '';
+        };
+
+      };
+      
+      client = {
+        enable = mkOption {
+          default = false;
+          type = types.bool;
+          description = ''
+            Whether to enable slurm client daemon.
+          '';
+        };
+
+      };
+
+      extraConfig = mkOption {
+        default = ""; 
+        type = types.lines;
+        description = ''
+          Extra configuration options that will be added verbatim at
+          the end of the slurm configuration file.
+        '';
+      };
+
+    };
+
+  };
+
+
+  ###### implementation
+
+  config = mkIf (cfg.client.enable || cfg.server.enable) {
+
+    environment.systemPackages = [ pkgs.slurm-llnl ];
+
+    systemd.services.slurmd = mkIf (cfg.client.enable) {
+      path = with pkgs; [ slurm-llnl coreutils ];
+      
+      wantedBy = [ "multi-user.target" ];
+      after = [ "systemd-tmpfiles-clean.service" ];
+
+      serviceConfig = {
+        Type = "forking";
+        ExecStart = "${pkgs.slurm-llnl}/bin/slurmd -f ${configFile}";
+        PIDFile = "/run/slurmd.pid";
+        ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
+        ExecStop = "${pkgs.coreutils}/bin/kill $MAINPID";
+      };
+    };
+
+    systemd.services.slurmctld = mkIf (cfg.server.enable) {
+      path = with pkgs; [ slurm-llnl munge coreutils ];
+      
+      wantedBy = [ "multi-user.target" ];
+      after = [ "network.target" "auditd.service" "munged.service" "slurmdbd.service" ];
+      requires = [ "munged.service" ];
+
+      serviceConfig = {
+        Type = "forking";
+        ExecStart = "${pkgs.slurm-llnl}/bin/slurmctld";
+        PIDFile = "/run/slurmctld.pid";
+        ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
+        ExecStop = "${pkgs.coreutils}/bin/kill $MAINPID";
+      };
+      environment = { SLURM_CONF = "${configFile}"; };
+    };
+
+  };
+
+}