-
Notifications
You must be signed in to change notification settings - Fork 33
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
feat(srvos.flake): export the flake further #496
Conversation
When `srvos.flake` is set, also set: * NIX_PATH to the flake's nixpkgs input * flake-registry to the flake's inputs
5320215
to
a65bd00
Compare
@@ -42,6 +57,9 @@ in | |||
}; | |||
}; | |||
config = lib.mkIf (cfg.flake != null) { | |||
nix.settings.nix-path = lib.mkIf (cfg.flake.inputs ? nixpkgs) "nixpkgs=${cfg.flake.inputs.nixpkgs}"; |
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 can be a bit wonky in nix versions < 2.24: NixOS/nix#9574 (comment)
@@ -42,6 +57,9 @@ in | |||
}; | |||
}; | |||
config = lib.mkIf (cfg.flake != null) { | |||
nix.settings.nix-path = lib.mkIf (cfg.flake.inputs ? nixpkgs) "nixpkgs=${cfg.flake.inputs.nixpkgs}"; | |||
nix.settings.flake-registry = lib.mkDefault flake-registry; |
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.
Not sure we want this by default because this will upload nixpkgs to all kinds of machines, which can overhead and slow to upload. There is also a proper nixos option for this: https://github.com/Mic92/dotfiles/blob/9e2f4683cdf6a942e8ffc65ed3aa5ef27aaa4652/nixos/modules/pinned-registry.nix#L3
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.
Just now the module was using builtins.unsafeDiscardStringContext
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.
Also potentially Nixos has something like this now as well?
Should probably iterate a bit more on this. Besides @Mic92 s comments, I also learned that there's options for this since 24.05 in https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/misc/nixpkgs-flake.nix |
Ah. We should just switch to that. |
When
srvos.flake
is set, also set:As suggested in #466 by @phaer