summary refs log tree commit diff
path: root/nixos/modules/system/activation/top-level.nix
diff options
context:
space:
mode:
authorBernardo Meurer <bernardo@meurer.org>2021-12-07 02:38:26 -0800
committerGitHub <noreply@github.com>2021-12-07 02:38:26 -0800
commitebb7f07eec7dc57fc14acdc0b8206b4d4fe1da07 (patch)
treefc241aa3819048abc1f6c2db7f978ff178d1172a /nixos/modules/system/activation/top-level.nix
parentbe1c35e23d99b9db6c44aeba3e2a5d8303eaa086 (diff)
parentb30d6193684bf810ece401085f3442523f368bde (diff)
downloadnixpkgs-ebb7f07eec7dc57fc14acdc0b8206b4d4fe1da07.tar
nixpkgs-ebb7f07eec7dc57fc14acdc0b8206b4d4fe1da07.tar.gz
nixpkgs-ebb7f07eec7dc57fc14acdc0b8206b4d4fe1da07.tar.bz2
nixpkgs-ebb7f07eec7dc57fc14acdc0b8206b4d4fe1da07.tar.lz
nixpkgs-ebb7f07eec7dc57fc14acdc0b8206b4d4fe1da07.tar.xz
nixpkgs-ebb7f07eec7dc57fc14acdc0b8206b4d4fe1da07.tar.zst
nixpkgs-ebb7f07eec7dc57fc14acdc0b8206b4d4fe1da07.zip
Merge pull request #148751 from NixOS/feat/slight-stc-improvements
nixos/switch-to-configuration: Add small improvements
Diffstat (limited to 'nixos/modules/system/activation/top-level.nix')
-rw-r--r--nixos/modules/system/activation/top-level.nix7
1 files changed, 7 insertions, 0 deletions
diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix
index 58377ea6443..501998fa399 100644
--- a/nixos/modules/system/activation/top-level.nix
+++ b/nixos/modules/system/activation/top-level.nix
@@ -78,6 +78,13 @@ let
       export localeArchive="${config.i18n.glibcLocales}/lib/locale/locale-archive"
       substituteAll ${./switch-to-configuration.pl} $out/bin/switch-to-configuration
       chmod +x $out/bin/switch-to-configuration
+      ${optionalString (pkgs.stdenv.hostPlatform == pkgs.stdenv.buildPlatform) ''
+        if ! output=$($perl/bin/perl -c $out/bin/switch-to-configuration 2>&1); then
+          echo "switch-to-configuration syntax is not valid:"
+          echo "$output"
+          exit 1
+        fi
+      ''}
 
       echo -n "${toString config.system.extraDependencies}" > $out/extra-dependencies