diff --git a/nix/hpkgs.nix b/nix/hpkgs.nix index 2b64da0..001bee7 100644 --- a/nix/hpkgs.nix +++ b/nix/hpkgs.nix @@ -1,13 +1,30 @@ { pkgs ? import ./pkgs.nix { } , }: +let + # Decision: use lib.fileset.toSource for fine grained source filtering. + # Alternatives considered: passing ../. directly (rebuilds on any nix/tooling + # change), cleanSource (still includes too much). fileset.unions makes the + # build inputs explicit so editing nix/, .github/, makefile, .hlint.yaml, + # etc. does not invalidate the haskell build cache. + src = pkgs.lib.fileset.toSource { + root = ../.; + fileset = pkgs.lib.fileset.unions [ + ../app + ../src + ../test + ../template.cabal + ../LICENSE + ../Readme.md + ../Changelog.md + ]; + }; +in # you can pin a specific ghc version with # pkgs.haskell.packages.ghc984 for example. # this allows you to create multiple compiler targets via nix. pkgs.haskellPackages.override { overrides = hnew: hold: { - # NB this is a bit silly because nix files are now considered for the build - # bigger projects should consider putting haskell stuff in a subfolder - template-project = hnew.callCabal2nix "template-project" ../. { }; + template-project = hnew.callCabal2nix "template-project" src { }; }; }