summary refs log tree commit diff
path: root/pkgs/os-specific/linux/util-linux
diff options
context:
space:
mode:
authorSCOTT-HAMILTON <sgn.hamilton+github@protonmail.com>2021-11-26 00:00:24 +0100
committerSCOTT-HAMILTON <sgn.hamilton+github@protonmail.com>2021-11-26 16:38:42 +0100
commit1f0ef842ca88a57613faf1ef4cd9a5d4e77efd81 (patch)
tree5c547cbc5429a80aba010e3a636d6486c90fa097 /pkgs/os-specific/linux/util-linux
parent845225e7ab34d00bae7b20f47d06c7418210a631 (diff)
downloadnixpkgs-1f0ef842ca88a57613faf1ef4cd9a5d4e77efd81.tar
nixpkgs-1f0ef842ca88a57613faf1ef4cd9a5d4e77efd81.tar.gz
nixpkgs-1f0ef842ca88a57613faf1ef4cd9a5d4e77efd81.tar.bz2
nixpkgs-1f0ef842ca88a57613faf1ef4cd9a5d4e77efd81.tar.lz
nixpkgs-1f0ef842ca88a57613faf1ef4cd9a5d4e77efd81.tar.xz
nixpkgs-1f0ef842ca88a57613faf1ef4cd9a5d4e77efd81.tar.zst
nixpkgs-1f0ef842ca88a57613faf1ef4cd9a5d4e77efd81.zip
util-linux: fix static build
Diffstat (limited to 'pkgs/os-specific/linux/util-linux')
-rw-r--r--pkgs/os-specific/linux/util-linux/default.nix15
1 files changed, 14 insertions, 1 deletions
diff --git a/pkgs/os-specific/linux/util-linux/default.nix b/pkgs/os-specific/linux/util-linux/default.nix
index 0818d7bde79..b3536e038f0 100644
--- a/pkgs/os-specific/linux/util-linux/default.nix
+++ b/pkgs/os-specific/linux/util-linux/default.nix
@@ -1,8 +1,11 @@
 { lib, stdenv, fetchurl, pkg-config, zlib, shadow, libcap_ng
 , ncurses ? null, pam, systemd ? null
 , nlsSupport ? true
+, audit ? null
 }:
 
+assert stdenv.hostPlatform.isStatic -> audit != null;
+
 stdenv.mkDerivation rec {
   pname = "util-linux";
   version = "2.37.2";
@@ -57,7 +60,17 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs =
     [ zlib pam libcap_ng ]
-    ++ lib.filter (p: p != null) [ ncurses systemd ];
+    ++ lib.filter (p: p != null) [ ncurses systemd ]
+    # not sure how util-linux is linking with linux-pam,
+    # probably just with a simplistic -lpam.
+    # linux-pam doesn't seem to have a .pc file so I can't
+    # add -laudit to the Requires.private.
+    # libaudit is also needed directly anyway cf login-utils/login.c
+    # and sys-utils/hwclock.c, not sure how we got it working
+    # without audit on dynamic builds.
+    ++ lib.optionals stdenv.hostPlatform.isStatic [ audit ];
+
+  NIX_CFLAGS_LINK = lib.optionalString stdenv.hostPlatform.isStatic "-laudit";
 
   doCheck = false; # "For development purpose only. Don't execute on production system!"