Skip to content

Commit 304901e

Browse files
committed
feat(package): use explicit fileset for package src
This uses a fileset to restrict the amount of rebuilds that one has to perform. For example, if a test is changed, we do not want to rebuild the `nixos-cli` package, since that's wasteful. Using an explicit opt-in fileset for src works here because there are only a few files/directories required to compile the actual package, and they can be specified manually without much trouble.
1 parent c4a53f0 commit 304901e

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

nix/package.nix

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
lib,
33
buildGoModule,
4-
nix-gitignore,
54
installShellFiles,
65
stdenv,
76
scdoc,
@@ -11,7 +10,19 @@
1110
buildGoModule (finalAttrs: {
1211
pname = "nixos-cli";
1312
version = "0.15.0-dev";
14-
src = nix-gitignore.gitignoreSource [] ../.;
13+
14+
src = lib.fileset.toSource {
15+
root = ../.;
16+
fileset = lib.fileset.unions [
17+
../go.mod
18+
../go.sum
19+
../Makefile
20+
../main.go
21+
../cmd
22+
../doc
23+
../internal
24+
];
25+
};
1526

1627
vendorHash = "sha256-I04cLEXLTRbxxCBemj4J6JzrtDaUQS0TuZZ8Fa0EZBk=";
1728

0 commit comments

Comments
 (0)