about summary refs log tree commit diff
path: root/nixos/modules/system/activation/switch-to-configuration.pl
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-03-17 14:16:10 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-03-17 14:16:10 +0100
commitf9e2af1e8b62809e9af9acc92826c29f63db8043 (patch)
tree7332c09f99eda0444bab9570b047e09149902f69 /nixos/modules/system/activation/switch-to-configuration.pl
parentf13bd41384afadcd94e316759583359de37d15bd (diff)
downloadnixlib-f9e2af1e8b62809e9af9acc92826c29f63db8043.tar
nixlib-f9e2af1e8b62809e9af9acc92826c29f63db8043.tar.gz
nixlib-f9e2af1e8b62809e9af9acc92826c29f63db8043.tar.bz2
nixlib-f9e2af1e8b62809e9af9acc92826c29f63db8043.tar.lz
nixlib-f9e2af1e8b62809e9af9acc92826c29f63db8043.tar.xz
nixlib-f9e2af1e8b62809e9af9acc92826c29f63db8043.tar.zst
nixlib-f9e2af1e8b62809e9af9acc92826c29f63db8043.zip
switch-to-configuration: Don't require /etc/NIXOS
Check /etc/os-release if /etc/NIXOS doesn't exist.
Diffstat (limited to 'nixos/modules/system/activation/switch-to-configuration.pl')
-rw-r--r--nixos/modules/system/activation/switch-to-configuration.pl5
1 files changed, 4 insertions, 1 deletions
diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl
index 3f78ec0d48eb..67b2280af3be 100644
--- a/nixos/modules/system/activation/switch-to-configuration.pl
+++ b/nixos/modules/system/activation/switch-to-configuration.pl
@@ -26,7 +26,10 @@ EOF
     exit 1;
 }
 
-die "This is not a NixOS installation (/etc/NIXOS is missing)!\n" unless -f "/etc/NIXOS";
+# This is a NixOS installation if it has /etc/NIXOS or a proper
+# /etc/os-release.
+die "This is not a NixOS installation!\n" unless
+    -f "/etc/NIXOS" || (read_file("/etc/os-release", err_mode => 'quiet') // "") =~ /ID=nixos/s;
 
 openlog("nixos", "", LOG_USER);