util-linux: split mount, login and swap utils into their own outputs

This commit is contained in:
Linus Heckemann
2023-06-12 10:26:04 +02:00
parent 4e036dd92e
commit eb0b0131ce
2 changed files with 24 additions and 6 deletions
+6 -5
View File
@@ -508,9 +508,10 @@ stdenv.mkDerivation (finalAttrs: {
"-Dsysvinit-path="
"-Dsysvrcnd-path="
"-Dsulogin-path=${util-linux}/bin/sulogin"
"-Dmount-path=${util-linux}/bin/mount"
"-Dumount-path=${util-linux}/bin/umount"
"-Dsulogin-path=${util-linux.login}/bin/sulogin"
"-Dnologin-path=${util-linux.login}/bin/nologin"
"-Dmount-path=${util-linux.mount}/bin/mount"
"-Dumount-path=${util-linux.mount}/bin/umount"
"-Dcreate-log-dirs=false"
# Use cgroupsv2. This is already the upstream default, but better be explicit.
@@ -561,8 +562,8 @@ stdenv.mkDerivation (finalAttrs: {
"man/systemd-makefs@.service.xml"
];
}
{ search = "/sbin/swapon"; replacement = "${lib.getBin util-linux}/sbin/swapon"; where = [ "src/core/swap.c" "src/basic/unit-def.h" ]; }
{ search = "/sbin/swapoff"; replacement = "${lib.getBin util-linux}/sbin/swapoff"; where = [ "src/core/swap.c" ]; }
{ search = "/sbin/swapon"; replacement = "${util-linux.swap}/sbin/swapon"; where = [ "src/core/swap.c" "src/basic/unit-def.h" ]; }
{ search = "/sbin/swapoff"; replacement = "${util-linux.swap}/sbin/swapoff"; where = [ "src/core/swap.c" ]; }
{
search = "/bin/echo";
replacement = "${coreutils}/bin/echo";
+18 -1
View File
@@ -50,7 +50,12 @@ stdenv.mkDerivation rec {
})
];
outputs = [ "bin" "dev" "out" "lib" "man" ];
# We separate some of the utilities into their own outputs. This
# allows putting together smaller systems depending on only part of
# 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" ];
separateDebugInfo = true;
postPatch = ''
@@ -106,6 +111,18 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
postInstall = ''
moveToOutput bin/mount "$mount"
moveToOutput bin/umount "$mount"
ln -svf "$mount/bin/"* $bin/bin/
moveToOutput sbin/nologin "$login"
moveToOutput sbin/sulogin "$login"
ln -svf "$login/bin/"* $bin/bin/
moveToOutput sbin/swapon "$swap"
moveToOutput sbin/swapoff "$swap"
ln -svf "$swap/bin/"* $bin/bin/
installShellCompletion --bash bash-completion/*
'';