forked from purs-nix/purescript-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
168 lines (148 loc) · 5.76 KB
/
flake.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
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
{ inputs =
{ make-shell.url = "github:ursi/nix-make-shell/1";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:ursi/flake-utils/8";
};
outputs = { utils, ... }@inputs:
with builtins;
utils.apply-systems
{ inherit inputs;
systems = [ "x86_64-linux" "x86_64-darwin" ];
}
({ make-shell, pkgs, ... }:
let l = pkgs.lib; p = pkgs; in
rec
{ legacyPackages =
let
purescripts =
listToAttrs
(map
(file:
let
package-name =
l.pipe file
[ (l.removeSuffix ".nix")
(replaceStrings [ "." ] [ "_" ])
(a: "purescript-${a}")
];
in
l.nameValuePair
package-name
(import (./. + "/purescript/${file}") { inherit pkgs; })
)
(l.pipe ./purescript
[ readDir
(a: removeAttrs a [ "mkPursDerivation.nix" ])
attrNames
]
)
);
common =
with packages;
{ inherit psa pscid purescript-language-server purs-tidy purty; };
for-0_15 =
with packages;
{ pulp = pulp-16;
purescript = purescript-0_15;
zephyr = zephyr-0_5;
}
// common;
for-0_14 =
with packages;
{ pulp = pulp-15;
purescript = purescript-0_14;
zephyr = zephyr-0_4;
}
// common ;
for-0_13 =
with packages;
{ pulp = pulp-15;
purescript = purescript-0_13;
zephyr = zephyr-0_4;
}
// common;
packages =
rec
{ psa = import ./psa { inherit pkgs; };
pscid = import ./pscid { inherit pkgs; };
pulp = pulp-16;
pulp-16 = import ./pulp/16.0.0-0 { inherit pkgs; };
pulp-15 = import ./pulp/15.0.0 { inherit pkgs; };
purescript = purescript-0_15;
purescript-0_15 = purescripts.purescript-0_15_14;
purescript-0_14 = purescripts.purescript-0_14_9;
purescript-0_13 = purescripts.purescript-0_13_8;
purescript-language-server =
import ./purescript-language-server { inherit pkgs; };
purs-tidy = import ./purs-tidy { inherit pkgs; };
purty = import ./purty.nix { inherit pkgs; };
zephyr = zephyr-0_5;
zephyr-0_5 = import ./zephyr/0.5.nix { inherit pkgs; };
zephyr-0_4 = import ./zephyr/0.4.nix { inherit pkgs; };
}
// purescripts;
in
{ inherit for-0_15 for-0_14 for-0_13; }
// packages;
checks =
let
packages-for-version = version:
let name = "packages for version ${version}"; in
{ ${name} =
p.runCommand name
{ buildInputs =
attrValues
legacyPackages
."for-${replaceStrings [ "." ] [ "_" ] version}";
}
''
echo psa
psa --version
echo pscid
pscid --version
echo purescript-language-server
purescript-language-server --version
echo pulp
pulp --version
echo purs
purs --version
echo purs-tidy
purs-tidy --version
echo purty
purty version
echo zyphyr
zephyr --version
touch $out
'';
};
in
{ lint =
p.runCommand "lint" {}
''
${p.deadnix}/bin/deadnix -f \
$(find ${./flake.nix} ${./purescript}/* -name "*.nix")
touch $out
'';
"everything builds" =
p.runCommand "build-everything" {}
(l.concatMapStringsSep "\n"
(a: "echo ${a.outPath or ""}; touch $out")
(attrValues legacyPackages.for-0_15
++ attrValues legacyPackages.for-0_14
++ attrValues legacyPackages.for-0_13
++ attrValues legacyPackages
)
);
}
// packages-for-version "0.15"
// packages-for-version "0.14"
// packages-for-version "0.13";
devShells.default =
make-shell
{ packages = [ p.deadnix ] ++ [ legacyPackages.purescript-language-server ];
aliases.lint = ''deadnix flake.nix purescript/*'';
};
}
)
// { herculesCI.ciSystems = [ "x86_64-linux" ]; };
}