Skip to content

Commit

Permalink
nix: Use file sets for what goes in the Nix store
Browse files Browse the repository at this point in the history
  • Loading branch information
paulsmith committed Dec 22, 2023
1 parent badd6ee commit 2a23630
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,29 @@
pkgs = nixpkgs.legacyPackages.${system};
inherit system;
});
fs = nixpkgs.lib.fileset;
in {
packages = forEachSystem ({ pkgs, system }:
let
pname = name;
version = "0.0.1"; # TODO(paulsmith): source from version.go
src = ./.;
sourceFiles = fs.difference
# include anything that matches these files inc. recursive directories
(fs.unions [
(fs.fileFilter (file: file.hasExt "go") ./.)
./_runtime
./banner.txt
./go.mod
./scaffold
./testdata
./vendor
])
# exclude these files
(fs.unions [ ./example ./docs ./tools ]);
src = fs.toSource {
root = ./.;
fileset = sourceFiles;
};
vendorHash = null;
subPackages = ".";
CGO_ENABLED = 0;
Expand Down

0 comments on commit 2a23630

Please sign in to comment.