Skip to content
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

Merged
merged 1 commit into from
Sep 3, 2024
Merged

feat(srvos.flake): export the flake further #496

merged 1 commit into from
Sep 3, 2024

Conversation

zimbatm
Copy link
Member

@zimbatm zimbatm commented Aug 30, 2024

When srvos.flake is set, also set:

  • NIX_PATH to the flake's nixpkgs input
  • flake-registry to the flake's inputs

As suggested in #466 by @phaer

@zimbatm zimbatm requested a review from phaer August 30, 2024 17:51
nixos/common/flake.nix Outdated Show resolved Hide resolved
nixos/common/flake.nix Outdated Show resolved Hide resolved
When `srvos.flake` is set, also set:
* NIX_PATH to the flake's nixpkgs input
* flake-registry to the flake's inputs
@phaer phaer merged commit 0de0f33 into main Sep 3, 2024
98 checks passed
@phaer phaer deleted the flake-settings branch September 3, 2024 11:14
@phaer phaer restored the flake-settings branch September 3, 2024 11:14
@phaer phaer deleted the flake-settings branch September 3, 2024 11:14
@@ -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}";
Copy link
Member

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;
Copy link
Member

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

Copy link
Member

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

Copy link
Member

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?

@phaer
Copy link
Member

phaer commented Sep 5, 2024

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

@Mic92
Copy link
Member

Mic92 commented Sep 5, 2024

Ah. We should just switch to that.

@phaer
Copy link
Member

phaer commented Sep 5, 2024

#500

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants