From 2a23630595335b9a6916b7746fa7cc85b857e1a3 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Fri, 22 Dec 2023 10:27:26 -0600 Subject: [PATCH] nix: Use file sets for what goes in the Nix store --- flake.nix | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 2fc4e4f..ebc3734 100644 --- a/flake.nix +++ b/flake.nix @@ -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;