util-linux: remove `? null` from inputs and convert to boolean flags

Prior to this commit, util-linux supported compilation without systemd
if systemd==null.  This commit preserves that behavior, and
additionally triggers it when the global systemdSupport attr is set to
false.  The systemdSupport argument is understood by many other
nixpkgs expressions and can be set globally in
~/.config/nixpkgs/config.nix.

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
main
Adam Joseph 2 years ago committed by Sandro Jäckel
parent 135dbd8ec1
commit dacbee2182
No known key found for this signature in database
GPG Key ID: 3AF5A43A3EECC2E5
  1. 19
      pkgs/os-specific/linux/util-linux/default.nix
  2. 4
      pkgs/top-level/all-packages.nix

@ -1,10 +1,13 @@
{ lib, stdenv, fetchurl, pkg-config, zlib, shadow, libcap_ng
, ncurses ? null, pam, systemd ? null
, ncursesSupport ? true
, ncurses, pam
, systemdSupport ? stdenv.isLinux
, systemd
, nlsSupport ? true
}:
stdenv.mkDerivation rec {
pname = "util-linux" + lib.optionalString ( !nlsSupport && ncurses == null && systemd == null ) "-minimal";
pname = "util-linux" + lib.optionalString (!nlsSupport && !ncursesSupport && !systemdSupport) "-minimal";
version = "2.37.4";
src = fetchurl {
@ -40,9 +43,9 @@ stdenv.mkDerivation rec {
"--disable-makeinstall-setuid" "--disable-makeinstall-chown"
"--disable-su" # provided by shadow
(lib.enableFeature nlsSupport "nls")
(lib.withFeature (ncurses != null) "ncursesw")
(lib.withFeature (systemd != null) "systemd")
(lib.withFeatureAs (systemd != null)
(lib.withFeature ncursesSupport "ncursesw")
(lib.withFeature systemdSupport "systemd")
(lib.withFeatureAs systemdSupport
"systemdsystemunitdir" "${placeholder "bin"}/lib/systemd/system/")
"SYSCONFSTATICDIR=${placeholder "lib"}/lib"
] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)
@ -56,9 +59,9 @@ stdenv.mkDerivation rec {
];
nativeBuildInputs = [ pkg-config ];
buildInputs =
[ zlib pam libcap_ng ]
++ lib.filter (p: p != null) [ ncurses systemd ];
buildInputs = [ zlib pam libcap_ng ]
++ lib.optionals ncursesSupport [ ncurses ]
++ lib.optionals systemdSupport [ systemd ];
doCheck = false; # "For development purpose only. Don't execute on production system!"

@ -23477,8 +23477,8 @@ with pkgs;
util-linuxMinimal = if stdenv.isLinux then util-linux.override {
nlsSupport = false;
ncurses = null;
systemd = null;
ncursesSupport = false;
systemdSupport = false;
} else util-linux;
v4l-utils = qt5.callPackage ../os-specific/linux/v4l-utils { };

Loading…
Cancel
Save