mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-31 17:23:34 +00:00
nixos/update-users-groups: fix cross compilation
Since #246772, cross compiled NixOS is broken because the DateTime perl package that was used in the update-users-groups.pl script depends on Testutf8 which does not cross compile (see #198548). This PR drops the DateTime dependency in favour of TimePiece, which has less dependencies and whose closure does cross compile.
This commit is contained in:
parent
0b39810fe6
commit
d560a5e07d
@ -4,7 +4,7 @@ use File::Path qw(make_path);
|
||||
use File::Slurp;
|
||||
use Getopt::Long;
|
||||
use JSON;
|
||||
use DateTime;
|
||||
use Time::Piece;
|
||||
|
||||
# Keep track of deleted uids and gids.
|
||||
my $uidMapFile = "/var/lib/nixos/uid-map";
|
||||
@ -26,17 +26,8 @@ sub updateFile {
|
||||
# Converts an ISO date to number of days since 1970-01-01
|
||||
sub dateToDays {
|
||||
my ($date) = @_;
|
||||
my ($year, $month, $day) = split('-', $date, -3);
|
||||
my $dt = DateTime->new(
|
||||
year => $year,
|
||||
month => $month,
|
||||
day => $day,
|
||||
hour => 0,
|
||||
minute => 0,
|
||||
second => 0,
|
||||
time_zone => 'UTC',
|
||||
);
|
||||
return $dt->epoch / 86400;
|
||||
my $time = Time::Piece->strptime($date, "%Y-%m-%d");
|
||||
return $time->epoch / 60 / 60 / 24;
|
||||
}
|
||||
|
||||
sub nscdInvalidate {
|
||||
|
@ -648,7 +648,7 @@ in {
|
||||
install -m 0700 -d /root
|
||||
install -m 0755 -d /home
|
||||
|
||||
${pkgs.perl.withPackages (p: [ p.FileSlurp p.JSON p.DateTime ])}/bin/perl \
|
||||
${pkgs.perl.withPackages (p: [ p.FileSlurp p.JSON p.TimePiece ])}/bin/perl \
|
||||
-w ${./update-users-groups.pl} ${spec}
|
||||
'';
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user