summary refs log tree commit diff
path: root/nixos/modules/system/activation/top-level.nix
diff options
context:
space:
mode:
authorJanne Heß <janne@hess.ooo>2021-10-10 13:02:09 +0200
committerJanne Heß <janne@hess.ooo>2021-10-17 14:33:42 +0200
commitc4d34cd1844d3784c69c5fdb06cad716330707e7 (patch)
tree1e0f03fb17e11fd445e358b1210f5142b44e69bd /nixos/modules/system/activation/top-level.nix
parentf0a31f9b9f7a96c22907e9b508cda891861ecee7 (diff)
downloadnixpkgs-c4d34cd1844d3784c69c5fdb06cad716330707e7.tar
nixpkgs-c4d34cd1844d3784c69c5fdb06cad716330707e7.tar.gz
nixpkgs-c4d34cd1844d3784c69c5fdb06cad716330707e7.tar.bz2
nixpkgs-c4d34cd1844d3784c69c5fdb06cad716330707e7.tar.lz
nixpkgs-c4d34cd1844d3784c69c5fdb06cad716330707e7.tar.xz
nixpkgs-c4d34cd1844d3784c69c5fdb06cad716330707e7.tar.zst
nixpkgs-c4d34cd1844d3784c69c5fdb06cad716330707e7.zip
nixos/top-level: Check Syntax of switch-to-configuration
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 026fd1791d3..68da910d29c 100644
--- a/nixos/modules/system/activation/top-level.nix
+++ b/nixos/modules/system/activation/top-level.nix
@@ -84,6 +84,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