-
Notifications
You must be signed in to change notification settings - Fork 1
/
spago-packages.nix
130 lines (111 loc) · 3.88 KB
/
spago-packages.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
# This file was generated by Spago2Nix
{ pkgs ? import <nixpkgs> {} }:
let
inputs = {
"console" = pkgs.stdenv.mkDerivation {
name = "console";
version = "v6.1.0";
src = pkgs.fetchgit {
url = "https://github.com/purescript/purescript-console.git";
rev = "dc9854023e3392399f5eea9f5db965dbfe2cfe11";
sha256 = "0br5i4kzya2gwvlakbqzy4ivav9fpp61ipfpch45jnhqqfgfdhmd";
};
phases = "installPhase";
installPhase = "ln -s $src $out";
};
"effect" = pkgs.stdenv.mkDerivation {
name = "effect";
version = "v4.0.0";
src = pkgs.fetchgit {
url = "https://github.com/purescript/purescript-effect.git";
rev = "a192ddb923027d426d6ea3d8deb030c9aa7c7dda";
sha256 = "0aa10lc6h9mlf4xf3g3ziig7v6kxdqvbh20kma8ay59w0b1bhmj1";
};
phases = "installPhase";
installPhase = "ln -s $src $out";
};
"prelude" = pkgs.stdenv.mkDerivation {
name = "prelude";
version = "v6.0.1";
src = pkgs.fetchgit {
url = "https://github.com/purescript/purescript-prelude.git";
rev = "f4cad0ae8106185c9ab407f43cf9abf05c256af4";
sha256 = "0j6mb9w728ifcp10jdv7l9k7k5pw8j1f0fa7xyb8xmbxzc59xqpy";
};
phases = "installPhase";
installPhase = "ln -s $src $out";
};
"type-equality" = pkgs.stdenv.mkDerivation {
name = "type-equality";
version = "v4.0.1";
src = pkgs.fetchgit {
url = "https://github.com/purescript/purescript-type-equality.git";
rev = "0525b7d39e0fbd81b4209518139fb8ab02695774";
sha256 = "1ass38jdycsjisdimdc4drg2w8vkkwp6lkvz3kvy7q0h98vdmlbr";
};
phases = "installPhase";
installPhase = "ln -s $src $out";
};
"typelevel-prelude" = pkgs.stdenv.mkDerivation {
name = "typelevel-prelude";
version = "v7.0.0";
src = pkgs.fetchgit {
url = "https://github.com/purescript/purescript-typelevel-prelude.git";
rev = "dca2fe3c8cfd5527d4fe70c4bedfda30148405bf";
sha256 = "0x86mrg33kpnrnsfp4p3c92j5lpyqzy87bxdynwf7smk3inqr2jc";
};
phases = "installPhase";
installPhase = "ln -s $src $out";
};
};
cpPackage = pkg:
let
target = ".spago/${pkg.name}/${pkg.version}";
in ''
if [ ! -e ${target} ]; then
echo "Installing ${target}."
mkdir -p ${target}
cp --no-preserve=mode,ownership,timestamp -r ${toString pkg.outPath}/* ${target}
else
echo "${target} already exists. Skipping."
fi
'';
getGlob = pkg: ''".spago/${pkg.name}/${pkg.version}/src/**/*.purs"'';
getStoreGlob = pkg: ''"${pkg.outPath}/src/**/*.purs"'';
in {
inherit inputs;
installSpagoStyle = pkgs.writeShellScriptBin "install-spago-style" ''
set -e
echo installing dependencies...
${builtins.toString (builtins.map cpPackage (builtins.attrValues inputs))}
echo "echo done."
'';
buildSpagoStyle = pkgs.writeShellScriptBin "build-spago-style" ''
set -e
echo building project...
purs compile ${builtins.toString (builtins.map getGlob (builtins.attrValues inputs))} "$@"
echo done.
'';
buildFromNixStore = pkgs.writeShellScriptBin "build-from-store" ''
set -e
echo building project using sources from nix store...
purs compile ${builtins.toString (
builtins.map getStoreGlob (builtins.attrValues inputs))} "$@"
echo done.
'';
mkBuildProjectOutput =
{ src, purs }:
pkgs.stdenv.mkDerivation {
name = "build-project-output";
src = src;
buildInputs = [ purs ];
installPhase = ''
mkdir -p $out
purs compile "$src/**/*.purs" ${builtins.toString
(builtins.map
(x: ''"${x.outPath}/src/**/*.purs"'')
(builtins.attrValues inputs))}
mv output $out
'';
};
}