Skip to content

Commit

Permalink
nix: filter monocle source to avoid rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanCacqueray committed Oct 4, 2023
1 parent d613ccf commit af198b3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 0 additions & 1 deletion monocle.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ maintainer: Monocle authors <[email protected]>
copyright: 2021,2022,2023 Monocle authors
category: Development
build-type: Simple
extra-doc-files: README.md
tested-with: GHC == 9.2.5
extra-source-files: schemas/monocle/config/**/*.dhall,
schemas/github/schema.docs.graphql,
Expand Down
13 changes: 12 additions & 1 deletion nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,20 @@ let
else
throw "Refusing to build from a dirty Git tree!";

src = pkgs.lib.cleanSourceWith {
src = self; # The original, unfiltered source
filter = path: type:
type == "directory" || (pkgs.lib.hasSuffix ".cabal" path)
|| (pkgs.lib.hasSuffix ".hs" path) || (pkgs.lib.hasSuffix ".dhall" path)
|| (pkgs.lib.hasSuffix ".json" path) || (pkgs.lib.hasSuffix ".yaml" path)
|| (pkgs.lib.hasSuffix "LICENSE" path)
|| (pkgs.lib.hasSuffix ".graphql" path);

};

# Add monocle and patch broken dependency to the haskell package set
haskellExtend = hpFinal: hpPrev: {
monocle = hpPrev.callCabal2nix "monocle" self { };
monocle = hpPrev.callCabal2nix "monocle" src { };

# upgrade to bloodhound 0.20 needs some work
bloodhound = pkgs.haskell.lib.overrideCabal hpPrev.bloodhound {
Expand Down

0 comments on commit af198b3

Please sign in to comment.