I’ve been doing the “hardcore” rout for a while now as I’ve been testing out non-Git VCSs & I haven’t found it too painful (and in early, experimenting parts of a repositiory having to make git track the file is more annoying sinhe it’s easy to accidentally commit a file). I’m happy to see more awareness about filter tho, as I’ve made a lot of expensive mistakes using a whole repo.
Note If you use the experimental new nix CLI with Flakes and Git in a current (2.18.1) version of Nix, only files tracked by Git will be available to Nix, so this generally won’t be a problem.
How would I import a local file not tracked by Git in this case?
I’d like to have a generic home manager config and a private override on each machine (local file that is in gitignore).
Stop using Git, nix build in a non-Git directory allows access to all files (but also imports them all into the store, be careful)
Use nix build path:. instead, which also allows access to all files (and imports them all into the store), but this might not work with tooling and is annoying to type
Use stable Nix which doesn’t have any such limitations. Then you can also use union (gitTracked ./.) ./non/git/tracked to make a non-git-tracked file available to a derivation build. Though this would of course introduce impurities if you consider Git commits as your input.
Very happy with how this turned out, great work @infinisil!
I’ve been doing the “hardcore” rout for a while now as I’ve been testing out non-Git VCSs & I haven’t found it too painful (and in early, experimenting parts of a repositiory having to make git track the file is more annoying sinhe it’s easy to accidentally commit a file). I’m happy to see more awareness about filter tho, as I’ve made a lot of expensive mistakes using a whole repo.
How would I import a local file not tracked by Git in this case? I’d like to have a generic home manager config and a private override on each machine (local file that is in gitignore).
Either:
nix buildin a non-Git directory allows access to all files (but also imports them all into the store, be careful)nix build path:.instead, which also allows access to all files (and imports them all into the store), but this might not work with tooling and is annoying to typeunion (gitTracked ./.) ./non/git/trackedto make a non-git-tracked file available to a derivation build. Though this would of course introduce impurities if you consider Git commits as your input.