diff options
author | Adam Joseph <adam@westernsemico.com> | 2022-02-20 20:14:49 -0800 |
---|---|---|
committer | Adam Joseph <adam@westernsemico.com> | 2022-05-03 13:31:41 -0700 |
commit | 006c38fa5353e0a157d1af59ca4b345f42a7ae16 (patch) | |
tree | 5526b0fe0ce808de5d1afd1369779b2b4bcd0e8f /lib/systems | |
parent | a31e9af0190e2177b49fbb552696f4b1717d4b71 (diff) |
platforms.nix: use {} on failed detection instead of silently assuming pc
This patch causes the autodetection code in lib/systems/platforms.nix to return {} if it cannot detect the platform and one of the platform.nix-detection-provided attributes (linux-kernel, gcc, and rustc) are accessed, rather than silently assuming the "pc" platform as was previously done. It is definitely safe to assume that code using these attributes is prepared to deal with `gcc` and `rustc` not being defined, because many of the working entries in this file don't define it. Regarding `linux-kernel` the situation is less certain, but some code (`lib/systems/default.nix` for example) is already designed to deal with that attribute being missing. At worst it would result in an "attribute not found" error. While adding mips64el bootstrap support to nixpkgs, the silent assumption that mips64el routers are actually Intel PCs caused significant frustration. This commit removes that assumption in order to save people who port nixpkgs to new platforms in the future from this frustration.
Diffstat (limited to 'lib/systems')
-rw-r--r-- | lib/systems/platforms.nix | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix index 04d55416242e1..a096fdde30942 100644 --- a/lib/systems/platforms.nix +++ b/lib/systems/platforms.nix @@ -3,7 +3,7 @@ # targetPlatform, etc) containing at least the minimal set of attrs # required (see types.parsedPlatform in lib/systems/parse.nix). This # file takes an already-valid platform and further elaborates it with -# optional fields such as linux-kernel, gcc, etc. +# optional fields; currently these are: linux-kernel, gcc, and rustc. { lib }: rec { @@ -568,5 +568,5 @@ rec { else if platform.parsed.cpu == lib.systems.parse.cpuTypes.powerpc64le then powernv - else pc; + else { }; } |