1{ lib, stdenv, fetchFromGitHub, pkg-config, libtool, curl
2, python3, munge, perl, pam, shadow, coreutils, dbus, libbpf
3, ncurses, libmysqlclient, lua, hwloc, numactl
4, readline, freeipmi, xorg, lz4, rdma-core, nixosTests
5, pmix
6, libjwt
7, libyaml
8, json_c
9, http-parser
10# enable internal X11 support via libssh2
11, enableX11 ? true
12, enableGtk2 ? false, gtk2
13}:
14
15stdenv.mkDerivation rec {
16 pname = "slurm";
17 version = "23.02.5.1";
18
19 # N.B. We use github release tags instead of https://www.schedmd.com/downloads.php
20 # because the latter does not keep older releases.
21 src = fetchFromGitHub {
22 owner = "SchedMD";
23 repo = "slurm";
24 # The release tags use - instead of .
25 rev = "${pname}-${builtins.replaceStrings ["."] ["-"] version}";
26 sha256 = "sha256-9VvZ8xySYFyBa5tZzf5WCShbEDpqE1/5t76jXX6t+bc=";
27 };
28
29 outputs = [ "out" "dev" ];
30
31 patches = [
32 # increase string length to allow for full
33 # path of 'echo' in nix store
34 ./common-env-echo.patch
35 # Required for configure to pick up the right dlopen path
36 ./pmix-configure.patch
37 ];
38
39 prePatch = ''
40 substituteInPlace src/common/env.c \
41 --replace "/bin/echo" "${coreutils}/bin/echo"
42 '' + (lib.optionalString enableX11 ''
43 substituteInPlace src/common/x11_util.c \
44 --replace '"/usr/bin/xauth"' '"${xorg.xauth}/bin/xauth"'
45 '');
46
47 # nixos test fails to start slurmd with 'undefined symbol: slurm_job_preempt_mode'
48 # https://groups.google.com/forum/#!topic/slurm-devel/QHOajQ84_Es
49 # this doesn't fix tests completely at least makes slurmd to launch
50 hardeningDisable = [ "bindnow" ];
51
52 nativeBuildInputs = [ pkg-config libtool python3 perl ];
53 buildInputs = [
54 curl python3 munge pam
55 libmysqlclient ncurses lz4 rdma-core
56 lua hwloc numactl readline freeipmi shadow.su
57 pmix json_c libjwt libyaml dbus libbpf
58 http-parser
59 ] ++ lib.optionals enableX11 [ xorg.xauth ]
60 ++ lib.optionals enableGtk2 [ gtk2 ];
61
62 configureFlags = with lib;
63 [ "--with-freeipmi=${freeipmi}"
64 "--with-http-parser=${http-parser}"
65 "--with-hwloc=${hwloc.dev}"
66 "--with-json=${json_c.dev}"
67 "--with-jwt=${libjwt}"
68 "--with-lz4=${lz4.dev}"
69 "--with-munge=${munge}"
70 "--with-yaml=${libyaml.dev}"
71 "--with-ofed=${rdma-core}"
72 "--sysconfdir=/etc/slurm"
73 "--with-pmix=${pmix}"
74 "--with-bpf=${libbpf}"
75 ] ++ (optional enableGtk2 "--disable-gtktest")
76 ++ (optional (!enableX11) "--disable-x11");
77
78
79 preConfigure = ''
80 patchShebangs ./doc/html/shtml2html.py
81 patchShebangs ./doc/man/man2html.py
82 '';
83
84 postInstall = ''
85 rm -f $out/lib/*.la $out/lib/slurm/*.la
86 '';
87
88 enableParallelBuilding = true;
89
90 passthru.tests.slurm = nixosTests.slurm;
91
92 meta = with lib; {
93 homepage = "http://www.schedmd.com/";
94 description = "Simple Linux Utility for Resource Management";
95 platforms = platforms.linux;
96 license = licenses.gpl2Only;
97 maintainers = with maintainers; [ jagajaga markuskowa ];
98 };
99}