summaryrefslogtreecommitdiff
path: root/com/simatime/buildHaskellApp.nix
diff options
context:
space:
mode:
Diffstat (limited to 'com/simatime/buildHaskellApp.nix')
-rw-r--r--com/simatime/buildHaskellApp.nix78
1 files changed, 38 insertions, 40 deletions
diff --git a/com/simatime/buildHaskellApp.nix b/com/simatime/buildHaskellApp.nix
index e9edb0a..ff9c741 100644
--- a/com/simatime/buildHaskellApp.nix
+++ b/com/simatime/buildHaskellApp.nix
@@ -1,8 +1,3 @@
-/*
-
-A function for building a Haskell Miso app.
-
-*/
nixpkgs:
@@ -54,39 +49,42 @@ let
ghcjs = ghcjs_.ghcWithPackages (hp:
depsToPackageSet hp (deps.both ++ deps.aero));
-in stdenv.mkDerivation {
- name = name;
- version = "0";
- src = ../../.; # this is the git root
- nativeBuildInputs = [
- ghc ghcjs guile bash
- ];
- strictDeps = true;
- buildPhase = ''
- # capitalize paths for 'ghc --make'
- source .envrc
- guile -e '(com simatime caplinks)' -s ./com/simatime/caplinks.scm .
- #
- mkdir -p $out/{bin,static} ${basePath}
- #
- # compile with ghc
- #
- ${ghc}/bin/ghc -i. --make ${apexPath}.hs -main-is ${apex} \
- -o ${apexPath}
- #
- # compile with ghcjs
- #
- ${ghcjs}/bin/ghcjs -i. --make ${aeroPath}.hs -main-is ${aero} \
- -o ${aeroPath}
- #
- # optimize js output
- #
- ${pkgs.closurecompiler}/bin/closure-compiler \
- --compilation_level ADVANCED_OPTIMIZATIONS \
- --jscomp_off=checkVars \
- --externs=${aeroPath}.jsexe/all.js.externs \
- ${aeroPath}.jsexe/all.js > $out/static/${nick}.js
- '';
- # the install process was handled above
- installPhase = "exit 0";
+in {
+ env = ghc // ghcjs // guile;
+ app = stdenv.mkDerivation {
+ name = name;
+ version = "0";
+ src = ../../.; # this is the git root
+ nativeBuildInputs = [
+ ghc ghcjs guile
+ ];
+ strictDeps = true;
+ buildPhase = ''
+ # capitalize paths for 'ghc --make'
+ source .envrc
+ guile -e '(com simatime caplinks)' -s ./com/simatime/caplinks.scm .
+ #
+ mkdir -p $out/{bin,static} ${basePath}
+ #
+ # compile with ghc
+ #
+ ${ghc}/bin/ghc -i. --make ${apexPath}.hs -main-is ${apex} \
+ -o ${apexPath}
+ #
+ # compile with ghcjs
+ #
+ ${ghcjs}/bin/ghcjs -i. --make ${aeroPath}.hs -main-is ${aero} \
+ -o ${aeroPath}
+ #
+ # optimize js output
+ #
+ ${pkgs.closurecompiler}/bin/closure-compiler \
+ --compilation_level ADVANCED_OPTIMIZATIONS \
+ --jscomp_off=checkVars \
+ --externs=${aeroPath}.jsexe/all.js.externs \
+ ${aeroPath}.jsexe/all.js > $out/static/${nick}.js
+ '';
+ # the install process was handled above
+ installPhase = "exit 0";
+ };
}