chore: split default.nix and main.nix#403
Conversation
|
Nixpkgs diff processing.. Will be available here |
jfly
left a comment
There was a problem hiding this comment.
LGTM, although this will cause conflicts with my upgrade PR :( That's fine, I can rebase.
I feel like I've seen ci.nix or release.nix as alternate names for this main.nix file, if you were searching for something idiomatic. No big deal either way.
Have you confirmed that the attrset returned by default.nix is an exact match (or superset) of the attrset previously returned? I haven't read the code carefully enough to confirm.
| { | ||
| system ? builtins.currentSystem, | ||
| nixpkgs ? sources.nixpkgs, | ||
| serokell-nix ? sources.serokell-nix, | ||
| }: | ||
| system ? null, | ||
| nixpkgs ? null, | ||
| serokell-nix ? null, | ||
| }@args: |
There was a problem hiding this comment.
This smells a little odd to me. Why not do args: ...? Are you trying to preserve the old behavior of not accepting any other keys? Could use a brief comment if that's why.
There was a problem hiding this comment.
It's a bit ugly, but it is a pretty common pattern in nix.
Here, we use it for a few orthoganal reasons.
The main reason we use it here is that nix-build (etc) can fill in named set-pattern arguments, which is why nix-build or nix-instantiate without arguments can evaluate the existing default.nix before this PR.
We could also solve that by not taking an args at all (like in shell.nix), but that breaks the other useages; supplying --arg or --argstr to nix-build or importing the file and calling it with a {} argument.
I'll add a comment.
There was a problem hiding this comment.
Added
Mirror
main.nix's function arguments for nix-command--argsupport
to default.nix and
NOTE: update mirrored args in
default.nixwhen modifying
to main.nix.
I wouldn't choose I see |
39cedd1 to
8b21b39
Compare
In preparation for the next commit, this temporarily removes `default.nix`.
This restores the `default.nix` entrypoint removed in commit 80089fc The `build // { /* other attrs */ }` update is moved out of `main.nix` and into `default.nix`, so that the main package can be evaluated lazily. As the main package relies on IFD, this allows other consumers of `main.nix` to evaluate without `allow-import-from-derivation`. For example, this fixes `nix flake show` when `allow-import-from-derivation = false`.
8b21b39 to
9c76d83
Compare
|
I split up the commit history a bit more, so when rebasing or blaming git will now recognize |
|
@jfly the nixpkgs-diff CI failure is expected here, because it runs from the default-branch's context and the this PR's changes to That means the one commit where I laid out the commits that way intentionally, so that git recognises the "old" If we want to merge this with the sane git history, you'll need to bypass the rulesets and force-merge (as repo admin). Incidentally, any other PRs based on a revision that doesn't have a |
Followup to #401 where I noticed that
nix flake showrequires IFD.This PR delays merging the default package into the top-level default attrset, and avoids needing to evaluate the actual package (currently using IFD) in order to compute flake outputs.
This fixes
nix flake showwhenallow-import-from-derivationisfalse.The previous behaviour (
nix-buildwithout arguments building the default package andnix-build -Ahaving access to specific attributes) is retained.