about summary refs log tree commit diff
path: root/website
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-12-13T13·33+0000
committerWilliam Carroll <wpcarro@gmail.com>2020-12-13T13·33+0000
commit6b9eae2fa38038111802122625b4ef1e5eaaa1a2 (patch)
tree74152822ac85480d3006f254721b096a433ec213 /website
parente3c72f3fd6df5437df5b7d80f49a65e1dbadfce0 (diff)
Productionize habit-screens
At some point I should document or write a script for how I package Elm projects
with Nix to be deployed on my website. For now, I'm modeling everything after my
previous success LearnPianoChords.
Diffstat (limited to 'website')
-rw-r--r--website/default.nix2
-rw-r--r--website/habit-screens/default.nix30
2 files changed, 20 insertions, 12 deletions
diff --git a/website/default.nix b/website/default.nix
index 4fd85f260cad..514b60cec697 100644
--- a/website/default.nix
+++ b/website/default.nix
@@ -8,6 +8,6 @@ pkgs.stdenv.mkDerivation {
     cp $src/index.html $out
 
     mkdir -p $out/habits
-    cp ${briefcase.website.habits} $out/habits/index.html
+    cp ${briefcase.website.habit-screens} $out/habits/index.html
   '';
 }
diff --git a/website/habit-screens/default.nix b/website/habit-screens/default.nix
index 19fd1b37c2ed..c042dc8c8021 100644
--- a/website/habit-screens/default.nix
+++ b/website/habit-screens/default.nix
@@ -1,8 +1,6 @@
-{ nixpkgs ? <nixpkgs>
-, config ? {}
-}:
+{ pkgs ? <nixpkgs> , ... }:
 
-with (import nixpkgs config);
+with pkgs;
 
 let
   mkDerivation =
@@ -42,12 +40,22 @@ let
         '') targets)}
       '';
     };
-in mkDerivation {
-  name = "elm-app-0.1.0";
-  srcs = ./elm-srcs.nix;
-  src = ./.;
-  targets = ["Main"];
-  srcdir = "./src";
-  outputJavaScript = false;
+  mainDotElm = mkDerivation {
+    name = "elm-app-0.1.0";
+    srcs = ./elm-srcs.nix;
+    src = ./.;
+    targets = ["Main"];
+    srcdir = "./src";
+    outputJavaScript = true;
+  };
+in stdenv.mkDerivation {
+  name = "habit-screens";
+  buildInputs = [];
+  src = builtins.path { path = ./.; name = "habit-screens"; };
+  buildPhase = ''
+    mkdir -p $out
+    cp index.html output.css ${mainDotElm}/Main.min.js $out
+  '';
+  dontInstall = true;
 }