summary refs log tree commit diff
path: root/pkgs/os-specific/linux/util-linux
diff options
context:
space:
mode:
authorElias Naur <mail@eliasnaur.com>2023-05-18 15:37:17 -0600
committerWeijia Wang <9713184+wegank@users.noreply.github.com>2023-05-22 10:28:03 +0300
commitb1a49db9145f61ba299f4ac68e203822a15b1d96 (patch)
tree06722f2a18f8fa0dd4f81e86a25155b5cfa58f88 /pkgs/os-specific/linux/util-linux
parent7b61a60758f6b12ade200d015db79cb2a5be2d3c (diff)
downloadnixpkgs-b1a49db9145f61ba299f4ac68e203822a15b1d96.tar
nixpkgs-b1a49db9145f61ba299f4ac68e203822a15b1d96.tar.gz
nixpkgs-b1a49db9145f61ba299f4ac68e203822a15b1d96.tar.bz2
nixpkgs-b1a49db9145f61ba299f4ac68e203822a15b1d96.tar.lz
nixpkgs-b1a49db9145f61ba299f4ac68e203822a15b1d96.tar.xz
nixpkgs-b1a49db9145f61ba299f4ac68e203822a15b1d96.tar.zst
nixpkgs-b1a49db9145f61ba299f4ac68e203822a15b1d96.zip
util-linux: add darwin support
Diffstat (limited to 'pkgs/os-specific/linux/util-linux')
-rw-r--r--pkgs/os-specific/linux/util-linux/default.nix17
1 files changed, 11 insertions, 6 deletions
diff --git a/pkgs/os-specific/linux/util-linux/default.nix b/pkgs/os-specific/linux/util-linux/default.nix
index fc98abcf0fd..3b8d5f53e78 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
   };
 }