about summary refs log tree commit diff
path: root/website/habit-screens/default.nix
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/habit-screens/default.nix
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/habit-screens/default.nix')
-rw-r--r--website/habit-screens/default.nix30
1 files changed, 19 insertions, 11 deletions
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;
 }