util-linux: split lastlog into dedicated output

This commit is contained in:
Grimmauld
2025-07-31 16:58:48 +02:00
parent 732a532b9c
commit 025e637434
2 changed files with 24 additions and 5 deletions
+23 -5
View File
@@ -28,6 +28,8 @@
installShellFiles,
writeSupport ? stdenv.hostPlatform.isLinux,
shadowSupport ? stdenv.hostPlatform.isLinux,
# Doesn't build on Darwin, also doesn't really make sense on Darwin
withLastlog ? !stdenv.hostPlatform.isDarwin,
gitUpdater,
}:
@@ -72,10 +74,15 @@ stdenv.mkDerivation (finalPackage: rec {
"out"
"lib"
"man"
"login"
]
++ lib.optionals stdenv.hostPlatform.isLinux [ "mount" ]
++ [ "login" ]
++ lib.optionals stdenv.hostPlatform.isLinux [ "swap" ];
++ lib.optionals stdenv.hostPlatform.isLinux [
"mount"
"swap"
]
++ lib.optionals withLastlog [
"lastlog"
];
separateDebugInfo = true;
postPatch = ''
@@ -129,8 +136,7 @@ stdenv.mkDerivation (finalPackage: rec {
"--disable-ipcrm"
"--disable-ipcs"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# Doesn't build on Darwin, also doesn't really make sense on Darwin
++ lib.optionals (!withLastlog) [
"--disable-liblastlog2"
]
++ lib.optionals stdenv.hostPlatform.isStatic [
@@ -183,6 +189,18 @@ stdenv.mkDerivation (finalPackage: rec {
prefix=$login _moveSbin
ln -svf "$login/bin/"* $bin/bin/
''
+ lib.optionalString withLastlog ''
# moveToOutput "lib/liblastlog2*" "$lastlog"
${lib.optionalString (!stdenv.hostPlatform.isStatic) ''moveToOutput "lib/security" "$lastlog"''}
moveToOutput "lib/tmpfiles.d/lastlog2-tmpfiles.conf" "$lastlog"
moveToOutput "lib/systemd/system/lastlog2-import.service" "$lastlog"
substituteInPlace $lastlog/lib/systemd/system/lastlog2-import.service \
--replace-fail "$bin/bin/lastlog2" "$lastlog/bin/lastlog2"
moveToOutput "bin/lastlog2" "$lastlog"
ln -svf "$lastlog/bin/"* $bin/bin/
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
moveToOutput sbin/swapon "$swap"
+1
View File
@@ -11387,6 +11387,7 @@ with pkgs;
shadowSupport = false;
systemdSupport = false;
translateManpages = false;
withLastlog = false;
};
v4l-utils = qt6.callPackage ../os-specific/linux/v4l-utils { };