From 135dbd8ec1f171d1373dfbcd1b669bbf835dad90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Tue, 12 Apr 2022 14:31:21 +0200 Subject: [PATCH 1/2] util-linuxCurses: move to aliases --- pkgs/top-level/aliases.nix | 1 + pkgs/top-level/all-packages.nix | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 897005fecaeb..40837d7a0e6e 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -1297,6 +1297,7 @@ mapAliases ({ urxvt_vtwheel = rxvt-unicode-plugins.vtwheel; # Added 2020-02-02 usb_modeswitch = throw "'usb_modeswitch' has been renamed to/replaced by 'usb-modeswitch'"; # Converted to throw 2022-02-22 usbguard-nox = usbguard; # Added 2019-09-04 + util-linuxCurses = util-linux; # Added 2022-04-12 utillinux = util-linux; # Added 2020-11-24 ### V ### diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 487d70ff3ad5..627a407cad2d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -23475,8 +23475,6 @@ with pkgs; util-linux = if stdenv.isLinux then callPackage ../os-specific/linux/util-linux { } else unixtools.util-linux; - util-linuxCurses = util-linux; - util-linuxMinimal = if stdenv.isLinux then util-linux.override { nlsSupport = false; ncurses = null; From dacbee21829cdac656711a5362e6eca90d4c2da6 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Sat, 19 Feb 2022 21:51:01 -0800 Subject: [PATCH 2/2] 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 --- pkgs/os-specific/linux/util-linux/default.nix | 19 +++++++++++-------- pkgs/top-level/all-packages.nix | 4 ++-- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/pkgs/os-specific/linux/util-linux/default.nix b/pkgs/os-specific/linux/util-linux/default.nix index d54f577def3e..3efb3914b85e 100644 --- a/pkgs/os-specific/linux/util-linux/default.nix +++ b/pkgs/os-specific/linux/util-linux/default.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!" diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 627a407cad2d..81da603405b9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { };