summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--com/simatime/buildHaskellApp.nix78
-rw-r--r--default.nix66
2 files changed, 70 insertions, 74 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";
+ };
}
diff --git a/default.nix b/default.nix
index ceb0d12..c5bfabd 100644
--- a/default.nix
+++ b/default.nix
@@ -74,39 +74,37 @@ in {
security.sudo.wheelNeedsPassword = true;
boot.cleanTmpDir = true;
};
- } // {
- ibb = buildHaskellApp {
- name = "Com.Influencedbybooks";
- nick = "ibb";
- apex = "Com.Influencedbybooks.Apex";
- aero = "Com.Influencedbybooks.Aero";
- deps = {
- both = [
- "clay"
- "miso"
- "protolude"
- "servant"
- "text"
- ];
- apex = [
- "MonadRandom"
- "acid-state"
- "blaze-html"
- "blaze-markup"
- "bytestring"
- "ixset"
- "random"
- "safecopy"
- "scotty"
- "servant-server"
- "text"
- ];
- aero = [
- "aeson"
- "containers"
- "ghcjs-base"
- ];
- };
+ } // (buildHaskellApp {
+ name = "Com.Influencedbybooks";
+ nick = "ibb";
+ apex = "Com.Influencedbybooks.Apex";
+ aero = "Com.Influencedbybooks.Aero";
+ deps = {
+ both = [
+ "clay"
+ "miso"
+ "protolude"
+ "servant"
+ "text"
+ ];
+ apex = [
+ "MonadRandom"
+ "acid-state"
+ "blaze-html"
+ "blaze-markup"
+ "bytestring"
+ "ixset"
+ "random"
+ "safecopy"
+ "scotty"
+ "servant-server"
+ "text"
+ ];
+ aero = [
+ "aeson"
+ "containers"
+ "ghcjs-base"
+ ];
};
- };
+ });
}