-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Overhaul flake ignore system #12291
Comments
For the record, I am willing to put effort into making this happen as long as such a PR wouldn't get rejected out of the gate, so I want to gather community and maintainer support and consensus before I waste everyone's time making a PR. |
Forcing
|
Ah! I didn't realize that was in the works. That would indeed completely negate the need for an ignore mechanism at all in my opinion. The only case I could think of would be to prevent you from somehow accidentally pulling a file you didn't mean to into the nix file, but I think that's a small enough edge case (with an easy enough prevention mechanism -- just don't include the file if you don't want it copied) that it wouldn't be worth the effort. Now back to the That being said, I still disagree with them. This kind of protection really only helps a small number of users--those who are not already familiar with version control software. For anyone who is even passingly familiar though we know very well that any files/changes that aren't committed won't be available in the remote. And especially for a project with as much technical overhead in the initial learning curve as nix has, that really feels like protecting a very small minority of people at the expense of the vast majority who might want to break out of the bubble occasionally. Additionally, this also means that there is different behavior for anyone who downloads a flake via git vs downloading the same flake via a zip of the repo contents, which seems undesirable, if I understand the motivation correctly. I think that the If we do go forwards with the
I also think that the rationale behind why having a git repo changes the behavior would be a good thing to have in the docs. Having this behavior felt really counter-intuitive to me until I finally understood that it was trying to keep consistency with running flakes directly from git urls. To conclude, I counter-propose the following:
Unless someone is using |
Is your feature request related to a problem?
Currently the way flakes handle ignored files (via a git repo) is confusing at best and actively detrimental at worst. I'm a brand new user to nixos, but I've been around computers for many years, and I'm finding the flake defaults to be very annoying to work with, and I know I'm not the only one.
My main issue is that I see no intuitive reason why the files copied over by
nixos-rebuild switch --flake
would be affected by the existence git repo. It is, as another user pointed out, "spooky action at a distance", which makes it really hard to reason about what is actually happening and why. This behavior is documented at least, so it's findable, but it's still confusing.Additionally it makes my personal use-case harder to achieve cleanly. I'd like to have one central source-of-truth config for all my system settings and installed packages, but still have a small local config file for some overrides (username, hostname, etc.). These overrides are extremely machine-specific and don't make sense (to me) to be committed in the repo. And I'm not the only one wanting to set things up this way. This user on the forum and the lovely individual who put up #6858 both are just as annoyed and confused by this as I am.
On the flip side, the git approach is also currently the only way to exclude files from being copied. So if someone has some secret file(s) they don't want included in the flake copy they currently have to make a git repo. This is also silly and confusing, and leads to issues like #9996.
Proposed solution
I propose using a clear and explicit hierarchy of
.ignore
files to control which files do and don't get included in the flake copy, and ditching thegit
integration entirely.What I would like to see is the following hierarchy:
.nixignore
in the same directory as the running flake, then its contents (and exclusively its contents) are used to control which files are copied over to the system copy..nixignore
, then it should check for a standard.ignore
file..nixignore
nor.ignore
is found, it should check for a.gitignore
Alternative solutions
An alternative solution is to go with the approach posed in #6858, but that still doesn't allow for having nix use files that are explicitly
.gitignore
d. It also doesn't allow for ignoring files without using a git repo.Additional context
N/A
Checklist
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: