-
Notifications
You must be signed in to change notification settings - Fork 47
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
support externally extensible systems #133
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 doesn't really fit the architecture, because we shouldn't be making assumptions about the user's flake inputs; certainly not in the core, non-optional modules.
It'd be nicer to have nix-systems implement the flake-parts interface, by providing a module that just sets the
systems
option. In that case it doesn't need to be a default either.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.
Does flake-parts auto-import inputs' flakeModules?
Alternatively, I would propose extending the flake-parts "systems" type to support
inherits systems;
when systems is an input.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.
By default it does try to import all inputs, and I wouldn't encourage that, because that would defeat lazy fetching and any solution to #119
Accepting a flake (I presume?) for an arbitrary option does not seem like a sensible solution to me. It abbreviates the syntax, but that is not a goal. An option should have a meaningful type.
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 already happens with the Nixpkgs module's
_module.args.pkgs
assuminginputs.nixpkgs
. This is justified throughpkgs
being an important, special case. I do think the same could be said here forsystems
.github:nix-systems/default
can't provide a module. All consumers have to assume thatinputs.systems.flake = false;
for the simple overrides this pattern allows to work properly. (inputs.systems.url = "file:./systems.nix";
is very intentionally valid.)github:nix-systems/nix-systems
could provide a module, but it's essentially documentation for the pattern and, if the goal ofgithub:nix-systems/default
moving togithub:NixOS/systems.default
is met, should cease to exist at some point, or maybe it might just move togithub:NixOS/systems.README
. Point is, it's far heavier than the other system inputs are and I don't ever see a reason it would be a module input. The idea is to deal with Nix flake's lack of sane systems handling by making overridingsystems
as boring & smooth as possible. Specifyinginputs.<name>.inputs.systems.follows = "systems";
will still be required for each input that usessystems
, which is boilerplatey, but ideally this boilerplate is cut to the bare minimum. Ifflake-parts
encourages using asystems
flake input that is overridden instead of a lexicalsystems
value stuck underoutputs
, only accessible to flake modules, then that's more of a barrier tosystems
being as widely integrated as possible.systems
is meant to be the special case flake input until this gets resolved in a cleaner way in Nix proper.We're hoping
github:nix-systems/default
is assignedflake:systems
in the flake registry, which would allow even less boilerplate for the happy path here.I would recommend changing the fancy conditional attrset merge here with normal
like the Nixpkgs module does.
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.
That's a temporary measure and a bad precedent, and documented as such in the code. I will remove it.
I wasn't aware of that requirement.
I think the standard way is good enough then. All this fancy
system
inheriting stuff is just a ridiculous workaround anyway.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.
That's fair; the idea behind this would be to reduce boilerplate just a little bit more and push people towards just using
inputs.systems
instead of deciding to list the inputs out inline. It's a ridiculous workaround because it's a ridiculous problem to have so many hard-coded and hard to override/patch instances of systems lists in flakes today.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.
It's probably better to discuss this more in #137, but I think it would be a shame to see that module go before a capable
inputs.nixpkgs.flakeModules.default
exists. Virtually every flake will need Nixpkgs, and having to manually set upconfig._module.args.pkgs
boilerplate or import a 3rd-party flake module for it will push people away from using flake-parts when they're first evaluating it. At the very least, some sort ofinputs.nixpkgs-flake-parts.url = "github:hercules-ci/nixpkgs-flake-parts";
needs to exist first, before this is removed. I think the Nixpkgs module is an okay exception until flake-parts picks up more momentum.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.
@roberth what is your conclusion? I wouldn't mind re-opening the PR if it's possible to move forwards.