Draft for nixpkgs flake module#126
Draft for nixpkgs flake module#126ghost wants to merge 6 commits intohercules-ci:mainfrom Criome:overlayedFlakes
Conversation
roberth
left a comment
There was a problem hiding this comment.
Hi Li, how's it going?
I think it should be possible to turn most if not all changes here into additions to the nixpkgs.flakeModules.default module. Perhaps we could add a deprecation message to the old default, suggesting that they import the nixpkgs module themselves. The idea is to reinforce the modular architecture and give users more choice.
What do you think?
There was a problem hiding this comment.
I don't think additions to this module are necessary.
| ); | ||
| }; | ||
| }; | ||
| imports = [ inputs.nixpkgs.flakeModules.default ]; |
There was a problem hiding this comment.
We shouldn't make assumptions about the inputs, especially not in the core of flake parts.
| imports = [ inputs.nixpkgs.flakeModules.default ]; | ||
| _file = ./nixpkgs.nix; | ||
| config = { | ||
| _module.args.pkgs = lib.mkForce finalPkgs; |
There was a problem hiding this comment.
I would give this responsibility to nixpkgs.flakeModules.default, and leave the original default in place for the time being.
|
|
||
| in | ||
| { | ||
| imports = [ inputs.nixpkgs.flakeModules.default ]; |
There was a problem hiding this comment.
As a general rule, modules are imported at the top level only. This makes importing more consistent, not having to wonder where to import it.
Maybe this was added by mistake? Maybe it doesn't even raise an error, as the laziness can mask problems sometimes; a blessing and a curse.
There was a problem hiding this comment.
I thought this would be needed to expose the nixpkgs option to the perSystem evaluation scope. Will experiment with removing it now.
There was a problem hiding this comment.
I see you've avoided the perSystem option there. I think users would expect the Nixpkgs to be in perSystem.
See my comment above. Am I wrong? I'm using nixpkgs option inside the perSystem scope here
I see you've avoided the Here's what I think that might look like. A general nixpkgs invocation module, not specific to any context (where flake-parts is such a context):
{ config, lib, ... }: {
options.nixpkgs = {
overlays = ...;
system = ...; # or even hostPlatform + buildPlatform options
config = ...;
}
config._module.args = lib.mkDefault (import .. { ... });
}The module for
|
Beat you to it: clojix does that |
That would make nixpkgs depent on flake-parts for After reconsidering this from a few steps back, I realized none of this really needs to go in either flake-parts or nixpkgs. In fact, I'm rather of the opinion that nothing should go in nixpkgs anymore, since flakes is partly about splitting giant mono-repos. I have a rather funny story related to that; a few years ago when I began to play with flakes, I was going to make a flake for every major function, only to realize (after creating like 50 repos), that functions can't use caching very well, if at all. So I might just create a repo and call it 'nixpkgs-flake' or something. Stay tuned. And thanks for all the help. Off-topic: I would love to know your birth time and location, I would give you a quick astrology reading one of these days. Get the exact birth time if possible, to the minute. Just looking at your profile pic and from reading your comments and code, my first bet is Virgo. Did I get that right? Lol! Cheers! ;) |
That is true; nothing needs to go anywhere. Flake-parts is designed to be flexible like that, because of the purposely limited scope of its core.
Sounds good! You can send a PR to the sister repo https://github.com/hercules-ci/flake.parts-website if you'd like it to be listed on flake.parts.
You're welcome. Do you imply that you're discontinuing the nixpkgs PR as well? I'd still like to have a fairly simple module in Nixpkgs that does the right thing for most people; just a little bit more advanced than the placeholder that I want to remove from flake-parts, reinforcing the idea that it certainly doesn't have to go into flake-parts, by not even providing any built-in solution in the near future. I'll probably add it myself soon, because I keep getting requests about overlays and such. |
The universe is far more mysterious than that... 🌟 |
|
I'll close as unattended, will make a new one if I take another shot, as it would be different now. Related to a module in nixpkgs, which should share some code as you said. Lib sounds right, since that is nixpkgs's lib, and overlays are one of its API types. I want to move away from overlays for sure though. I think a github-like namespace would do a lot, especially with pre-typed subnames: |
I'm trying to see if that means Virgo or not ... Much thanks and gratitude! |
Uses NixOS/nixpkgs#222155
This is shared currently to document and test.
Done from a live coding on youtube
Sajban-style-preview commit message:
(added (naiveImplementationFor (nixpkgs flakeModule)))