From 7ce77b57527ce3d7ce5bddcaede76547401c8421 Mon Sep 17 00:00:00 2001 From: Arseniy Seroka Date: Sat, 28 Feb 2015 20:11:13 +0300 Subject: [PATCH 1/4] slurm: add pkg --- nixos/modules/module-list.nix | 1 + pkgs/servers/computing/slurm/default.nix | 33 ++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 3 files changed, 36 insertions(+) create mode 100644 pkgs/servers/computing/slurm/default.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index c41ae69c1ace..c94c07e4130a 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -108,6 +108,7 @@ ./services/cluster/panamax.nix ./services/computing/torque/server.nix ./services/computing/torque/mom.nix + ./services/computing/slurm/slurm.nix ./services/continuous-integration/jenkins/default.nix ./services/continuous-integration/jenkins/slave.nix ./services/databases/4store-endpoint.nix diff --git a/pkgs/servers/computing/slurm/default.nix b/pkgs/servers/computing/slurm/default.nix new file mode 100644 index 000000000000..74701dc6dbe4 --- /dev/null +++ b/pkgs/servers/computing/slurm/default.nix @@ -0,0 +1,33 @@ +{ stdenv, fetchurl, python, munge, perl, pam, openssl, mysql }: + +#TODO: add sview support based on gtk2 + +stdenv.mkDerivation rec { + name = "slurm-llnl-${version}"; + version = "14.11.4"; + + src = fetchurl { + url = "http://www.schedmd.com/download/latest/slurm-${version}.tar.bz2"; + sha256 = "1w454j92j2fnh7xmg63275qcszq8ywiq51sm2rpyf175jrxv6ina"; + }; + + buildInputs = [ python munge perl pam openssl mysql ]; + + configureFlags = '' + --with-munge=${munge} + --with-ssl=${openssl} + ''; + + preConfigure = '' + substituteInPlace ./doc/html/shtml2html.py --replace "/usr/bin/env python" "${python.interpreter}" + substituteInPlace ./doc/man/man2html.py --replace "/usr/bin/env python" "${python.interpreter}" + ''; + + meta = with stdenv.lib; { + homepage = http://www.schedmd.com/; + description = "Simple Linux Utility for Resource Management"; + platforms = platforms.linux; + license = licenses.gpl2; + maintainers = [ maintainers.jagajaga ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4d813cb2618c..02e965b70333 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8340,6 +8340,8 @@ let thttpd = callPackage ../servers/http/thttpd { }; storm = callPackage ../servers/computing/storm { }; + + slurm-llnl = callPackage ../servers/computing/slurm { }; tomcat5 = callPackage ../servers/http/tomcat/5.0.nix { }; From 69e59e99629c3ddf6d0b1070e80662e95e663cf9 Mon Sep 17 00:00:00 2001 From: Arseniy Seroka Date: Sun, 1 Mar 2015 00:23:07 +0300 Subject: [PATCH 2/4] munge: add service --- nixos/modules/module-list.nix | 1 + nixos/modules/services/security/munge.nix | 61 +++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 nixos/modules/services/security/munge.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index c94c07e4130a..87dd91971e48 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -326,6 +326,7 @@ ./services/security/fprot.nix ./services/security/frandom.nix ./services/security/haveged.nix + ./services/security/munge.nix ./services/security/torify.nix ./services/security/tor.nix ./services/security/torsocks.nix diff --git a/nixos/modules/services/security/munge.nix b/nixos/modules/services/security/munge.nix new file mode 100644 index 000000000000..919c2c2b0e15 --- /dev/null +++ b/nixos/modules/services/security/munge.nix @@ -0,0 +1,61 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.munge; + +in + +{ + + ###### interface + + options = { + + services.munge = { + enable = mkEnableOption "munge service"; + + password = mkOption { + default = "/etc/munge/munge.key"; + type = types.string; + description = '' + The path to a daemon's secret key. + ''; + }; + + }; + + }; + + ###### implementation + + config = mkIf cfg.enable { + + environment.systemPackages = [ pkgs.munge ]; + + systemd.services.munged = { + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ]; + + path = [ pkgs.munge pkgs.coreutils ]; + + preStart = '' + chmod 0700 ${cfg.password} + mkdir -p /var/lib/munge -m 0711 + mkdir -p /var/log/munge -m 0700 + mkdir -p /run/munge -m 0755 + ''; + + serviceConfig = { + ExecStart = "${pkgs.munge}/bin/munged --syslog --key-file ${cfg.password}"; + PIDFile = "/run/munge/munged.pid"; + ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; + }; + + }; + + }; + +} From 0b1cc3cd5198afd07a918d206e3b73ad4ac42930 Mon Sep 17 00:00:00 2001 From: Arseniy Seroka Date: Sun, 1 Mar 2015 04:12:13 +0300 Subject: [PATCH 3/4] slurm: impl simple service --- .../services/computing/slurm/slurm.nix | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 nixos/modules/services/computing/slurm/slurm.nix diff --git a/nixos/modules/services/computing/slurm/slurm.nix b/nixos/modules/services/computing/slurm/slurm.nix new file mode 100644 index 000000000000..9c8261c6df13 --- /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}"; }; + }; + + }; + +} From 30e6f1b4eaed19848e0e76b550be04320e7ae8b3 Mon Sep 17 00:00:00 2001 From: Arseniy Seroka Date: Mon, 2 Mar 2015 00:48:20 +0300 Subject: [PATCH 4/4] slurm: impl basic configuration --- .../services/computing/slurm/slurm.nix | 69 ++++++++++++++----- 1 file changed, 50 insertions(+), 19 deletions(-) diff --git a/nixos/modules/services/computing/slurm/slurm.nix b/nixos/modules/services/computing/slurm/slurm.nix index 9c8261c6df13..019d7fbb16cd 100644 --- a/nixos/modules/services/computing/slurm/slurm.nix +++ b/nixos/modules/services/computing/slurm/slurm.nix @@ -8,7 +8,11 @@ let # configuration file can be generated by http://slurm.schedmd.com/configurator.html configFile = pkgs.writeText "slurm.conf" '' - ${cfg.extraConfig} + ${optionalString (cfg.controlMachine != null) ''controlMachine=${cfg.controlMachine}''} + ${optionalString (cfg.controlAddr != null) ''controlAddr=${cfg.controlAddr}''} + ${optionalString (cfg.nodeName != null) ''nodeName=${cfg.nodeName}''} + ${optionalString (cfg.partitionName != null) ''partitionName=${cfg.partitionName}''} + ${cfg.extraConfig} ''; in @@ -21,27 +25,57 @@ in services.slurm = { server = { - enable = mkOption { - default = false; - type = types.bool; - description = '' - Whether to enable slurm control daemon. - ''; - }; + enable = mkEnableOption "slurm control daemon"; }; client = { - enable = mkOption { - default = false; - type = types.bool; - description = '' - Whether to enable slurm client daemon. - ''; - }; + enable = mkEnableOption "slurm rlient daemon"; }; + controlMachine = mkOption { + type = types.nullOr types.str; + default = null; + example = null; + description = '' + The short hostname of the machine where SLURM control functions are + executed (i.e. the name returned by the command "hostname -s", use "tux001" + rather than "tux001.my.com"). + ''; + }; + + controlAddr = mkOption { + type = types.nullOr types.str; + default = cfg.controlMachine; + example = null; + description = '' + Name that ControlMachine should be referred to in establishing a + communications path. + ''; + }; + + nodeName = mkOption { + type = types.nullOr types.str; + default = null; + example = "linux[1-32] CPUs=1 State=UNKNOWN"; + description = '' + Name that SLURM uses to refer to a node (or base partition for BlueGene + systems). Typically this would be the string that "/bin/hostname -s" + returns. Note that now you have to write node's parameters after the name. + ''; + }; + + partitionName = mkOption { + type = types.nullOr types.str; + default = null; + 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. + ''; + }; + extraConfig = mkOption { default = ""; type = types.lines; @@ -50,7 +84,6 @@ in the end of the slurm configuration file. ''; }; - }; }; @@ -64,7 +97,7 @@ in systemd.services.slurmd = mkIf (cfg.client.enable) { path = with pkgs; [ slurm-llnl coreutils ]; - + wantedBy = [ "multi-user.target" ]; after = [ "systemd-tmpfiles-clean.service" ]; @@ -73,7 +106,6 @@ in 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"; }; }; @@ -89,7 +121,6 @@ in 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}"; }; };