summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorStig Palmquist <stig@stig.io>2022-02-15 15:12:00 +0100
committerStig Palmquist <stig@stig.io>2022-02-15 15:37:37 +0100
commit3d713efe41ebcca0ebc6ff16dac958cdf3f4ac2d (patch)
tree20a929c4584c965b169f104b426ed0021bd9eb43 /nixos/modules/system
parent4e256c3c2ab796949dba0b2a6fb68cdc73cdcff7 (diff)
downloadnixpkgs-3d713efe41ebcca0ebc6ff16dac958cdf3f4ac2d.tar
nixpkgs-3d713efe41ebcca0ebc6ff16dac958cdf3f4ac2d.tar.gz
nixpkgs-3d713efe41ebcca0ebc6ff16dac958cdf3f4ac2d.tar.bz2
nixpkgs-3d713efe41ebcca0ebc6ff16dac958cdf3f4ac2d.tar.lz
nixpkgs-3d713efe41ebcca0ebc6ff16dac958cdf3f4ac2d.tar.xz
nixpkgs-3d713efe41ebcca0ebc6ff16dac958cdf3f4ac2d.tar.zst
nixpkgs-3d713efe41ebcca0ebc6ff16dac958cdf3f4ac2d.zip
nixos/switch-to-configuration: avoid Array::Compare dependency
Replace Array::Compare with a simple function, since Array::Compare
pulls down Module::Build which breaks cross compilation.
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/activation/switch-to-configuration.pl9
-rw-r--r--nixos/modules/system/activation/top-level.nix2
2 files changed, 7 insertions, 4 deletions
diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl
index 2ea871626e2..68333d43a5d 100644
--- a/nixos/modules/system/activation/switch-to-configuration.pl
+++ b/nixos/modules/system/activation/switch-to-configuration.pl
@@ -2,7 +2,6 @@
 
 use strict;
 use warnings;
-use Array::Compare;
 use Config::IniFiles;
 use File::Path qw(make_path);
 use File::Basename;
@@ -221,9 +220,13 @@ sub unrecord_unit {
 # - 2 if the units are different and a reload action is required
 sub compare_units {
     my ($old_unit, $new_unit) = @_;
-    my $comp = Array::Compare->new;
     my $ret = 0;
 
+    my $comp_array = sub {
+      my ($a, $b) = @_;
+      return join("\0", @{$a}) eq join("\0", @{$b});
+    };
+
     # Comparison hash for the sections
     my %section_cmp = map { $_ => 1 } keys %{$new_unit};
     # Iterate over the sections
@@ -255,7 +258,7 @@ sub compare_units {
             }
             my @new_value = @{$new_unit->{$section_name}{$ini_key}};
             # If the contents are different, the units are different
-            if (not $comp->compare(\@old_value, \@new_value)) {
+            if (not $comp_array->(\@old_value, \@new_value)) {
                 # Check if only the reload triggers changed
                 if ($section_name eq 'Unit' and $ini_key eq 'X-Reload-Triggers') {
                     $ret = 2;
diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix
index 4745239050b..b8aeee8c11b 100644
--- a/nixos/modules/system/activation/top-level.nix
+++ b/nixos/modules/system/activation/top-level.nix
@@ -117,7 +117,7 @@ let
     configurationName = config.boot.loader.grub.configurationName;
 
     # Needed by switch-to-configuration.
-    perl = pkgs.perl.withPackages (p: with p; [ ArrayCompare ConfigIniFiles FileSlurp NetDBus ]);
+    perl = pkgs.perl.withPackages (p: with p; [ ConfigIniFiles FileSlurp NetDBus ]);
   };
 
   # Handle assertions and warnings