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.
This commit is contained in:
William Carroll 2020-12-13 13:33:49 +00:00
parent e3c72f3fd6
commit 6b9eae2fa3
2 changed files with 20 additions and 12 deletions

View file

@ -8,6 +8,6 @@ pkgs.stdenv.mkDerivation {
cp $src/index.html $out cp $src/index.html $out
mkdir -p $out/habits mkdir -p $out/habits
cp ${briefcase.website.habits} $out/habits/index.html cp ${briefcase.website.habit-screens} $out/habits/index.html
''; '';
} }

View file

@ -1,8 +1,6 @@
{ nixpkgs ? <nixpkgs> { pkgs ? <nixpkgs> , ... }:
, config ? {}
}:
with (import nixpkgs config); with pkgs;
let let
mkDerivation = mkDerivation =
@ -42,12 +40,22 @@ let
'') targets)} '') targets)}
''; '';
}; };
in mkDerivation { mainDotElm = mkDerivation {
name = "elm-app-0.1.0"; name = "elm-app-0.1.0";
srcs = ./elm-srcs.nix; srcs = ./elm-srcs.nix;
src = ./.; src = ./.;
targets = ["Main"]; targets = ["Main"];
srcdir = "./src"; srcdir = "./src";
outputJavaScript = false; 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;
} }