-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Simplify flake.nix by creating generic callPackage-able package.nix #9535
Conversation
- Internal API docs once again work - configure skips checks for a bunch of things it doesn't need
The Perl bindings are not part of Nix, but a downstream package, so they don't belong in `package.nix`. They don't really belong as an attribute on `nix` either, but we can just leave that interface as is for now.
The I think this division of labor:
is actually good, but it is certainly something to discuss. |
We actually intentionally moved everything into one file (204291f) because IMHO that's easier to maintain and read (since you don't have to look at half a dozen files to know what's going on). Splitting it up adds a lot of boilerplate code for passing arguments (like the first 37 lines of Parameterizing |
@edolstra I had a feeling you might be skeptical :). There are a number of things to discuss, but I think these might be the important ones:
To me at least, this does not feel like a a return to the pre-204291f way of doing things, because:
These are indeed deficiencies with our current I think the right thing to do is stick to this established pattern in the ecosystem, and then try to think about things that improve it! I already thought in general use Nix's own And while we're at it, I'd add the |
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.
Finally working on the package expression won't involve looking for parentheses half the time, while anxious about possibly having to reindent 300 lines of pure conflict.
I might now actually point to this flake as a possible way to do it, if, oddly enough, someone isn't convinced to use flake-parts.
Also, love the documented package parameters. Not formally discoverable just yet, but most definitely a step in the right direction!
Admittedly, this is not a thorough review. I expect ~1 mistake and the most effective way to find it, is to merge. (unfortunately git diff --color-moved --ignore-space-change
wasn't helpful to me this time)
This could be addressed by the Nixpkgs architecture team, although it's just a tip of the iceberg when it comes to the situation with
which all compose in custom ways without any overarching design and plenty of bugs remaining because it's so ad hoc. |
Thanks for the positive feedback!
If we want to do this, I suggest we try to get Hydra back up to 100% first, e.g. by merging #9518. Then we at have a proper "control" for getting back up to 100% if this introduces any minor issues. |
configure.ac
Outdated
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.
Why does this need to include non-Nix changes? If it's only Nix changes, you should be able to verify correctness by making sure you get the same derivations. It's probably also cleaner that way.
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 configure script changes are because the configure script wrongly still checks for a bunch of would-be mandatory stuff when passing --disable-build
.
I could PR that separately before the rest, but note that due to switching to things like lib.enableFeature
I wasn't going for 100% preserved hashes.
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.
nix-diff
is your friend in that case. (EDIT: on derivation paths)
# Experimental fileset library: https://github.com/NixOS/nixpkgs/pull/222981 | ||
# Not an "idiomatic" flake input because: | ||
# - Propagation to dependent locks: https://github.com/NixOS/nix/issues/7730 | ||
# - Subflake would download redundant and huge parent flake | ||
# - No git tree hash support: https://github.com/NixOS/nix/issues/6044 | ||
inherit (import (builtins.fetchTarball { url = "https://github.com/NixOS/nix/archive/1bdcd7fc8a6a40b2e805bad759b36e64e911036b.tar.gz"; sha256 = "sha256:14ljlpdsp4x7h1fkhbmc4bd3vsqnx8zdql4h3037wh09ad6a0893"; })) | ||
fileset; | ||
|
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 might be a good time to switch to stable file set combinators, now in NixOS 23.11!
The one thing that changed is that lib.fileset.intersect
is now lib.fileset.intersection
.
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 I just saw #9546, probably best to do this PR independently of the update for now.
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.
Sure can do after that, or if you backport those to 23.05 I'll happily use them right away!
doInstallCheck | ||
; | ||
|
||
doBuild = !finalAttrs.dontBuild; |
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 combined with the subsequent dontBuild = !attrs.doBuild
feels weird. One of those seems superfluous...
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 is convenience so we are always using do*
identifiers. They are not redundant because attrs
vs finalAttrs
.
Nix team meeting notes: Big wide ranging discussion on how this touched on other issues
Decision: agree to do this, but it shouldn't be considered part of the public interface of the repo (the way |
Using `+` is Nixpkgs standard ideom for this, and helps avoid needless rebuilds somewhat.
OK I think I fixed macOS, and also @thufschmitt as of https://hydra.nixos.org/eval/1802827 basically fixed |
Issue introduced in NixOS#9535
(EDIT: I can reproduce in the default devshell as well, so it's not limited to This broke
specifically, eff9b12:
|
Fixed in #9633. |
Motivation
With a parametrized
package.nix
file, it is now easier to understand and change the main nix derivation and its derived ones for testing, internal api docs etc.thx a lot @Ericson2314
Context
This work item has been identified on the way towards meson.
Priorities
Add 👍 to pull requests you find important.