mirror of
https://github.com/ilyakooo0/haskell.nix.git
synced 2024-11-10 06:47:48 +03:00
Add subDir argument to cleanGit (#280)
Co-Authored-By: Viktor Kronvall <viktor.kronvall@gmail.com>
This commit is contained in:
parent
e920ddf698
commit
23e0c2fcea
@ -108,7 +108,16 @@ If your project has a `cabal.project` you can add a `default.nix` like this:
|
||||
Note: The `cleanGit` call will exclude any files not in the index file
|
||||
in the local `.git` directory. This is extremely useful as it avoids
|
||||
unwanted builds (for instance when the contents of `dist-newstyle` are
|
||||
modified by cabal).
|
||||
modified by cabal). It is important that `src` is the root directory
|
||||
of the repo (so `cleanGit` can find the `.git` directory). If the project
|
||||
is not at the root of the repo, then also pass `subDir` to `cleanGit` with the
|
||||
location of the project relative to `src` as a string. For example:
|
||||
|
||||
```
|
||||
src = pkgs.haskell-nix.haskellLib.cleanGit
|
||||
{ src = ./.; subDir = "subdir/another-subdir"; };
|
||||
```
|
||||
|
||||
|
||||
You can build a component from your project with `nix-build` (in this
|
||||
case the `hello` executable in a `helloworld` package):
|
||||
|
@ -1,6 +1,6 @@
|
||||
# From https://github.com/NixOS/nix/issues/2944
|
||||
{ lib, runCommand, git, cleanSourceWith }:
|
||||
{ src }:
|
||||
{ src, subDir ? "" }:
|
||||
|
||||
# The function call
|
||||
#
|
||||
@ -90,12 +90,12 @@ then
|
||||
filter = filter_from_list src whitelist;
|
||||
in
|
||||
cleanSourceWith {
|
||||
inherit src filter;
|
||||
inherit src subDir filter;
|
||||
}
|
||||
|
||||
else
|
||||
trace "gitSource.nix: ${toString src} does not seem to be a git repository,\nassuming it is a clean checkout." (
|
||||
cleanSourceWith {
|
||||
inherit src;
|
||||
inherit src subDir;
|
||||
}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user