-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib: Clean up how linux and gcc config is specified #107214
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some little corrections, but as you said this is generally still quite WIP so I haven't reviewed everything.
Thoughts:
- This seems to make sense
- but what exactly is the purpose of these platforms anyway? Kernel config is quite irrelevant to stdenv, and my impression is that that's the main thing differentiating platforms of the same arch from each other. Meanwhile things like linux's ARCH should probably be implied by
system
or similar…
@@ -79,13 +77,18 @@ rec { | |||
}; | |||
isStatic = final.isWasm || final.isRedox; | |||
|
|||
kernelArch = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be separate from platform / linux-kernel. This should be a direct mapping from cpu name to linux kernel name. We already have qemuArch and will soon have a "darwinArch" in #105026. This shouldn't be configurable like platform / kernel-arch is.
lib/systems/default.nix
Outdated
# Just a guess, based on `system` | ||
inherit | ||
(platforms.blank // { | ||
linux-kernel.arch = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see much benefit in a rename like this. The Linux kernel options really shouldn't be in crossSystem / hostPlatform at all. They're part of the Linux package and really have nothing to do with the whole package set; different kernels will have different configuration values for instance & there's no reason to special case Linux here. GCC, rustc, and linux-headers make sense though because they are part of the toolchain, and that determines what ABI you are going to use. |
55550c6
to
6d7d62a
Compare
OK this now builds, thanks for catching all my sloppiness @lheckemann. @matthewbauer I do agree with lots of that, actually. In particular, compiling a kernel is actually cross compilation, so while I do think kernel config could belong in some That said, I'm not really sure where the headers config ends and kernel config begins? Also do you know where to get the info for a complete-ish |
6d7d62a
to
630e31b
Compare
b4a4d47
to
f381b01
Compare
@matthewbauer What do you think now? Even though the linux stuff might be moving again, still think these changes are worth it. |
f381b01
to
15a6698
Compare
15a6698
to
045d377
Compare
I added a release notes for the breaking change. Can we get some final review on this? |
@@ -24,8 +24,6 @@ rec { | |||
# Either of these can be losslessly-extracted from `parsed` iff parsing succeeds. | |||
system = parse.doubleFromSystem final.parsed; | |||
config = parse.tripleFromSystem final.parsed; | |||
# Just a guess, based on `system` | |||
platform = platforms.select final; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we continue to export platform for external usage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this wouldn't work with the renames though... Maybe it's not worth it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, true. I was about to do your change below but I didn't think of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh post merge I realize the back-compat was already not attempting the linux stuff, oops.
@@ -24,8 +24,6 @@ rec { | |||
# Either of these can be losslessly-extracted from `parsed` iff parsing succeeds. | |||
system = parse.doubleFromSystem final.parsed; | |||
config = parse.tripleFromSystem final.parsed; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
config = parse.tripleFromSystem final.parsed; | |
config = parse.tripleFromSystem final.parsed; | |
platform = final.linux-kernel // { inherit (final) gcc rustc; }; |
The `platform` field is pointless nesting: it's just stuff that happens to be defined together, and that should be an implementation detail. This instead makes `linux-kernel` and `gcc` top level fields in platform configs. They join `rustc` there [all are optional], which was put there and not in `platform` in anticipation of a change like this. `linux-kernel.arch` in particular also becomes `linuxArch`, to match the other `*Arch`es. The next step after is this to combine the *specific* machines from `lib.systems.platforms` with `lib.systems.examples`, keeping just the "multiplatform" ones for defaulting.
045d377
to
8929989
Compare
stdenv rebuild which just got merged to m aster |
reverted in 0bc275e Please target staging to avoid the situation where people need to rebuild several hundred packages on PR reviews to master EDIT: grammar |
This is now possible, since the `platform` attribute has been removed in PR NixOS#107214. I've been waiting to do a cleanup like this for a long time!
Motivation for this change
The
platform
field is pointless nesting: it's just stuff that happens to be defined together, and that should be an implementation detail.This instead makes
linux-kernel
andgcc
top level fields in platform configs. They joinrustc
there [all are optional], which was put there and not inplatform
in anticipation of a change like this.linux-kernel.arch
in particular also becomeslinuxArch
, to match the other*Arch
es.The next step after is this to combine the specific machines from
lib.systems.platforms
withlib.systems.examples
, keeping just the "multiplatform" ones for defaulting.Progress on #34274
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)