Repository navigation
Conversation
Ma27
left a comment
There was a problem hiding this comment.
Some docs in e.g. the nixpkgs manual may be nice, but other than that, I like the idea %)
This way the disclaimer is more effective and the preceding docs are more focused.
| description = "A collection of packages for the Nix package manager"; | ||
|
|
||
| outputs = { self }: | ||
| inputs.parameters.url = "github:NixOS/nixpkgs/default-parameters"; |
There was a problem hiding this comment.
| inputs.parameters.url = "github:NixOS/nixpkgs/default-parameters"; | |
| inputs.parameters.url = ./default-params; |
There was a problem hiding this comment.
I'd say this is a good suggestion, but I'm hesitant to apply it, as subflakes are quite broken still.
|
I am eagerly waiting for this (or any other similar solution) to be merged. As mentioned in the PR, it would solve a common problem of flakes, that is to provide packages with unfree licenses. The current status is either to:
A flake with unfree outputs could just bundle its default nixpkgs config, that allows for Another usecase that comes to my mind is using Consuming flake -> nixpkgs with contentAddressedByDefault -> My flake In a similar fashion to https://github.com/numtide/nixpkgs-unfree , but for every combination of configuration options... |
|
Strong 👎 on this. We should not invent yet another undiscoverable ad-hoc configuration mechanism to work around the lack of a configuration mechanism in flakes. Flake inputs are not intended to pass configuration data around and we should not start using them for that. We should address the flake configuration issue at some point (probably after stabilising current flakes), but ideally in a standardized, discoverable way. |
| description = "A collection of packages for the Nix package manager"; | ||
|
|
||
| outputs = { self }: | ||
| inputs.parameters.url = "github:NixOS/nixpkgs/default-parameters"; |
There was a problem hiding this comment.
This refers to the "default-params" branch of the nixpkgs repo, which doesn't exist AFAIK and whose flake.nix presumably is the top-level flake. Did you mean github:NixOS/nixpkgs?dir=default-params or something like that?
There was a problem hiding this comment.
I thought I created the branch. At the time, a branch seemed more suitable, because before the source tree abstraction branch, a relative path subflake still required a nar hash that matches the local file contents, whereas an input from a branch was more easily understood and more stable in terms of its implementation in the nix tool.
The default parameters were "empty" values like [ ] for overlays and { } for config, and the default behavior emerges from having empty "overrides". So the defaults for these values wouldn't ever have to change, and the branch would most likely have only one commit referencing a tiny tree that's unrelated to trees in the normal branches. Putting it in a separate repo may have been more appropriate.
I agree with this part. One of the valuable lessons of NixOS is that a simple language intended for package management is powerful enough to support all configuration needs. By restricting the configuration system to a small but powerful set of primitives, being the Nix language, we have gained a system with a small core that provides a consistent paradigm for configuration that allows the interoperation of both highly capable modules (NixOS) and easy to use configurations (configuration.nix).
So one thing that NixOS teaches us is that function parameters, and by extension the attributes in them ( What are flake inputs if not parameters with defaults? The only thing about inputs that's really new is that their defaults come from a lock file, and this is great. As for the other aspects, they are a reinvention of concepts that already existed in the language, such as function application, but without interaction with critical other language features such as scoping. What has happened is that in the name of standardization, we have let go of our ideal of a small language, and now we're starting to see the paradigm falling apart, in the form of a claim that "inputs" are not suitable for "configuration", whereas previously these were the same thing, interoperating in harmony with the rest of the language. A warning from the Java world To understand what Flakes are, we can decompose them into
Dependency injection systems are the bread and butter of the Java world. These are systems that solve the "problem" of invoking the constructors of singleton-like objects and passing configuration parameters into them - ie exactly what flakes are doing. They have many frameworks to fulfill this task, but it is noteworthy that the Spring framework has gone full circle and reverted back to using regular code for this purpose, albeit annotated code. Both the sheer number of implementations and the reversal to regular code are indications that dependency injection is not solvable without the occasional need for a programming language to specify what goes where. If the JVM enforced a single dependency injection framework (like Nix does with the hardcoded It's not too late to simplify flakes. It's still experimental. I regret not taking part in the discussions and early design in 2018. I did not foresee that Flakes would be as invasive or that its design wouldn't be improved much from what was presented at that NixCon. My hindsight is 20/20. |
I think what we've learned is that functions (at least as done in Nix) are not suitable for configuration since they lack discoverability and overridability. The NixOS module system is a lot better from that perspective.
Flakes are intended as the first (specifying/locking repo dependencies). The CLI improvements (and conventions like standard flake outputs) are built on top of it, but are not part of the flake spec. It was not intended as a dependency injection system.
I don't think there is that much that can be simplified further, since the flake spec is already pretty minimal. The only major thing to reconsider is the input override mechanism, since that allows flake inputs to be (ab)used for dependency injection. For the flake standardization RFC, we could keep overrides as an experimental feature for the time being. |
Then it should not invoke the
If you don't invoke the
Where do I find the latest spec?
Yet the module system fits within the functional paradigm, which illustrates the point that a small Nix is good and supports both ease of use (config modules) and fairly complicated transformations (functions in modules). The same can apply to a more minimal implementation of the flake goals; properly excluding dependency injection. |
Yeah, follows and overrides and their interaction has been buggy. |
|
Maybe a compromise would be to create a proxy flake repo under I think @roberth's proposal is very important. The "flakes as paths" pattern is already being commonly abused. E.g., at the time of writing, I also think it's a fair remark that since it isn't exactly trivial to treat @edolstra I wonder how you feel on the matter now that some time has passed? Regarding the implementation and mirroring some comments from the nixos matrix: since flakes weren't designed to be a DI system, they aren't particularly strong in this role. E.g. if one wanted to use |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
Motivation for this change
Actually solve the problem of
nixpkgs.configin a flake, and more.Flakes are just functional programming with default arguments. The fact that everything has a default might throw you off, but it's still functional programming, where
followsis apply. Enjoy!Here's a flake producing
skypefromlegacyPackageswithout the unfree error:flake.nixparameters/flake.nixRefs
nix run ...error: unfree license, but no option to allow unfree #109421nix run#117842nix profile#101101nix buildusers as well #101367Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)nixos/doc/manual/md-to-db.shto update generated release notes