diff --git a/pkgs/os-specific/linux/util-linux/default.nix b/pkgs/os-specific/linux/util-linux/default.nix index fc98abcf0fd5..3b8d5f53e787 100644 --- a/pkgs/os-specific/linux/util-linux/default.nix +++ b/pkgs/os-specific/linux/util-linux/default.nix @@ -1,5 +1,5 @@ { lib, stdenv, fetchurl, pkg-config, zlib, shadow -, capabilitiesSupport ? true +, capabilitiesSupport ? stdenv.isLinux , libcap_ng , libxcrypt , ncursesSupport ? true @@ -12,6 +12,9 @@ , translateManpages ? true , po4a , installShellFiles +, writeSupport ? stdenv.isLinux +, shadowSupport ? stdenv.isLinux +, memstreamHook }: stdenv.mkDerivation rec { @@ -33,10 +36,11 @@ stdenv.mkDerivation rec { postPatch = '' patchShebangs tests/run.sh - substituteInPlace include/pathnames.h \ - --replace "/bin/login" "${shadow}/bin/login" substituteInPlace sys-utils/eject.c \ --replace "/bin/umount" "$bin/bin/umount" + '' + lib.optionalString shadowSupport '' + substituteInPlace include/pathnames.h \ + --replace "/bin/login" "${shadow}/bin/login" ''; # !!! It would be better to obtain the path to the mount helpers @@ -45,11 +49,11 @@ stdenv.mkDerivation rec { # root... configureFlags = [ "--localstatedir=/var" - "--enable-write" "--disable-use-tty-group" "--enable-fs-paths-default=/run/wrappers/bin:/run/current-system/sw/bin:/sbin" "--disable-makeinstall-setuid" "--disable-makeinstall-chown" "--disable-su" # provided by shadow + (lib.enableFeature writeSupport "write") (lib.enableFeature nlsSupport "nls") (lib.withFeature ncursesSupport "ncursesw") (lib.withFeature systemdSupport "systemd") @@ -74,7 +78,8 @@ stdenv.mkDerivation rec { ++ lib.optionals pamSupport [ pam ] ++ lib.optionals capabilitiesSupport [ libcap_ng ] ++ lib.optionals ncursesSupport [ ncurses ] - ++ lib.optionals systemdSupport [ systemd ]; + ++ lib.optionals systemdSupport [ systemd ] + ++ lib.optionals (stdenv.system == "x86_64-darwin") [ memstreamHook ]; doCheck = false; # "For development purpose only. Don't execute on production system!" @@ -90,7 +95,7 @@ stdenv.mkDerivation rec { changelog = "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v${lib.versions.majorMinor version}/v${version}-ReleaseNotes"; # https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/tree/README.licensing license = with licenses; [ gpl2Only gpl2Plus gpl3Plus lgpl21Plus bsd3 bsdOriginalUC publicDomain ]; - platforms = platforms.linux; + platforms = platforms.unix; priority = 6; # lower priority than coreutils ("kill") and shadow ("login" etc.) packages }; }