default.nix

blankhart 2018-03-08 02:15:30.348824 UTC

1{ pkgs ? import <nixpkgs> {} }:
2let
3
4 inherit (pkgs) runCommand closurecompiler;
5
6 ghcjsEnv = pkgs.haskell.packages.ghcjsHEAD.override {
7 overrides = self: super: {
8 miso = self.callPackage _nix/miso-ghcjs.nix {};
9 remic-client = self.callCabal2nix "remic-client" ./client {};
10 remic-shared = self.callCabal2nix "remic-shared" ./shared {};
11 };
12 };
13
14 ghcEnv = pkgs.haskell.packages.ghc802.override {
15 overrides = self: super: {
16 miso = self.callPackage _nix/miso-ghc.nix {};
17 remic-shared = self.callCabal2nix "remic-shared" ./shared {};
18 remic-server = self.callCabal2nix "remic-server" ./server {};
19 };
20 };
21
22 client = ghcjsEnv.remic-client;
23 server = ghcEnv.remic-server;
24
25in runCommand "remic-project" { inherit client server; } ''
26 mkdir -p $out/{bin,static}
27 ln -s ${./client}/assets/* $out/static/
28 ${closurecompiler}/bin/closure-compiler ${client}/bin/remic-client.jsexe/all.js > $out/static/all.js
29 cp ${server}/bin/* $out/bin
30 ''