-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.nix
More file actions
65 lines (61 loc) · 1.86 KB
/
default.nix
File metadata and controls
65 lines (61 loc) · 1.86 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
let pkgs = import
( fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/25cf937a30bf0801447f6bf544fc7486c6309234.tar.gz";
sha256 = "16incdl8chihc1aw7i18mhv8k848iv7ib4wyn5qn485241c19z82";
}) { };
reflex-platform = import (pkgs.fetchFromGitHub {
owner = "reflex-frp";
repo = "reflex-platform";
rev = "v1.2.0.0";
sha256 = "E9Gkx0KPCvlMBQvim4F09zV/iEMg2hYh1ATcIUgXBCw=";
}) { };
deps = (pkgs: with pkgs; [
reflex-dom
split
hashtables
ieee
pretty-simple
Decimal
extra
monadlist
file-embed
utf8-string
regex-tdfa
]);
ghc = reflex-platform.ghc.ghcWithPackages deps;
ghcjs = reflex-platform.ghcjs.ghcWithPackages deps;
closure-compiler = pkgs.closure-compiler;
ghcjsFor = execName : pkgs.stdenv.mkDerivation {
name = "money-split";
buildInputs = [ghcjs pkgs.closurecompiler];
src = ./.;
phases = [ "unpackPhase" "buildPhase" "installPhase" "postInstall" ];
unpackPhase = ''
cp $src/*.hs $src/automerge.js $src/split.css $src/publish_report.sh $src/website.json .'';
buildPhase = ''
ghcjs ${execName}.hs
'';
installPhase = ''
mkdir $out/
cp -r ${execName}.jsexe $out/
pushd $out/${execName}.jsexe
closure-compiler -W QUIET --js all.js --js_output_file all.min.js
popd
cp publish_report.sh website.json $out/
cp automerge.js $out/${execName}.jsexe/
'';
postInstall = "cp $src/html/* $out/${execName}.jsexe/";
};
in {
ghc = pkgs.stdenv.mkDerivation {
name = "money-split";
buildInputs = [ghc];
src = ./.;
};
# nix-shell -A ghcjs ./default.nix
# ghcjs split.hs automerge.js
ghcjs = ghcjsFor "split";
ghcjsOysters202408 = ghcjsFor "oysters202408";
ghcjs202408oyestersAndCrouton = ghcjsFor "202408oyestersAndCrouton";
ghcjs2024coimbra = ghcjsFor "2024coimbra";
}