summary refs log tree commit diff
path: root/pkgs/os-specific/linux/util-linux
diff options
context:
space:
mode:
authorAndrew Marshall <andrew@johnandrewmarshall.com>2023-07-20 22:00:13 +0300
committerArtturin <Artturin@artturin.com>2023-07-20 22:03:15 +0300
commit3d774b445340d532d01ce968a29bf781d5459fd9 (patch)
treec2907241a5f41b9a31c9aa5a0df274d667752078 /pkgs/os-specific/linux/util-linux
parentebcb68135f00cda38f54a52ec3ca73db26fb4d7c (diff)
downloadnixpkgs-3d774b445340d532d01ce968a29bf781d5459fd9.tar
nixpkgs-3d774b445340d532d01ce968a29bf781d5459fd9.tar.gz
nixpkgs-3d774b445340d532d01ce968a29bf781d5459fd9.tar.bz2
nixpkgs-3d774b445340d532d01ce968a29bf781d5459fd9.tar.lz
nixpkgs-3d774b445340d532d01ce968a29bf781d5459fd9.tar.xz
nixpkgs-3d774b445340d532d01ce968a29bf781d5459fd9.tar.zst
nixpkgs-3d774b445340d532d01ce968a29bf781d5459fd9.zip
util-linux: Fix build on non-Linux
Build logs show:

> configure: WARNING: non-linux system; not building mount
> configure: WARNING: non-linux system; not building swapon

So skip these on non-Linux

Using getOutput prevents eval failures on other platforms.
Things should stay eval'able with NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1

Co-authored-by: Artturin <Artturin@artturin.com>
Diffstat (limited to 'pkgs/os-specific/linux/util-linux')
-rw-r--r--pkgs/os-specific/linux/util-linux/default.nix7
1 files changed, 5 insertions, 2 deletions
diff --git a/pkgs/os-specific/linux/util-linux/default.nix b/pkgs/os-specific/linux/util-linux/default.nix
index bd87c07879c..9a335010c87 100644
--- a/pkgs/os-specific/linux/util-linux/default.nix
+++ b/pkgs/os-specific/linux/util-linux/default.nix
@@ -55,7 +55,7 @@ stdenv.mkDerivation rec {
   # the greater util-linux toolset.
   # Compatibility is maintained by symlinking the binaries from the
   # smaller outputs in the bin output.
-  outputs = [ "bin" "dev" "out" "lib" "man" "mount" "login" "swap" ];
+  outputs = [ "bin" "dev" "out" "lib" "man" ] ++ lib.optionals stdenv.isLinux [ "mount" ] ++ [ "login" ] ++ lib.optionals stdenv.isLinux [ "swap" ];
   separateDebugInfo = true;
 
   postPatch = ''
@@ -110,20 +110,23 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  postInstall = ''
+  postInstall = lib.optionalString stdenv.isLinux ''
     moveToOutput bin/mount "$mount"
     moveToOutput bin/umount "$mount"
     ln -svf "$mount/bin/"* $bin/bin/
+    '' + ''
 
     moveToOutput sbin/nologin "$login"
     moveToOutput sbin/sulogin "$login"
     prefix=$login _moveSbin
     ln -svf "$login/bin/"* $bin/bin/
+    '' + lib.optionalString stdenv.isLinux ''
 
     moveToOutput sbin/swapon "$swap"
     moveToOutput sbin/swapoff "$swap"
     prefix=$swap _moveSbin
     ln -svf "$swap/bin/"* $bin/bin/
+    '' + ''
 
     installShellCompletion --bash bash-completion/*
   '';