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
nixpkgs module: Clean up platform options #38485
nixpkgs module: Clean up platform options #38485
Conversation
nixos/modules/misc/nixpkgs.nix
Outdated
default = null; | ||
localSystem = mkOption { | ||
type = types.attrs; # TODO utilize lib.systems.parsedPlatform | ||
example = lib.systems.examples.aarch64-multiplatform; |
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.
This would be a fully elaborated platform, and quite large. I could put something minimal too.
917f0f3
to
f942916
Compare
@@ -158,7 +158,7 @@ in | |||
|
|||
dysnomia.properties = { | |||
hostname = config.networking.hostName; | |||
system = if config.nixpkgs.system == "" then builtins.currentSystem else config.nixpkgs.system; | |||
inherit (config.nixpkgs.localSystem) system; |
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.
Don't need fallback cause I added default one in module.
nixos/modules/misc/nixpkgs.nix
Outdated
|
||
Ignored when <code>nixpkgs.pkgs</code> is set. | ||
''; | ||
}; | ||
|
||
system = mkOption { |
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.
Renaming this breaks nixops.
@@ -36,7 +36,7 @@ let | |||
_file = ./eval-config.nix; | |||
key = _file; | |||
config = { | |||
nixpkgs.system = lib.mkDefault system_; | |||
nixpkgs.localSystem = lib.mkDefault { inherit system; }; |
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.
The ? builtins.currentSystem
fallback above is no longer needed. At some future point I'll make this work with an // optionalAttrs (args ? system) { .. }
instead.
f942916
to
bfa13a8
Compare
I put |
N.B. local system was added in https://github.com/NixOS/nixpkgs/pull/22575/files, pre 17.09 I believe. |
Oops didn't mean to right that even before @edolstra's comment. |
IMHO a |
bfa13a8
to
0debd0b
Compare
@edolstra I've removed the deprecation part for a separate PR. This isn't just for cross compilation. If you want to do one of
or many other such things for native builds it is necessary too. I choose |
0debd0b
to
17a7eae
Compare
@edolstra BTW it would be much conceptually better to make one setting always be the run platform, and make the other optional one the build platform for cross, than what we do here (one is always build, the optional one is run), but I didn't want to break the |
- `localSystem` is added, it strictly supercedes system - `crossSystem`'s description mentions `localSystem` (and vice versa). - No more weird special casing I don't even understand TEMP
17a7eae
to
c6f7d43
Compare
Renaming stuff is not at all necessary for doing that. Setting ARM version is already possible by doing
I consider this a bad idea. |
OK my bad with the ARM example. But if we had this, would we have needed to implement that in Nix? It's not like we do the same for |
Also, concretely, there is more in https://github.com/NixOS/nixpkgs/blob/master/lib/systems/default.nix#L20-L46 here than |
Yes we would because the ARM version affects
Yes we do, actually. If you boot with an old enough processor,
But most people don't have any need to change them from the defaults. The existing interface works just fine for them. |
@dezgeg Ok fair point with Say we leave I guess I'll relent and abandon plans to get rid of |
It'd be nice if there was a sane way to set localSystem in a NixOS config. My immediate use-case is musl, "surprise!", but at a high-level it's strange to not be able to reasonably set Nixpkgs options from a NixOS configuration. On the subject, at least my needs would be met by a mechanism to specify part of the configuration-- this has advantages when targeting multiple "systems", instead of what I have to do now: either hardcode x86_64-unknown-linux-musl or do something completely terrible like introducing a map of system -> localSystem.config. I'm not sure about other use cases. |
Yeah this no longer deprecates anything, and we have until 18.09 to bike-shed the localSystem name / make other improvements. |
This is great, thanks! Few quick questions/comments now that I've started using it:
I'm not sure what the best solution for this is, I'm not sure how reasonable it would be to try to plumb localSystem everywhere or what other options there might be. But just thought I'd share/report to get some discussion going :). Thanks! On a slightly related note: it'd be "nice" if there was a good way to invoke NixOS tests and other infrastructure with control over (it'd be great if Borg could --at least when asked-- do some musl testing, for example. Anyway...) |
system
is replaced with the more generallocalSystem
crossSystem
's description mentionslocalSystem
(and vice versa).Motivation for this change
localSystem
is the better name we want to use going forward. It's been around for quite a while, actually.Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)