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
10 # enable internal X11 support via libssh2
12 , enableGtk2 ? false, gtk2
15 stdenv.mkDerivation rec {
17 version = "24.05.4.1";
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 {
24 # The release tags use - instead of .
25 rev = "${pname}-${builtins.replaceStrings ["."] ["-"] version}";
26 hash = "sha256-sviXuRJOpuSoOMNjGPRe11qlphk0Y1/YV/Y5M+QkWys=";
29 outputs = [ "out" "dev" ];
32 # increase string length to allow for full
33 # path of 'echo' in nix store
34 ./common-env-echo.patch
38 substituteInPlace src/common/env.c \
39 --replace "/bin/echo" "${coreutils}/bin/echo"
41 # Autoconf does not support split packages for pmix (libs and headers).
42 # Fix the path to the pmix libraries, so dlopen can find it.
43 substituteInPlace src/plugins/mpi/pmix/mpi_pmix.c \
44 --replace 'xstrfmtcat(full_path, "%s/", PMIXP_LIBPATH)' \
45 'xstrfmtcat(full_path, "${lib.getLib pmix}/lib/")'
47 '' + (lib.optionalString enableX11 ''
48 substituteInPlace src/common/x11_util.c \
49 --replace '"/usr/bin/xauth"' '"${xorg.xauth}/bin/xauth"'
52 # nixos test fails to start slurmd with 'undefined symbol: slurm_job_preempt_mode'
53 # https://groups.google.com/forum/#!topic/slurm-devel/QHOajQ84_Es
54 # this doesn't fix tests completely at least makes slurmd to launch
55 hardeningDisable = [ "bindnow" ];
57 nativeBuildInputs = [ pkg-config libtool python3 perl ];
59 curl python3 munge pam
60 libmysqlclient ncurses lz4 rdma-core
61 lua hwloc numactl readline freeipmi shadow.su
62 pmix json_c libjwt libyaml dbus libbpf
64 ] ++ lib.optionals enableX11 [ xorg.xauth ]
65 ++ lib.optionals enableGtk2 [ gtk2 ];
68 "--with-freeipmi=${freeipmi}"
69 "--with-http-parser=${http-parser}"
70 "--with-hwloc=${lib.getDev hwloc}"
71 "--with-json=${lib.getDev json_c}"
72 "--with-jwt=${libjwt}"
73 "--with-lz4=${lib.getDev lz4}"
74 "--with-munge=${munge}"
75 "--with-yaml=${lib.getDev libyaml}"
76 "--with-ofed=${lib.getDev rdma-core}"
77 "--sysconfdir=/etc/slurm"
78 "--with-pmix=${lib.getDev pmix}"
79 "--with-bpf=${libbpf}"
80 "--without-rpath" # Required for configure to pick up the right dlopen path
81 ] ++ (lib.optional enableGtk2 "--disable-gtktest")
82 ++ (lib.optional (!enableX11) "--disable-x11");
86 patchShebangs ./doc/html/shtml2html.py
87 patchShebangs ./doc/man/man2html.py
91 rm -f $out/lib/*.la $out/lib/slurm/*.la
94 enableParallelBuilding = true;
96 passthru.tests.slurm = nixosTests.slurm;
99 homepage = "http://www.schedmd.com/";
100 description = "Simple Linux Utility for Resource Management";
101 platforms = platforms.linux;
102 license = licenses.gpl2Only;
103 maintainers = with maintainers; [ jagajaga markuskowa ];