8 # `ps` with systemd support is able to properly report different
9 # attributes like unit name, so we want to have it on linux.
10 , withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
13 # procps is mostly Linux-only. Most commands require a running Linux
14 # system (or very similar like that found in Cygwin). The one
15 # exception is ‘watch’ which is portable enough to run on pretty much
16 # any UNIX-compatible system.
17 , watchOnly ? !(stdenv.hostPlatform.isLinux || stdenv.hostPlatform.isCygwin)
23 stdenv.mkDerivation rec {
27 # The project's releases are on SF, but git repo on gitlab.
29 url = "mirror://sourceforge/procps-ng/procps-ng-${version}.tar.xz";
30 hash = "sha256-IocNb+skeK22F85PCaeHrdry0mDFqKp7F9iJqWLF5C4=";
33 buildInputs = [ ncurses ]
34 ++ lib.optional withSystemd systemd;
35 nativeBuildInputs = [ pkg-config autoreconfHook ];
37 makeFlags = [ "usrbin_execdir=$(out)/bin" ]
38 ++ lib.optionals watchOnly [ "src/watch" ];
40 enableParallelBuilding = true;
42 # Too red; 8bit support for fixing https://github.com/NixOS/nixpkgs/issues/275220
43 configureFlags = [ "--disable-modern-top" "--enable-watch8bit" ]
44 ++ lib.optional withSystemd "--with-systemd"
45 ++ lib.optional stdenv.hostPlatform.isMusl "--disable-w"
46 ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
47 "ac_cv_func_malloc_0_nonnull=yes"
48 "ac_cv_func_realloc_0_nonnull=yes"
51 installPhase = lib.optionalString watchOnly ''
52 install -m 0755 -D src/watch $out/bin/watch
53 install -m 0644 -D man/watch.1 $out/share/man/man1/watch.1
56 # no obvious exec in documented arguments; haven't trawled source
57 # to figure out what exec binlore hits on
58 passthru.binlore.out = binlore.synthesize procps ''
59 execer cannot bin/{ps,top,free}
63 homepage = "https://gitlab.com/procps-ng/procps";
64 description = "Utilities that give information about processes using the /proc filesystem";
65 priority = 11; # less than coreutils, which also provides "kill" and "uptime"
66 license = licenses.gpl2Plus;
67 platforms = platforms.unix;