-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
default.nix
32 lines (24 loc) · 903 Bytes
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
let nixpkgs = import ./nixpkgs.nix; in
let
inherit (nixpkgs) pkgs;
inherit (pkgs) haskellPackages lib;
blacklistDirs = [ ".git" "dist" "dist-newstyle" ];
whitelistExts = [ ".cabal" ".el" ".hs" ];
whitelistNames = [ "COPYING" "LICENSE" ];
filterSrc =
let
overrideSrc = drv: f:
let inherit (pkgs.haskell.lib) overrideCabal; in
overrideCabal drv (args: args // { src = f args.src; });
predicate = path: type:
let inherit (lib) any elem hasSuffix; in
let baseName = baseNameOf path; in
if type == "directory"
then !(elem baseName blacklistDirs)
else any (suf: hasSuffix suf baseName) whitelistExts
|| any (name: baseName == name) whitelistNames;
in
drv: overrideSrc drv (src: builtins.filterSource predicate src);
drv = filterSrc (haskellPackages.callPackage ./package.nix {});
in
drv