i have a system flake project checked in git.
if i have files not staged in git, it will complain it can’t find them until i do.
now my question is: can i circumvent that restriction?
the use-case for this i thought up is, having a nix file containing enable toggles excluded from git. as such, potentially git bisect operations could be sped up a little by temporarily disabling some features the user deems not relevant to the bisect.
it feels like i’m trying stuff you’re not supposed to want so far , and i kinda had trouble finding documentation on potential ways to get around this.
@Infinisil i feel i’m sorta missing context on usage here. where might one perhaps invoke this in a basic system flake?
i see your blog post mention mkDerivation, so i imagine that’s about the level this would function at, but iiuc that appears somewhat abstracted away by the nixpkgs.lib.nixosSystem commonly used to do system flakes.
Ah yeah you didn’t mention the context, so I wasn’t sure if it would help. lib.fileset is good for filtering local sources of derivations. So indeed, because that doesn’t exist for a NixOS system, it’s not generally useful there.
You could build nix yourself with this patch included.
Be aware though, you might end up accidentally importing big files into your store (like if you have a .qcow2 image from a VM run lingering around in your source dir).
hm, looks like the mentioned open PR does not pertain to files in .gitignore, unfortunately.
it looks like @TLATER’s advice seems to help. i’ll try and figure out how to use that using relative file paths as well.
this default approach unfortunately fails for files not staged in git, so it looks like you’d need to either use workarounds or trick nix into not considering it a git repo somehow