Closed fmckeogh closed 6 months ago
I believe this is by design: https://nixos.wiki/wiki/Flakes :)
For flakes in git repos, only files in the working tree will be copied to the store.
(This should probably say "index" or "staging area" instead of "working tree".)
When a git folder exists, flake will only copy files added in git to maximize reproducibility […]
Yeah, if you set up your config as a git repo, your files need to be tracked by Git or they'll be ignored by Nix
When you run it like this: nix run nix-darwin -- switch --flake ~/.config/nix-darwin
you essentially run nix run nix-darwin -- switch --flake git+file:~/.config/nix-darwin
which will look for files tracked by git. To avoid this while in git repo you can explicitly tell it via nix run nix-darwin -- switch --flake path:~/.config/nix-darwin
where path:
will not consider anything related to that git repo.
See this https://nix.dev/manual/nix/2.18/command-ref/new-cli/nix3-flake#flake-references and this https://nix.dev/manual/nix/2.18/command-ref/new-cli/nix3-flake#flake-references
On macOS 14.4.1 (23E224), after installing Nix from the Determinate Nix installer and following the flake
nix-darwin
guide in the README I got the following error:This is resolved by committing
nix-darwin/flake.nix
.I'm new to Nix so apologies if I've misunderstood something, but given that it was pretty hard to search for this problem it might be helpful if anyone else encounters this.