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, installShellFiles,
writeSupport ? stdenv.hostPlatform.isLinux, writeSupport ? stdenv.hostPlatform.isLinux,
shadowSupport ? 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, gitUpdater,
}: }:
@@ -72,10 +74,15 @@ stdenv.mkDerivation (finalPackage: rec {
"out" "out"
"lib" "lib"
"man" "man"
"login"
] ]
++ lib.optionals stdenv.hostPlatform.isLinux [ "mount" ] ++ lib.optionals stdenv.hostPlatform.isLinux [
++ [ "login" ] "mount"
++ lib.optionals stdenv.hostPlatform.isLinux [ "swap" ]; "swap"
]
++ lib.optionals withLastlog [
"lastlog"
];
separateDebugInfo = true; separateDebugInfo = true;
postPatch = '' postPatch = ''
@@ -129,8 +136,7 @@ stdenv.mkDerivation (finalPackage: rec {
"--disable-ipcrm" "--disable-ipcrm"
"--disable-ipcs" "--disable-ipcs"
] ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ ++ lib.optionals (!withLastlog) [
# Doesn't build on Darwin, also doesn't really make sense on Darwin
"--disable-liblastlog2" "--disable-liblastlog2"
] ]
++ lib.optionals stdenv.hostPlatform.isStatic [ ++ lib.optionals stdenv.hostPlatform.isStatic [
@@ -183,6 +189,18 @@ stdenv.mkDerivation (finalPackage: rec {
prefix=$login _moveSbin prefix=$login _moveSbin
ln -svf "$login/bin/"* $bin/bin/ 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 '' + lib.optionalString stdenv.hostPlatform.isLinux ''
moveToOutput sbin/swapon "$swap" moveToOutput sbin/swapon "$swap"
+1
View File
@@ -11387,6 +11387,7 @@ with pkgs;
shadowSupport = false; shadowSupport = false;
systemdSupport = false; systemdSupport = false;
translateManpages = false; translateManpages = false;
withLastlog = false;
}; };
v4l-utils = qt6.callPackage ../os-specific/linux/v4l-utils { }; v4l-utils = qt6.callPackage ../os-specific/linux/v4l-utils { };