summary refs log tree commit diff
path: root/nixos/modules/config
diff options
context:
space:
mode:
authorr-vdp <ramses@well-founded.dev>2023-08-02 13:51:41 +0200
committerr-vdp <ramses@well-founded.dev>2023-08-02 13:51:41 +0200
commit44a7059bf287366e96f8188cf834a0a63932e220 (patch)
tree15930a91bd0b33aa57a3c4d800f4fae4ebb3f015 /nixos/modules/config
parent127e2ed645137ccbcbedb3ba316e1c8bf3ab9ae1 (diff)
downloadnixpkgs-44a7059bf287366e96f8188cf834a0a63932e220.tar
nixpkgs-44a7059bf287366e96f8188cf834a0a63932e220.tar.gz
nixpkgs-44a7059bf287366e96f8188cf834a0a63932e220.tar.bz2
nixpkgs-44a7059bf287366e96f8188cf834a0a63932e220.tar.lz
nixpkgs-44a7059bf287366e96f8188cf834a0a63932e220.tar.xz
nixpkgs-44a7059bf287366e96f8188cf834a0a63932e220.tar.zst
nixpkgs-44a7059bf287366e96f8188cf834a0a63932e220.zip
nixos/update-users-groups: set expiry correctly for new users
Diffstat (limited to 'nixos/modules/config')
-rw-r--r--nixos/modules/config/update-users-groups.pl4
1 files changed, 3 insertions, 1 deletions
diff --git a/nixos/modules/config/update-users-groups.pl b/nixos/modules/config/update-users-groups.pl
index 7ec4235db51..fea31ab280f 100644
--- a/nixos/modules/config/update-users-groups.pl
+++ b/nixos/modules/config/update-users-groups.pl
@@ -316,8 +316,10 @@ foreach my $u (values %usersOut) {
     next if defined $shadowSeen{$u->{name}};
     my $hashedPassword = "!";
     $hashedPassword = $u->{hashedPassword} if defined $u->{hashedPassword};
+    my $expires = "";
+    $expires = dateToDays($u->{expires}) if defined $u->{expires};
     # FIXME: set correct value for sp_lstchg.
-    push @shadowNew, join(":", $u->{name}, $hashedPassword, "1::::::") . "\n";
+    push @shadowNew, join(":", $u->{name}, $hashedPassword, "1::::", $expires, "") . "\n";
 }
 
 updateFile("/etc/shadow", \@shadowNew, 0640);