-
-
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
builtins.getFlake: Allow inputs to be overridden #11952
base: master
Are you sure you want to change the base?
Conversation
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.
std::function<void(const InputPath & inputPath, const FlakeInput & input)> recurse; | ||
|
||
recurse = [&](const InputPath & inputPath, const FlakeInput & input) | ||
{ | ||
if (!input.ref) |
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.
It's not strictly necessary to use std::function
and its inherent indirection for recursive lambdas. Though in this case this shouldn't matter much. With C++23 it's possible to use "deducing this" https://en.cppreference.com/w/cpp/language/member_functions#Explicit_object_member_functions. For pre C++23 one can use the following hack:
auto recurse_impl = [&](auto& self, const InputPath & inputPath, const FlakeInput & input) {
....
recurse_impl(self, ....);
};
auto recurse = [&](const InputPath & inputPath, const FlakeInput & input) {
recurse_impl(recurse_impl, inputPath, input);
};
This avoids the virtual call via std::function
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.
Wow nice, didn't know about "deducing this". Apparently it will be available in gcc 14.
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2024-11-27-nix-team-meeting-minutes-198/56691/1 |
Added a release note. |
Motivation
Fixes #9154.
This uses the same syntax as flake inputs in flake.nix, e.g.
Note that currently it's not supported to set
flake = false
or touse
follows
(because lockFlake() doesn't support that for CLIoverrides), but it could be implemented in the future.
Context
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.