Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / servers / computing / slurm / default.nix
blobfe8f95ecdf36cacc75aee212ad0054ce1b998859
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
15 stdenv.mkDerivation rec {
16   pname = "slurm";
17   version = "23.02.6.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 {
22     owner = "SchedMD";
23     repo = "slurm";
24     # The release tags use - instead of .
25     rev = "${pname}-${builtins.replaceStrings ["."] ["-"] version}";
26     sha256 = "sha256-azgGM4qfS0xtUaiGfXtu8MNYdgpZRUfx+zBgAAlmt6g=";
27   };
29   outputs = [ "out" "dev" ];
31   patches = [
32     # increase string length to allow for full
33     # path of 'echo' in nix store
34     ./common-env-echo.patch
35   ];
37   prePatch = ''
38     substituteInPlace src/common/env.c \
39         --replace "/bin/echo" "${coreutils}/bin/echo"
40   '' + (lib.optionalString enableX11 ''
41     substituteInPlace src/common/x11_util.c \
42         --replace '"/usr/bin/xauth"' '"${xorg.xauth}/bin/xauth"'
43   '');
45   # nixos test fails to start slurmd with 'undefined symbol: slurm_job_preempt_mode'
46   # https://groups.google.com/forum/#!topic/slurm-devel/QHOajQ84_Es
47   # this doesn't fix tests completely at least makes slurmd to launch
48   hardeningDisable = [ "bindnow" ];
50   nativeBuildInputs = [ pkg-config libtool python3 perl ];
51   buildInputs = [
52     curl python3 munge pam
53     libmysqlclient ncurses lz4 rdma-core
54     lua hwloc numactl readline freeipmi shadow.su
55     pmix json_c libjwt libyaml dbus libbpf
56     http-parser
57   ] ++ lib.optionals enableX11 [ xorg.xauth ]
58   ++ lib.optionals enableGtk2 [ gtk2 ];
60   configureFlags = with lib;
61     [ "--with-freeipmi=${freeipmi}"
62       "--with-http-parser=${http-parser}"
63       "--with-hwloc=${hwloc.dev}"
64       "--with-json=${json_c.dev}"
65       "--with-jwt=${libjwt}"
66       "--with-lz4=${lz4.dev}"
67       "--with-munge=${munge}"
68       "--with-yaml=${libyaml.dev}"
69       "--with-ofed=${lib.getDev rdma-core}"
70       "--sysconfdir=/etc/slurm"
71       "--with-pmix=${pmix}"
72       "--with-bpf=${libbpf}"
73       "--without-rpath" # Required for configure to pick up the right dlopen path
74     ] ++ (optional enableGtk2  "--disable-gtktest")
75       ++ (optional (!enableX11) "--disable-x11");
78   preConfigure = ''
79     patchShebangs ./doc/html/shtml2html.py
80     patchShebangs ./doc/man/man2html.py
81   '';
83   postInstall = ''
84     rm -f $out/lib/*.la $out/lib/slurm/*.la
85   '';
87   enableParallelBuilding = true;
89   passthru.tests.slurm = nixosTests.slurm;
91   meta = with lib; {
92     homepage = "http://www.schedmd.com/";
93     description = "Simple Linux Utility for Resource Management";
94     platforms = platforms.linux;
95     license = licenses.gpl2Only;
96     maintainers = with maintainers; [ jagajaga markuskowa ];
97   };