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

Allow forcing Nix to ignore Git/version control information inside a flake #5619

Open
lina-bh opened this issue Nov 21, 2021 · 1 comment
Open

Comments

@lina-bh
Copy link

lina-bh commented Nov 21, 2021

Is your feature request related to a problem? Please describe.
My problem is that before flakes I would add all of the NixOS modules that I wanted to sync, except for hardware-configuration.nix which I don't want to upload to GitHub or wherever, and configuration.nix which I use for scratch configuration that I don't want to synchronise. Flakes, using them how you would normally in /etc/nixos/flake.nix breaks this workflow, because it always considers a directory with a .git subdirectory a git repository and then won't copy files that aren't added to the git index to the store.

Describe the solution you'd like
A way to force Nix to ignore .git (or .hg, for that matter) when given a path: input, inside the flake file. I would think it would look something like this:

{ inputs.gitdir = { url = "path:/to/git/directory"; vcs = false; }; }

I think making it a command line option would be a poor idea, because you end up having to remember to specify them every single time.

Describe alternatives you've considered
Currently I use a trick to confuse Nix into not following into the git repository where I store my configuration by using two flake files. One simple one that exports modules in nixosModules, and another that specifies nixpkgs input and imports that flake, which I then hard link into /etc/nixos so Nix doesn't know it's inside a git repository.

Additional context
N/A? I think I could work on this myself, but I would have to bring myself up to speed on how the Nix source expects me to access the parsed information from the flake file.

@L-as
Copy link
Member

L-as commented Nov 21, 2021

I don't think this is really useful, because you're really doing this the entirely wrong way.

You want a flake for your modules which you can upload, then another per-machine flake. You can also use Git for both then. The per-machine flake would have the shared flake as a flake input.

@stale stale bot added the stale label Aug 12, 2022
@stale stale bot removed the stale label Dec 5, 2022
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

3 participants