-
-
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
Override inputs when using builtins.getFlake
#9154
Comments
this is making using software distributed as flakes from a "legacy" configuration.nix or a non-flake project essentially impossible, especially if your system isn't running on unstable:
I'm very close to ripping flake.nix out of all of my projects and distributing them classically, rather than going "all-in" on flakes. |
Adding this feature would also allow e.g. a Hydra jobset to have an additional job which overrides the flake input to point at a more current version (e.g. to automatically test against the current nixpkgs from a non-flake job with a regular git input which uses The usual approach of working around this by creating a parent flake which overrides the input as mentioned by OP also does not work programmatically since any flake created within Nix at runtime will be a store path, and anything created before runtime has effectively the same issue of being potentially outdated at runtime. |
This uses the same syntax as flake inputs in flake.nix, e.g. builtins.getFlake { url = "github:NixOS/nix/55bc52401966fbffa525c574c14f67b00bc4fb3a"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/c69a9bffbecde46b4b939465422ddc59493d3e4d"; } Note that currently it's not supported to set `flake = false` or to use `follows` (because lockFlake() doesn't support that for CLI overrides), but it could be implemented in the future. Fixes NixOS#9154.
Is your feature request related to a problem? Please describe.
Sometimes it can be cumbersome to refactor a derivation to 'pass in' a flake input, for example when you're working with a 'classic' nix system or the derivation you want to modify is somewhere 'deep'. In these cases the
getFlake
builtin comes in handy.getFlake
, however, strictly honors theflake.lock
of whatever you got. If that refers to something big, such as nixpkgs, this might lead to different versions of that dependency in your store.Describe the solution you'd like
It would be nice to be able to 'pass in' inputs to
getFlake
, similar toinput.nixpkgs.follows = "nixpkgs"
inflake.nix
or--override-input
on the nix commandline.Priorities
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: