-
Notifications
You must be signed in to change notification settings - Fork 3
/
default.nix
33 lines (33 loc) · 1.32 KB
/
default.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
{ sources ? import ./nix/sources.nix { }
, ghc ? "ghc8107"
}:
let
haskellNix = import sources.haskellNix { };
pkgs = import haskellNix.sources.nixpkgs-unstable haskellNix.nixpkgsArgs;
hsPkgs = import ./base.nix { inherit pkgs ghc; };
frugel-cross = { platform }: hsPkgs.projectCross.${platform}.hsPkgs.frugel.components.exes.frugel-exe;
in
{
frugel-web = pkgs.stdenv.mkDerivation {
name = "frugel-web";
src = pkgs.haskell-nix.haskellLib.cleanGit {
name = "frugel";
src = ./.;
subDir = "www";
};
buildInputs = [ pkgs.closurecompiler ];
installPhase = ''
mkdir -p $out
find . \( -name '*.html' -o -name '*.css' \) -exec cp {} $out \;
FRUGEL_WEB=${frugel-cross { platform = "ghcjs"; }}/bin/frugel-exe.jsexe
closure-compiler \
$FRUGEL_WEB/all.js --externs $FRUGEL_WEB/all.js.externs \
-O ADVANCED --jscomp_off=checkVars -W QUIET \
--js_output_file $out/all.min.js
'';
};
frugel-static = frugel-cross { platform = "musl64"; };
frugel-exe = hsPkgs.frugel.components.exes.frugel-exe;
# frugel-aarch64-darwin = frugel-cross { platform = "aarch64-darwin"; }; Not working due to https://github.com/NixOS/nixpkgs/issues/49526
# frugel-mingwW64 = frugel-cross { platform = "mingwW64"; }; Not working due to https://github.com/NixOS/nixpkgs/issues/36200
}