Open Profpatsch opened 5 years ago
Because somebody asked on IRC, the workaround we use currently is as follows:
1) import the gitignore-filtered (pkgs.nix-gitignore.gitignoreSource
) source code into the nix store (fully, every time some code changes)
2) Run pkgs.callCabal2nix
on that imported code, so the generated cabal file that references ./.
is in the nix store, and ./. would be imported into the nix store, but it already is, so that import becomes a no-op.
In my
default.nix
, I have a derivation like this:I filter the src with the contents of the
.gitignore
file (which usesbuiltins.filterSource
under the hood), then I want to runcabal2nix
on the cabal file in the filtered source.Ideally, something like
cabal2nix --src $out file://$src > $out
would just work out of the box and generate a nix file in$out
.Instead, there’s two things one has to manually fix:
.git
to the store and copy it into the build environmentsrc
field, which is./.
, so I need to patch the generated source file. I suggest adding a--src
flag to specify it manually.