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

FR: nixpkgs.flake.{source,setNixPath,setFlakeRegistry} settings #1015

Closed
n8henrie opened this issue Jul 25, 2024 · 2 comments
Closed

FR: nixpkgs.flake.{source,setNixPath,setFlakeRegistry} settings #1015

n8henrie opened this issue Jul 25, 2024 · 2 comments

Comments

@n8henrie
Copy link
Contributor

These three settings seem like handy newish additions (24.05) for which it might make sense to have nix-darwin equivalents

With a flake-based NixOS system, these are all set by default and result in registry settings in /etc/nix/registry.json; in contrast mine is empty by default on nix-darwin.

The implementation looks fairly trivial: https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/misc/nixpkgs-flake.nix, I think a workaround is as simple as:

nix = lib.optionalAttrs pkgs.stdenv.isDarwin {
    nixPath = [ "nixpkgs=flake:nixpkgs" ];
    registry.nixpkgs.to = {
      type = "path";
      path = config.nixpkgs.source;
    } // {
# remainder of platform-independent nix config
}
@DaGenix
Copy link

DaGenix commented Nov 14, 2024

@n8henrie - I think this was maybe done in 8714f9e ?

@n8henrie
Copy link
Contributor Author

Indeed! Thanks for the heads up!

$ nix eval .#darwinConfigurations.mymachine.config.nixpkgs.flake.source
"/nix/store/kjny8s47s35v10a4rcdyrir2dklbj0v9-source"
$ nix eval .#darwinConfigurations.mymachine.config.nixpkgs.flake.setFlakeRegistry
true
$ nix eval .#darwinConfigurations.mymachine.config.nixpkgs.flake.setNixPath
true

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

No branches or pull requests

2 participants