summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarkus Kowalewski <markus.kowalewski.uu@gmail.com>2017-12-17 00:25:31 -0800
committerMarkus Kowalewski <markus.kowalewski.uu@gmail.com>2018-01-25 13:58:14 -0800
commit85ca8f121bdeab205658aa8e4f4b1932a8d4dc4f (patch)
tree3eabca21e2dc3ecd5951008e5b8a0f1b70ad3409
parent8fd86b86ebaf6d95fd4b67d8f015b3f79b926e30 (diff)
downloadnixpkgs-85ca8f121bdeab205658aa8e4f4b1932a8d4dc4f.tar
nixpkgs-85ca8f121bdeab205658aa8e4f4b1932a8d4dc4f.tar.gz
nixpkgs-85ca8f121bdeab205658aa8e4f4b1932a8d4dc4f.tar.bz2
nixpkgs-85ca8f121bdeab205658aa8e4f4b1932a8d4dc4f.tar.lz
nixpkgs-85ca8f121bdeab205658aa8e4f4b1932a8d4dc4f.tar.xz
nixpkgs-85ca8f121bdeab205658aa8e4f4b1932a8d4dc4f.tar.zst
nixpkgs-85ca8f121bdeab205658aa8e4f4b1932a8d4dc4f.zip
slurm-spank-x11: init at 0.2.5
-rw-r--r--nixos/modules/services/computing/slurm/slurm.nix31
-rw-r--r--pkgs/servers/computing/slurm-spank-x11/default.nix39
-rw-r--r--pkgs/top-level/all-packages.nix2
3 files changed, 66 insertions, 6 deletions
diff --git a/nixos/modules/services/computing/slurm/slurm.nix b/nixos/modules/services/computing/slurm/slurm.nix
index fb91a29a400..45d34f5b76f 100644
--- a/nixos/modules/services/computing/slurm/slurm.nix
+++ b/nixos/modules/services/computing/slurm/slurm.nix
@@ -6,14 +6,20 @@ let
 
   cfg = config.services.slurm;
   # configuration file can be generated by http://slurm.schedmd.com/configurator.html
-  configFile = pkgs.writeText "slurm.conf" 
+  configFile = pkgs.writeText "slurm.conf"
     ''
       ${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}''}
+      PlugStackConfig=${plugStackConfig}
       ${cfg.extraConfig}
     '';
+
+  plugStackConfig = pkgs.writeText "plugstack.conf"
+    ''
+      ${optionalString cfg.enableSrunX11 ''optional ${pkgs.slurm-spank-x11}/lib/x11.so''}
+    '';
 in
 
 {
@@ -28,7 +34,7 @@ in
         enable = mkEnableOption "slurm control daemon";
 
       };
-      
+
       client = {
         enable = mkEnableOption "slurm rlient daemon";
 
@@ -86,8 +92,19 @@ in
         '';
       };
 
+      enableSrunX11 = mkOption {
+        default = false;
+        type = types.bool;
+        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.
+        '';
+      };
+
       extraConfig = mkOption {
-        default = ""; 
+        default = "";
         type = types.lines;
         description = ''
           Extra configuration options that will be added verbatim at
@@ -134,7 +151,8 @@ in
     environment.systemPackages = [ wrappedSlurm ];
 
     systemd.services.slurmd = mkIf (cfg.client.enable) {
-      path = with pkgs; [ wrappedSlurm coreutils ];
+      path = with pkgs; [ wrappedSlurm coreutils ]
+        ++ lib.optional cfg.enableSrunX11 slurm-spank-x11;
 
       wantedBy = [ "multi-user.target" ];
       after = [ "systemd-tmpfiles-clean.service" ];
@@ -152,8 +170,9 @@ in
     };
 
     systemd.services.slurmctld = mkIf (cfg.server.enable) {
-      path = with pkgs; [ wrappedSlurm munge coreutils ];
-      
+      path = with pkgs; [ wrappedSlurm munge coreutils ]
+        ++ lib.optional cfg.enableSrunX11 slurm-spank-x11;
+
       wantedBy = [ "multi-user.target" ];
       after = [ "network.target" "munged.service" ];
       requires = [ "munged.service" ];
diff --git a/pkgs/servers/computing/slurm-spank-x11/default.nix b/pkgs/servers/computing/slurm-spank-x11/default.nix
new file mode 100644
index 00000000000..13fad7059af
--- /dev/null
+++ b/pkgs/servers/computing/slurm-spank-x11/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchFromGitHub, slurm } :
+let
+  version = "0.2.5";
+in
+stdenv.mkDerivation {
+  name = "slurm-spank-x11-${version}";
+  version = version;
+
+  src = fetchFromGitHub {
+    owner = "hautreux";
+    repo = "slurm-spank-x11";
+    rev = version;
+    sha256 = "1dmsr7whxcxwnlvl1x4s3bqr5cr6q5ssb28vqi67w5hj4sshisry";
+  };
+
+  buildPhase = ''
+      gcc -DX11_LIBEXEC_PROG="\"$out/bin/slurm-spank-x11\"" \
+          -g -o slurm-spank-x11 slurm-spank-x11.c
+      gcc -I${slurm.dev}/include -DX11_LIBEXEC_PROG="\"$out/bin/slurm-spank-x11\"" -shared -fPIC \
+          -g -o x11.so slurm-spank-x11-plug.c
+    '';
+
+  installPhase = ''
+      mkdir -p $out/bin $out/lib
+      install -m 755 slurm-spank-x11 $out/bin
+      install -m 755 x11.so $out/lib
+    '';
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/hautreux/slurm-spank-x11;
+    description = "Plugin for SLURM to allow for interactive X11 sessions";
+    platforms = platforms.linux;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ markuskowa ];
+  };
+}
+
+
+
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 0b24c98499c..441a09a7e54 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -12394,6 +12394,8 @@ with pkgs;
   slurm-full = appendToName "full" (callPackage ../servers/computing/slurm { });
   slurm-llnl-full = slurm-full; # renamed July 2017
 
+  slurm-spank-x11 = callPackage ../servers/computing/slurm-spank-x11 { };
+
   systemd-journal2gelf = callPackage ../tools/system/systemd-journal2gelf { };
 
   inherit (callPackages ../servers/http/tomcat { })