Introduce a new overrideInputs on {default,shell}Nix#49
Introduce a new overrideInputs on {default,shell}Nix#49ckiee wants to merge 2 commits intoNixOS:masterfrom
overrideInputs on {default,shell}Nix#49Conversation
This allows the user of this non-flake to have similar functionality
to `follows`.
Example (default.nix):
nix-repl> (import ./.).default
«derivation /nix/store/axgvq22kyb8ymchzq1mjayms4jdl6ni6-ledc-0.1.0.drv»
nix-repl> ((import ./.).overrideInputs { nixpkgs = <nixpkgs>; }).default
«derivation /nix/store/r8zw693hpg91yx6f57hyx1gk4zdiq2lm-ledc-0.1.0.drv»
Accept other forks also with type="github". This is enough to be a bit more convenient in a few more cases once this propagates into new future projects.
lheckemann
left a comment
There was a problem hiding this comment.
Makes sense overall, and the diff isn't even that big when whitespace is ignored :)
| in "${toString y'}${pad (toString m)}${pad (toString d)}${pad (toString hours)}${pad (toString minutes)}${pad (toString seconds)}"; | ||
|
|
||
| rootOverrides = | ||
| mapAttrs' |
There was a problem hiding this comment.
Any particular reason to use mapAttrs' and not mapAttrs here?
| if key == lockFile.root | ||
| then rootSrc | ||
| else | ||
| if rootOverrides.${key} != null then |
There was a problem hiding this comment.
| if rootOverrides.${key} != null then | |
| if (rootOverrides.${key} or null) != null then |
There was a problem hiding this comment.
Why or null if it returns null????
|
@lheckemann some work continues in https://github.com/ElvishJerricco/flake-compat/tree/add-overrideInputs. i don't currently have the spoons for a review cycle, this may change by next week. if you're looking for this to get merged, it'd probably be wise to make a PR against https://github.com/nix-community/flake-compat 💜 |
|
The current head of the PR is broken, it is missing inputs, no matter if overrideInputs is used or not. The PR at the nix-community flake-compat does work fine |
|
I am going to get a bit of movement on this pr. |
|
this i badly needed |
|
@adrian-gierakowski probably easier to just open a new pr. |
@Mic92 Yes, I was just looking into this. I think I'd like to build on top of this PR (if there is a chance it could be merged soon) as I'd like to add some tests |
adrian-gierakowski
left a comment
There was a problem hiding this comment.
I've taken this for a spin and here's my understanding of how it works:
- it allows to override specific top level input by providing a "path" (relative or absolute)
- any type of input can be overriden
- follows which point at overridden input's inputs are not modified
for example, given inputsaandb, anda.inputs.nixpkgs.follows = "b/nixpkgs", when b gets overridden,a'snixpkgswill remain unchanged
@Mic92 @roberth let me know what you think, is this sufficient or do you have something more sophisticated in mind?
|
The Nix CLI with I'm also concerned that this limited feature creates friction for a more generalized or "compliant" version of the same feature. Furthermore I believe there's significant tech debt in |
|
I'd recommend closing this PR now and continue the conversation on the rebased up-to-date version here |
This allows the user of this non-flake to have similar functionality to
follows.Example (default.nix):
It's currently only able to override our flake's direct inputs. Sorry for the big diff.