-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,21 @@ | |
|
||
let | ||
cfg = config.srvos; | ||
|
||
flake-registry = pkgs.writers.writeJSON "flake-registry.json" { | ||
version = 2; | ||
flakes = pkgs.lib.mapAttrsToList (name: value: { | ||
exact = true; | ||
from = { | ||
id = name; | ||
type = "indirect"; | ||
}; | ||
to = { | ||
path = toString value; | ||
type = "path"; | ||
}; | ||
}) ({ self = cfg.flake; } // cfg.flake.inputs); | ||
}; | ||
in | ||
{ | ||
options.srvos = { | ||
|
@@ -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 commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Also potentially Nixos has something like this now as well? |
||
|
||
system.extraSystemBuilderCmds = lib.optionalString cfg.symlinkFlake '' | ||
ln -s ${cfg.flake} $out/flake | ||
''; | ||
|
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)