diff options
author | Janne Heß <janne@hess.ooo> | 2022-04-14 12:30:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-14 12:30:39 +0200 |
commit | 0581d31bf976918f9601da6af6ee89fe7fb53f2c (patch) | |
tree | 14131eb10b564c1f296f3e5c43d3020f66a5a3c0 /nixos | |
parent | 6361b4941a69395ebf15e6e56b142765fce850f9 (diff) | |
parent | c3428419e05c8e3ef2b722b82b2f7065a6d46441 (diff) | |
download | nixpkgs-0581d31bf976918f9601da6af6ee89fe7fb53f2c.tar nixpkgs-0581d31bf976918f9601da6af6ee89fe7fb53f2c.tar.gz nixpkgs-0581d31bf976918f9601da6af6ee89fe7fb53f2c.tar.bz2 nixpkgs-0581d31bf976918f9601da6af6ee89fe7fb53f2c.tar.lz nixpkgs-0581d31bf976918f9601da6af6ee89fe7fb53f2c.tar.xz nixpkgs-0581d31bf976918f9601da6af6ee89fe7fb53f2c.tar.zst nixpkgs-0581d31bf976918f9601da6af6ee89fe7fb53f2c.zip |
Merge pull request #167393 from iblech/patch-docs-cc
nixos-rebuild, switch-to-configuration: document and protect against cross compilation subtlety
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/doc/manual/man-nixos-rebuild.xml | 8 | ||||
-rwxr-xr-x | nixos/modules/system/activation/switch-to-configuration.pl | 12 |
2 files changed, 20 insertions, 0 deletions
diff --git a/nixos/doc/manual/man-nixos-rebuild.xml b/nixos/doc/manual/man-nixos-rebuild.xml index b2ca9f457a2..ea96f49fa97 100644 --- a/nixos/doc/manual/man-nixos-rebuild.xml +++ b/nixos/doc/manual/man-nixos-rebuild.xml @@ -548,6 +548,14 @@ (<replaceable>user@host</replaceable>). You can also set ssh options by defining the <envar>NIX_SSHOPTS</envar> environment variable. </para> + + <para> + Note that <command>nixos-rebuild</command> honors the + <literal>nixpkgs.crossSystem</literal> setting of the given configuration + but disregards the true architecture of the target host. Hence the + <literal>nixpkgs.crossSystem</literal> setting has to match the target + platform or else activation will fail. + </para> </listitem> </varlistentry> diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl index 9e5b760434a..3f0d976e70b 100755 --- a/nixos/modules/system/activation/switch-to-configuration.pl +++ b/nixos/modules/system/activation/switch-to-configuration.pl @@ -1,5 +1,17 @@ #! @perl@/bin/perl +# Issue #166838 uncovered a situation in which a configuration not suitable +# for the target architecture caused a cryptic error message instead of +# a clean failure. Due to this mismatch, the perl interpreter in the shebang +# line wasn't able to be executed, causing this script to be misinterpreted +# as a shell script. +# +# Let's detect this situation to give a more meaningful error +# message. The following two lines are carefully written to be both valid Perl +# and Bash. +printf "Perl script erroneously interpreted as shell script,\ndoes target platform match nixpkgs.crossSystem platform?\n" && exit 1 + if 0; + use strict; use warnings; use Config::IniFiles; |