···117117118118- `services.keyd` changed API. Now you can create multiple configuration files.
119119120120+- `baloo`, the file indexer/search engine used by KDE now has a patch to prevent files from constantly being reindexed when the device ids of the their underlying storage changes. This happens frequently when using btrfs or LVM. The patch has not yet been accepted upstream but it provides a significantly improved experience. When upgrading, reset baloo to get a clean index: `balooctl disable ; balooctl purge ; balooctl enable`.
121121+120122- `services.ddclient` has been removed on the request of the upstream maintainer because it is unmaintained and has bugs. Please switch to a different software like `inadyn` or `knsupdate`.
121123122124- The `vlock` program from the `kbd` package has been moved into its own package output and should now be referenced explicitly as `kbd.vlock` or replaced with an alternative such as the standalone `vlock` package or `physlock`.
+29-8
nixos/modules/config/update-users-groups.pl
···44use File::Slurp;
55use Getopt::Long;
66use JSON;
77+use DateTime;
7889# Keep track of deleted uids and gids.
910my $uidMapFile = "/var/lib/nixos/uid-map";
···2021 my ($path, $contents, $perms) = @_;
2122 return if $is_dry;
2223 write_file($path, { atomic => 1, binmode => ':utf8', perms => $perms // 0644 }, $contents) or die;
2424+}
2525+2626+# Converts an ISO date to number of days since 1970-01-01
2727+sub dateToDays {
2828+ my ($date) = @_;
2929+ my ($year, $month, $day) = split('-', $date, -3);
3030+ my $dt = DateTime->new(
3131+ year => $year,
3232+ month => $month,
3333+ day => $day,
3434+ hour => 0,
3535+ minute => 0,
3636+ second => 0,
3737+ time_zone => 'UTC',
3838+ );
3939+ return $dt->epoch / 86400;
2340}
24412542sub nscdInvalidate {
···285302286303foreach my $line (-f "/etc/shadow" ? read_file("/etc/shadow", { binmode => ":utf8" }) : ()) {
287304 chomp $line;
288288- my ($name, $hashedPassword, @rest) = split(':', $line, -9);
289289- my $u = $usersOut{$name};;
305305+ # struct name copied from `man 3 shadow`
306306+ my ($sp_namp, $sp_pwdp, $sp_lstch, $sp_min, $sp_max, $sp_warn, $sp_inact, $sp_expire, $sp_flag) = split(':', $line, -9);
307307+ my $u = $usersOut{$sp_namp};;
290308 next if !defined $u;
291291- $hashedPassword = "!" if !$spec->{mutableUsers};
292292- $hashedPassword = $u->{hashedPassword} if defined $u->{hashedPassword} && !$spec->{mutableUsers}; # FIXME
293293- chomp $hashedPassword;
294294- push @shadowNew, join(":", $name, $hashedPassword, @rest) . "\n";
295295- $shadowSeen{$name} = 1;
309309+ $sp_pwdp = "!" if !$spec->{mutableUsers};
310310+ $sp_pwdp = $u->{hashedPassword} if defined $u->{hashedPassword} && !$spec->{mutableUsers}; # FIXME
311311+ $sp_expire = dateToDays($u->{expires}) if defined $u->{expires};
312312+ chomp $sp_pwdp;
313313+ push @shadowNew, join(":", $sp_namp, $sp_pwdp, $sp_lstch, $sp_min, $sp_max, $sp_warn, $sp_inact, $sp_expire, $sp_flag) . "\n";
314314+ $shadowSeen{$sp_namp} = 1;
296315}
297316298317foreach my $u (values %usersOut) {
299318 next if defined $shadowSeen{$u->{name}};
300319 my $hashedPassword = "!";
301320 $hashedPassword = $u->{hashedPassword} if defined $u->{hashedPassword};
321321+ my $expires = "";
322322+ $expires = dateToDays($u->{expires}) if defined $u->{expires};
302323 # FIXME: set correct value for sp_lstchg.
303303- push @shadowNew, join(":", $u->{name}, $hashedPassword, "1::::::") . "\n";
324324+ push @shadowNew, join(":", $u->{name}, $hashedPassword, "1::::", $expires, "") . "\n";
304325}
305326306327updateFile("/etc/shadow", \@shadowNew, 0640);
+13-2
nixos/modules/config/users-groups.nix
···311311 '';
312312 };
313313314314+ expires = mkOption {
315315+ type = types.nullOr (types.strMatching "[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}");
316316+ default = null;
317317+ description = lib.mdDoc ''
318318+ Set the date on which the user's account will no longer be
319319+ accessible. The date is expressed in the format YYYY-MM-DD, or null
320320+ to disable the expiry.
321321+ A user whose account is locked must contact the system
322322+ administrator before being able to use the system again.
323323+ '';
324324+ };
314325 };
315326316327 config = mkMerge
···438449 name uid group description home homeMode createHome isSystemUser
439450 password passwordFile hashedPassword
440451 autoSubUidGidRange subUidRanges subGidRanges
441441- initialPassword initialHashedPassword;
452452+ initialPassword initialHashedPassword expires;
442453 shell = utils.toShellPath u.shell;
443454 }) cfg.users;
444455 groups = attrValues cfg.groups;
···637648 install -m 0700 -d /root
638649 install -m 0755 -d /home
639650640640- ${pkgs.perl.withPackages (p: [ p.FileSlurp p.JSON ])}/bin/perl \
651651+ ${pkgs.perl.withPackages (p: [ p.FileSlurp p.JSON p.DateTime ])}/bin/perl \
641652 -w ${./update-users-groups.pl} ${spec}
642653 '';
643654 };