diff options
Diffstat (limited to 'picarones-elm/default.nix')
-rw-r--r-- | picarones-elm/default.nix | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/picarones-elm/default.nix b/picarones-elm/default.nix index ed71959..b5e9d9d 100644 --- a/picarones-elm/default.nix +++ b/picarones-elm/default.nix @@ -1,9 +1,10 @@ -{ nixpkgs ? <nixpkgs> -, config ? {} +{ stdenv +, elmPackages +, lib +, baseurl ? "example.org" +, serverurl ? "wss://example.org" }: -with (import nixpkgs config); - let mkDerivation = { srcs ? ./elm-srcs.nix @@ -13,13 +14,15 @@ let , targets ? [] , registryDat ? ./registry.dat , outputJavaScript ? true + , patchPhase ? "" + , ... }: stdenv.mkDerivation { - inherit name src; + inherit name src patchPhase; buildInputs = [ elmPackages.elm ]; - buildPhase = pkgs.elmPackages.fetchElmDeps { + buildPhase = elmPackages.fetchElmDeps { elmPackages = import srcs; elmVersion = "0.19.1"; inherit registryDat; @@ -32,7 +35,7 @@ let mkdir -p $out/share/doc ${lib.concatStrings (map (module: '' echo "compiling ${elmfile module}" - elm make ${elmfile module} --output $out/${module}.${extension} + elm make ${elmfile module} --optimize --output $out/${module}.${extension} '') targets)} cp *.html $out cp *.css $out @@ -41,7 +44,12 @@ let }; in mkDerivation { name = "picarones"; - + + patchPhase = '' + substituteInPlace index.html --replace "{{ baseurl }}" ${lib.escapeShellArg baseurl} + substituteInPlace slide.html --replace "{{ serverurl }}" ${lib.escapeShellArg serverurl} + ''; + srcs = ./elm-srcs.nix; src = ./.; targets = ["Main" "Cover"]; |