lib: add gitSource helper
This commit is contained in:
parent
c1752d101e
commit
cb0545832e
13
README.md
13
README.md
|
@ -181,6 +181,19 @@ pkgs.mkNginxServer {
|
|||
}
|
||||
```
|
||||
|
||||
### [`gitSource`](./lib/git-source)
|
||||
|
||||
for development package nix files, computes the source set of files tracked by git at the given root
|
||||
path
|
||||
|
||||
example:
|
||||
```nix
|
||||
stdenv.mkDerivation {
|
||||
# ...
|
||||
src = gitSource { root = ./.; };
|
||||
}
|
||||
```
|
||||
|
||||
## development
|
||||
|
||||
structure of this repo
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
(final: prev: {
|
||||
fetchFromSteam = prev.callPackage ./lib/fetchsteam {};
|
||||
|
||||
gitSource = prev.callPackage ./lib/git-source {};
|
||||
|
||||
ghidra_headless = prev.ghidra.override {
|
||||
openjdk17 = prev.openjdk17_headless;
|
||||
};
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
{ lib }: { root }:
|
||||
let
|
||||
fs = lib.fileset;
|
||||
sourceFiles = fs.difference
|
||||
(fs.gitTracked root)
|
||||
(fs.fileFilter (file: file.hasExt "nix") root);
|
||||
in
|
||||
fs.toSource { inherit root; fileset = sourceFiles; }
|
Loading…
Reference in New Issue