diff options
author | sternenseemann <sternenseemann@systemli.org> | 2022-08-01 15:26:29 +0200 |
---|---|---|
committer | sternenseemann <sternenseemann@systemli.org> | 2022-08-01 15:26:29 +0200 |
commit | ba819ddadfe433c90f9e54dac1e54cd012207a5d (patch) | |
tree | c2eaacf60a9630c5ab72f2446a0917e35e04ffa0 /nixos | |
parent | 3ca851a1d17940d1bb25e73784bfc1ea8d129779 (diff) | |
parent | d05be940c0b418dae5046e6f4aa5690e8e59200a (diff) |
Merge remote-tracking branch 'origin/master' into haskell-updates
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/lib/eval-config.nix | 6 | ||||
-rw-r--r-- | nixos/modules/misc/nixpkgs.nix | 34 | ||||
-rw-r--r-- | nixos/modules/services/misc/dysnomia.nix | 2 | ||||
-rw-r--r-- | nixos/modules/virtualisation/nixos-containers.nix | 2 |
4 files changed, 40 insertions, 4 deletions
diff --git a/nixos/lib/eval-config.nix b/nixos/lib/eval-config.nix index 3b58ef297973e..791a03a3ba3cc 100644 --- a/nixos/lib/eval-config.nix +++ b/nixos/lib/eval-config.nix @@ -9,7 +9,9 @@ # expressions are ever made modular at the top level) can just use # types.submodule instead of using eval-config.nix evalConfigArgs@ -{ # !!! system can be set modularly, would be nice to remove +{ # !!! system can be set modularly, would be nice to remove, + # however, removing or changing this default is too much + # of a breaking change. To set it modularly, pass `null`. system ? builtins.currentSystem , # !!! is this argument needed any more? The pkgs argument can # be set modularly anyway. @@ -48,7 +50,7 @@ let # this. Since the latter defaults to the former, the former should # default to the argument. That way this new default could propagate all # they way through, but has the last priority behind everything else. - nixpkgs.system = lib.mkDefault system; + nixpkgs.system = lib.mkIf (system != null) (lib.mkDefault system); _module.args.pkgs = lib.mkIf (pkgs_ != null) (lib.mkForce pkgs_); }; diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix index ad017aff816c7..e991ff42028d7 100644 --- a/nixos/modules/misc/nixpkgs.nix +++ b/nixos/modules/misc/nixpkgs.nix @@ -244,6 +244,14 @@ in defaultText = literalExpression ''(import "''${nixos}/../lib").lib.systems.examples.aarch64-multiplatform''; description = '' + Systems with a recently generated <literal>hardware-configuration.nix</literal> + do not need to specify this option, unless cross-compiling, in which case + you should set <emphasis>only</emphasis> <option>nixpkgs.buildPlatform</option>. + + If this is somehow not feasible, you may fall back to removing the + <option>nixpkgs.hostPlatform</option> line from the generated config and + use the old options. + Specifies the platform on which NixOS should be built. When <code>nixpkgs.crossSystem</code> is unset, it also specifies the platform <emphasis>for</emphasis> which NixOS should be @@ -265,6 +273,10 @@ in default = null; example = { system = "aarch64-linux"; config = "aarch64-unknown-linux-gnu"; }; description = '' + Systems with a recently generated <literal>hardware-configuration.nix</literal> + may instead specify <emphasis>only</emphasis> <option>nixpkgs.buildPlatform</option>, + or fall back to removing the <option>nixpkgs.hostPlatform</option> line from the generated config. + Specifies the platform for which NixOS should be built. Specify this only if it is different from <code>nixpkgs.localSystem</code>, the platform @@ -280,7 +292,29 @@ in system = mkOption { type = types.str; example = "i686-linux"; + default = + if opt.hostPlatform.isDefined + then + throw '' + Neither ${opt.system} nor any other option in nixpkgs.* is meant + to be read by modules and configurations. + Use pkgs.stdenv.hostPlatform instead. + '' + else + throw '' + Neither ${opt.hostPlatform} nor or the legacy option ${opt.system} has been set. + You can set ${opt.hostPlatform} in hardware-configuration.nix by re-running + a recent version of nixos-generate-config. + The option ${opt.system} is still fully supported for NixOS 22.05 interoperability, + but will be deprecated in the future, so we recommend to set ${opt.hostPlatform}. + ''; + defaultText = lib.literalMD '' + Traditionally `builtins.currentSystem`, but unset when invoking NixOS through `lib.nixosSystem`. + ''; description = '' + This option does not need to be specified for NixOS configurations + with a recently generated <literal>hardware-configuration.nix</literal>. + Specifies the Nix platform type on which NixOS should be built. It is better to specify <code>nixpkgs.localSystem</code> instead. <programlisting> diff --git a/nixos/modules/services/misc/dysnomia.nix b/nixos/modules/services/misc/dysnomia.nix index 7d9c39a697370..1964fa93f9369 100644 --- a/nixos/modules/services/misc/dysnomia.nix +++ b/nixos/modules/services/misc/dysnomia.nix @@ -186,7 +186,7 @@ in dysnomia.properties = { hostname = config.networking.hostName; - inherit (config.nixpkgs.localSystem) system; + inherit (pkgs.stdenv.hostPlatform) system; supportedTypes = [ "echo" diff --git a/nixos/modules/virtualisation/nixos-containers.nix b/nixos/modules/virtualisation/nixos-containers.nix index b930151571294..deb9742a2c115 100644 --- a/nixos/modules/virtualisation/nixos-containers.nix +++ b/nixos/modules/virtualisation/nixos-containers.nix @@ -132,7 +132,7 @@ let # If the host is 64-bit and the container is 32-bit, add a # --personality flag. - ${optionalString (config.nixpkgs.localSystem.system == "x86_64-linux") '' + ${optionalString (pkgs.stdenv.hostPlatform.system == "x86_64-linux") '' if [ "$(< ''${SYSTEM_PATH:-/nix/var/nix/profiles/per-container/$INSTANCE/system}/system)" = i686-linux ]; then extraFlags+=" --personality=x86" fi |