error:
… while checking flake output 'nixosConfigurations'
at /nix/store/4zvfbmfiqk9dafn99m43kpqwc3z94skk-source/flake.nix:45:7:
44| };
45| nixosConfigurations.ci = nixpkgs.lib.nixosSystem {
| ^
46| inherit system;
… while checking the NixOS configuration 'nixosConfigurations.ci'
at /nix/store/4zvfbmfiqk9dafn99m43kpqwc3z94skk-source/flake.nix:45:7:
44| };
45| nixosConfigurations.ci = nixpkgs.lib.nixosSystem {
| ^
46| inherit system;
… while evaluating the option `system.build.toplevel':
… while evaluating definitions from `/nix/store/6zgxj37rf9nsf5r0pd4pvwdazpbpnqi4-source/nixos/modules/system/activation/top-level.nix':
… while evaluating the option `services.openssh.extraConfig':
… while evaluating the option `services.openssh.sftpServerExecutable':
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: infinite recursion encountered
It seems like a pretty straightforward overlay, so I’m unsure what’s causing it.
I just assume that having git with gui support enabled it the actual goal.
If yes that i would not use overlays for this, as an overlay interfere with build/bootstrapping of nixpkgs.
So overriding some basic thing like git would result in a full/nearly full system rebuild.
I think that is not intended.
A better approach here IMHO is to acutally override the package and use that instance for the system closure.
So assuming you have enabled git via progams.git.enable = true, you could set
The reason I ran into this was that I was trying to work around a situation I got into recently, trying to make sure both the root repo and my personal settings would evaluate without --impure (making this an X-Y problem, it seems ). For some unknown reason I’m running into the following error when trying to nix flake check on my private repo:
error: The option `home-manager.users.victor.programs.git.package' is defined multiple times while it's expected to be unique.
Definition values:
- In `/nix/store/k8nkf470zpidpa5nh76lh2x6rxfzpwa4-source/flake.nix': <derivation git-2.47.1>
- In `/nix/store/1a77vx5nwg5zfbhn536c6si02zfxfm80-source/modules/home-manager.nix': <derivation git-2.47.1>
Use `lib.mkForce value` or `lib.mkDefault value` to change the priority on any of these definitions.
I didn’t know how I should fix this. home-manager.users.victor.programs.git.package is onlydefined in the root repo, but I do set up other things using Home Manager in my private repo, so I’m guessing that’s where the duplicate definition is coming from. But setting mkForce or mkDefault seems a bit like using !important in CSS - something which is bound to come back to bite me if I use it, and something which is probably avoidable by doing the Right Thing™.
Well an overlay is essentially replacing a given attribute everywhere it’s used with respect to a given nixpkgs instance.
If you think mkOverride/mkDefault/mkForce is a hammer, an overlay is like a wrecking ball.
Ultimately any option you choose will have downstream consequences, but setting mkDefault in your root repo seems to be the closest to what you want to do here if you want downstream configs to be able to override that default.
EDIT: and the comparison to CSS doesn’t entirely work here, because in CSS, you can always override the defaults by using narrower selectors; there’s no analogue in the module system, so you must use mkOverride and friends if you want to define an option in multiple modules within the same config.
Only in one. As mentioned, I only set home-manager.users.victor.programs.git.package in one place; the other repo just happens to set some other Home Manager settings.
(On a related note, I can’t make heads or tails of the error messages. It keeps saying one of the definitions is in /nix/store/k8nkf470zpidpa5nh76lh2x6rxfzpwa4-source/flake.nix, but there’s no Git package defined there.)