-
Notifications
You must be signed in to change notification settings - Fork 148
Expand file tree
/
Copy pathdefault.nix
More file actions
87 lines (78 loc) · 2.94 KB
/
default.nix
File metadata and controls
87 lines (78 loc) · 2.94 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
{ sources ? import ./nix/sources.nix, compiler ? "ghc967" }:
let
gitignore = import sources."gitignore.nix" { };
inherit (gitignore) gitignoreFilterWith;
haskellPackageOverrides = pkgs: self: super: { };
elmFormatPackages = self: super:
with pkgs.haskell.lib;
let
inherit (pkgs) lib;
mkPkg = name: path: args:
overrideCabal (self.callCabal2nix name path args) (orig: {
src = lib.cleanSourceWith {
name = "source";
filter = fpath: ftype:
if builtins.elem fpath [
(toString ./generated/Build_elm_format.hs)
(toString ./generated)
] then
# Include certain gitignored files
true
else if path == ./. && builtins.elem fpath [
(toString ./avh4-lib)
(toString ./elm-format-lib)
(toString ./elm-format-test-lib)
(toString ./elm-format-markdown)
] then
# Exclude subprojects when building the top-level package
false
else
gitignoreFilterWith { basePath = path; } fpath ftype;
src = path;
};
});
in {
elm-format-build = mkPkg "elm-format-build" ./Shakefile { };
elm-format = mkPkg "elm-format" ./. { };
avh4-lib = mkPkg "avh4-lib" ./avh4-lib { };
elm-format-lib =
mkPkg "elm-format-lib" ./elm-format-lib { };
elm-format-test-lib =
mkPkg "elm-format-test-lib" ./elm-format-test-lib { };
elm-format-markdown =
mkPkg "elm-format-markdown" ./elm-format-markdown { };
};
pkgs = import sources.nixpkgs {
config = {
packageOverrides = pkgs: {
haskell = pkgs.haskell // {
packages = pkgs.haskell.packages // {
project = pkgs.haskell.packages."${compiler}".override {
overrides = haskellPackageOverrides pkgs;
};
};
};
};
};
};
mkHaskellPackages = p:
(p.haskell.packages.project.extend elmFormatPackages).extend (self: super:
with pkgs.haskell.lib; {
elm-format-static = justStaticExecutables super.elm-format;
});
# This is the haskell package set that includes elm-format and all its dependencies
haskellPackages = mkHaskellPackages pkgs;
# This is a haskell package set for the same ghc version that does not have our project package overries
# (Because our override aren't compatible with haskell-language-server, etc)
haskellTools = import ./nix/tools.nix { inherit sources compiler; };
in {
elm-format = haskellPackages.elm-format;
dist = {
native = (mkHaskellPackages pkgs.pkgsStatic).elm-format-static;
linux-x64 = (mkHaskellPackages pkgs.pkgsStatic).elm-format-static;
linux-aarch64 = (mkHaskellPackages
pkgs.pkgsCross.aarch64-multiplatform-musl.pkgsStatic).elm-format-static;
};
# Used by shell.nix
inherit pkgs haskellPackages haskellTools;
}