summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrimmauld <Grimmauld@grimmauld.de>2025-08-11 10:32:11 +0200
committerGrimmauld <Grimmauld@grimmauld.de>2025-08-11 10:37:49 +0200
commita1d47a4ca33675e48868a6eb6dff57b0c448a22d (patch)
tree6446e8991c9734e1ee2c98953db6e68fb7efa5b4
parentnixos/pam: enable lastlog2 import service if any pam service uses lastlog (diff)
downloadnixpkgs-a1d47a4ca33675e48868a6eb6dff57b0c448a22d.tar.gz
nixos/pam: fix lastlog2 import service
-rw-r--r--nixos/modules/security/pam.nix16
1 files changed, 15 insertions, 1 deletions
diff --git a/nixos/modules/security/pam.nix b/nixos/modules/security/pam.nix
index a02bf460a9eb..abc632c1c07d 100644
--- a/nixos/modules/security/pam.nix
+++ b/nixos/modules/security/pam.nix
@@ -2316,7 +2316,21 @@ in
(lib.any (service: service.updateWtmp) (lib.attrValues config.security.pam.services))
{
tmpfiles.packages = [ pkgs.util-linux.lastlog ]; # /lib/tmpfiles.d/lastlog2-tmpfiles.conf
- services.lastlog2-import.enable = true;
+ services.lastlog2-import = {
+ enable = true;
+ wantedBy = [ "default.target" ];
+ after = [
+ "local-fs.target"
+ "systemd-tmpfiles-setup.service"
+ ];
+ # TODO: ${pkgs.util-linux.lastlog}/lib/systemd/system/lastlog2-import.service
+ # uses unpatched /usr/bin/mv, needs to be fixed on staging
+ # in the meantime, use a service drop-in here
+ serviceConfig.ExecStartPost = [
+ ""
+ "${lib.getExe' pkgs.coreutils "mv"} /var/log/lastlog /var/log/lastlog.migrated"
+ ];
+ };
packages = [ pkgs.util-linux.lastlog ]; # lib/systemd/system/lastlog2-import.service
};