-
Notifications
You must be signed in to change notification settings - Fork 461
/
purescript.nix
49 lines (46 loc) · 1.14 KB
/
purescript.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
{ stdenv
, nodejs
, easyPS
, nix-gitignore
}:
{
# path to generated purescript sources
psSrc
# path to project sources
, src
# name of the project
, name
# packages as generated by psc-pacakge2nix
, packages
# spago packages as generated by spago2nix
, spagoPackages
# web-common project
, webCommon
# node_modules to use
, nodeModules
# control execution of unit tests
, checkPhase
}:
let
# Cleans the source based on the patterns in ./.gitignore and the additionalIgnores
cleanSrcs = nix-gitignore.gitignoreSource [ "/*.adoc" "/*.nix" ] src;
in
stdenv.mkDerivation {
inherit name checkPhase;
src = cleanSrcs;
buildInputs = [ nodeModules easyPS.purs easyPS.spago easyPS.psc-package ];
buildPhase = ''
export HOME=$NIX_BUILD_TOP
shopt -s globstar
ln -s ${nodeModules}/node_modules node_modules
ln -s ${psSrc} generated
ln -s ${webCommon} ../web-common
sh ${spagoPackages.installSpagoStyle}
sh ${spagoPackages.buildSpagoStyle} src/**/*.purs test/**/*.purs generated/**/*.purs ../web-common/**/*.purs
${nodejs}/bin/npm run webpack
'';
doCheck = true;
installPhase = ''
mv dist $out
'';
}