summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Com/InfluencedByBooks/Client.hs (renamed from Com/InfluencedByBooks/Aero.hs)2
-rw-r--r--Com/InfluencedByBooks/Server.hs (renamed from Com/InfluencedByBooks/Apex.hs)2
-rw-r--r--Com/MusicMeetsComics/Client.hs (renamed from Com/MusicMeetsComics/Aero.hs)2
-rw-r--r--Com/MusicMeetsComics/Server.hs (renamed from Com/MusicMeetsComics/Apex.hs)2
-rw-r--r--Com/Simatime/buildGhc.nix54
-rw-r--r--Com/Simatime/buildGhcjs.nix64
-rw-r--r--Com/Simatime/buildHaskellApp.nix90
-rw-r--r--README.md2
-rw-r--r--default.nix55
-rwxr-xr-xghci2
10 files changed, 161 insertions, 114 deletions
diff --git a/Com/InfluencedByBooks/Aero.hs b/Com/InfluencedByBooks/Client.hs
index bd996c6..cf45511 100644
--- a/Com/InfluencedByBooks/Aero.hs
+++ b/Com/InfluencedByBooks/Client.hs
@@ -3,7 +3,7 @@
{-# LANGUAGE NoImplicitPrelude #-}
-- | Front-end
-module Com.InfluencedByBooks.Aero where
+module Com.InfluencedByBooks.Client where
import Com.InfluencedByBooks.Core (Action(..), see, init)
import Com.InfluencedByBooks.Move (move)
diff --git a/Com/InfluencedByBooks/Apex.hs b/Com/InfluencedByBooks/Server.hs
index 0328a6d..dae17ef 100644
--- a/Com/InfluencedByBooks/Apex.hs
+++ b/Com/InfluencedByBooks/Server.hs
@@ -8,7 +8,7 @@
{-# LANGUAGE TypeOperators #-}
-- | Server
-module Com.InfluencedByBooks.Apex where
+module Com.InfluencedByBooks.Server where
import qualified Clay
import Com.InfluencedByBooks.Core
diff --git a/Com/MusicMeetsComics/Aero.hs b/Com/MusicMeetsComics/Client.hs
index 26d8aaf..2dad3b7 100644
--- a/Com/MusicMeetsComics/Aero.hs
+++ b/Com/MusicMeetsComics/Client.hs
@@ -1,7 +1,7 @@
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE NoImplicitPrelude #-}
-module Com.MusicMeetsComics.Aero where
+module Com.MusicMeetsComics.Client where
import Com.MusicMeetsComics.App ( Action(..)
, Comic(..)
diff --git a/Com/MusicMeetsComics/Apex.hs b/Com/MusicMeetsComics/Server.hs
index f652f68..7bb94a2 100644
--- a/Com/MusicMeetsComics/Apex.hs
+++ b/Com/MusicMeetsComics/Server.hs
@@ -9,7 +9,7 @@
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE NoImplicitPrelude #-}
-module Com.MusicMeetsComics.Apex where
+module Com.MusicMeetsComics.Server where
import qualified Clay
import Com.MusicMeetsComics.App
diff --git a/Com/Simatime/buildGhc.nix b/Com/Simatime/buildGhc.nix
new file mode 100644
index 0000000..489651e
--- /dev/null
+++ b/Com/Simatime/buildGhc.nix
@@ -0,0 +1,54 @@
+
+nixpkgs:
+
+{ name # the main module namespace
+, nick # a short name, for the executable
+, deps # deps get passed to ghc
+}:
+
+with nixpkgs;
+
+let
+ nsToPath = ns: builtins.toString (builtins.replaceStrings ["."] ["/"] ns);
+
+ path = nsToPath name;
+
+ depsToPackageSet = packageSet: deps:
+ map (s: builtins.getAttr s packageSet) deps;
+
+ claySrc = pkgs.fetchFromGitHub {
+ owner = "sebastiaanvisser";
+ repo = "clay";
+ rev = "cc7729b1b42a79e261091ff7835f7fc2a7ae3cee";
+ sha256 = "1vd67976lvi5l4qq18zy6j44apynkl44ps04p8vwfx4gzr895dyp";
+ };
+
+ ghc865_ = pkgs.haskell.packages.ghc865.override (oldAttrs: {
+ overrides = with pkgs.haskell.lib; self: super: {
+ clay = self.callCabal2nix "clay" claySrc {};
+ wai-middleware-metrics = dontCheck super.wai-middleware-metrics;
+ };
+ });
+
+ ghc = ghc865_.ghcWithPackages (hp: depsToPackageSet hp deps);
+
+in stdenv.mkDerivation {
+ name = name;
+ version = "0";
+ src = ../../.; # this is the git root
+ nativeBuildInputs = [ ghc ];
+ strictDeps = true;
+ buildPhase = ''
+ #
+ mkdir -p $out/{bin,static} ${path}
+ #
+ # compile with ghc
+ #
+ ${ghc}/bin/ghc -Werror -i. \
+ --make ${path}.hs \
+ -main-is ${name} \
+ -o $out/bin/${nick}
+ '';
+ # the install process was handled above
+ installPhase = "exit 0";
+} // { env = ghc; }
diff --git a/Com/Simatime/buildGhcjs.nix b/Com/Simatime/buildGhcjs.nix
new file mode 100644
index 0000000..0a88ce7
--- /dev/null
+++ b/Com/Simatime/buildGhcjs.nix
@@ -0,0 +1,64 @@
+
+nixpkgs:
+
+{ name # the main module namespace
+, nick # a short name for the output
+, deps # passed to ghcjs
+}:
+
+with nixpkgs;
+
+let
+ nsToPath = ns: builtins.toString (builtins.replaceStrings ["."] ["/"] ns);
+
+ path = nsToPath name;
+
+ depsToPackageSet = packageSet: deps:
+ map (s: builtins.getAttr s packageSet) deps;
+
+ claySrc = pkgs.fetchFromGitHub {
+ owner = "sebastiaanvisser";
+ repo = "clay";
+ rev = "cc7729b1b42a79e261091ff7835f7fc2a7ae3cee";
+ sha256 = "1vd67976lvi5l4qq18zy6j44apynkl44ps04p8vwfx4gzr895dyp";
+ };
+
+ # ghcjs-8.6.0.1
+ ghcjs_ = pkgs.haskell.packages.ghcjs.override (oldAttrs: {
+ overrides = with pkgs.haskell.lib; self: super: {
+ clay = dontCheck (self.callCabal2nix "clay" claySrc {});
+ http-types = dontCheck super.http-types;
+ tasty-quickcheck = dontCheck super.tasty-quickcheck;
+ scientific = dontCheck super.scientific; # takes forever
+ servant = dontCheck super.servant;
+ comonad = dontCheck super.comonad;
+ QuickCheck = dontCheck super.QuickCheck;
+ };
+ });
+
+ ghcjs = ghcjs_.ghcWithPackages (hp: depsToPackageSet hp deps);
+
+in stdenv.mkDerivation {
+ name = name;
+ version = "0";
+ src = ../../.; # the git root
+ nativeBuildInputs = [ ghcjs ];
+ strictDeps = true;
+ buildPhase = ''
+ #
+ mkdir -p $out/{bin,static} ${path}
+ #
+ # compile with ghcjs
+ #
+ ${ghcjs}/bin/ghcjs -Werror -i. \
+ --make ${path}.hs \
+ -main-is ${name} \
+ -o ${path}
+ #
+ # optimize js output
+ #
+ ${pkgs.closurecompiler}/bin/closure-compiler \
+ ${path}.jsexe/all.js > $out/static/${nick}.js
+ '';
+ installPhase = "exit 0";
+} // { env = ghcjs; }
diff --git a/Com/Simatime/buildHaskellApp.nix b/Com/Simatime/buildHaskellApp.nix
deleted file mode 100644
index c7bdd1f..0000000
--- a/Com/Simatime/buildHaskellApp.nix
+++ /dev/null
@@ -1,90 +0,0 @@
-
-nixpkgs:
-
-{ name # the namespace
-, nick # a short name, for the executable
-, deps # deps get passed to the compilers
-}:
-
-with nixpkgs;
-
-let
- nsToPath = ns: builtins.toString (builtins.replaceStrings ["."] ["/"] ns);
- pathToNs = p: builtins.replaceStrings ["/"] ["."] p;
- basePath = nsToPath name;
- apexPath = basePath + "/Apex"; # compiled with ghc
- aeroPath = basePath + "/Aero"; # compiled with ghcjs
-
- depsToPackageSet = packageSet: deps:
- map (s: builtins.getAttr s packageSet) deps;
-
- claySrc = pkgs.fetchFromGitHub {
- owner = "sebastiaanvisser";
- repo = "clay";
- rev = "cc7729b1b42a79e261091ff7835f7fc2a7ae3cee";
- sha256 = "1vd67976lvi5l4qq18zy6j44apynkl44ps04p8vwfx4gzr895dyp";
- };
-
- ghc865_ = pkgs.haskell.packages.ghc865.override (oldAttrs: {
- overrides = with pkgs.haskell.lib; self: super: {
- clay = self.callCabal2nix "clay" claySrc {};
- wai-middleware-metrics = dontCheck super.wai-middleware-metrics;
- };
- });
-
- ghc = ghc865_.ghcWithPackages (hp: depsToPackageSet hp
- (deps.both ++ deps.apex));
-
- # ghcjs-8.6.0.1
- ghcjs_ = pkgs.haskell.packages.ghcjs.override (oldAttrs: {
- overrides = with pkgs.haskell.lib; self: super: {
- clay = dontCheck (self.callCabal2nix "clay" claySrc {});
- http-types = dontCheck super.http-types;
- tasty-quickcheck = dontCheck super.tasty-quickcheck;
- scientific = dontCheck super.scientific; # takes forever
- servant = dontCheck super.servant;
- comonad = dontCheck super.comonad;
- QuickCheck = dontCheck super.QuickCheck;
- };
- });
-
- ghcjs = ghcjs_.ghcWithPackages (hp:
- depsToPackageSet hp (deps.both ++ deps.aero));
-
-in {
- inherit ghc ghcjs;
- app = stdenv.mkDerivation {
- name = name;
- version = "0";
- src = ../../.; # this is the git root
- nativeBuildInputs = [
- ghc ghcjs guile
- ];
- strictDeps = true;
- buildPhase = ''
- #
- mkdir -p $out/{bin,static} ${basePath}
- #
- # compile with ghc
- #
- ${ghc}/bin/ghc -Werror -i. \
- --make ${apexPath}.hs \
- -main-is ${pathToNs apexPath} \
- -o $out/bin/${nick}
- #
- # compile with ghcjs
- #
- ${ghcjs}/bin/ghcjs -Werror -i. \
- --make ${aeroPath}.hs \
- -main-is ${pathToNs aeroPath} \
- -o ${aeroPath}
- #
- # optimize js output
- #
- ${pkgs.closurecompiler}/bin/closure-compiler \
- ${aeroPath}.jsexe/all.js > $out/static/${nick}.js
- '';
- # the install process was handled above
- installPhase = "exit 0";
- };
-}
diff --git a/README.md b/README.md
index fc9d918..d8ced5b 100644
--- a/README.md
+++ b/README.md
@@ -72,7 +72,7 @@ To build code, do:
To get in the environment for a thing, use `nix run`. For example, if
you want `ghci` with packages for `ibb`, do this:
- nix run -f default.nix Com.InfluencedByBooks.ghc && ghci
+ nix run -f default.nix Com.InfluencedByBooks.Server.env && ghci
And to deploy:
diff --git a/default.nix b/default.nix
index a05d370..4d2fbd2 100644
--- a/default.nix
+++ b/default.nix
@@ -5,7 +5,8 @@ let
# TODO(bsima): buildNixOS should be split into multiple functions that each
# return one thing, instead of a single function that returns multiple things
buildOS = import ./Com/Simatime/buildOS.nix nixos;
- buildHaskellApp = import ./Com/Simatime/buildHaskellApp.nix nixpkgs;
+ buildGhc = import ./Com/Simatime/buildGhc.nix nixpkgs;
+ buildGhcjs = import ./Com/Simatime/buildGhcjs.nix nixpkgs;
nixos-mailserver = let ver = "v2.3.0"; in builtins.fetchTarball {
url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/${ver}/nixos-mailserver-${ver}.tar.gz";
sha256 = "0lpz08qviccvpfws2nm83n7m2r8add2wvfg9bljx9yxx8107r919";
@@ -69,18 +70,16 @@ in {
boot.isContainer = true;
networking.useDHCP = false;
};
- } // (buildHaskellApp {
- name = "Com.InfluencedByBooks";
- nick = "ibb";
- deps = {
- both = [
+ } // {
+ Server = buildGhc {
+ name = "Com.InfluencedByBooks.Server";
+ nick = "ibb";
+ deps = [
"clay"
"miso"
"protolude"
"servant"
"text"
- ];
- apex = [
"MonadRandom"
"acid-state"
"blaze-html"
@@ -93,18 +92,27 @@ in {
"servant-server"
"text"
];
- aero = [
+ };
+ Client = buildGhcjs {
+ name = "Com.InfluencedByBooks.Client";
+ nick = "ibb";
+ deps = [
+ "clay"
+ "miso"
+ "protolude"
+ "servant"
+ "text"
"aeson"
"containers"
"ghcjs-base"
];
};
- });
- Com.MusicMeetsComics = buildHaskellApp {
- name = "Com.MusicMeetsComics";
- nick = "mmc";
- deps = {
- both = [
+ };
+ Com.MusicMeetsComics = {
+ Server = buildGhc {
+ name = "Com.MusicMeetsComics.Server";
+ nick = "mmc";
+ deps = [
"aeson"
"clay"
"containers"
@@ -114,8 +122,6 @@ in {
"split"
"string-quote"
"text"
- ];
- apex = [
"dhall"
"ekg"
"fast-logger"
@@ -136,7 +142,20 @@ in {
"wai-middleware-metrics"
"warp"
];
- aero = [
+ };
+ Client = buildGhcjs {
+ name = "Com.MusicMeetsComics.Client";
+ nick = "mmc";
+ deps = [
+ "aeson"
+ "clay"
+ "containers"
+ "miso"
+ "protolude"
+ "servant"
+ "split"
+ "string-quote"
+ "text"
"ghcjs-base"
];
};
diff --git a/ghci b/ghci
index be1cd94..0797ce5 100755
--- a/ghci
+++ b/ghci
@@ -1,2 +1,2 @@
#!/usr/bin/env bash
-nix run -f default.nix "$@.ghc" -c ghci
+nix run -f default.nix "$@.env" -c ghci