frontend: fix nix build

This commit is contained in:
Cadey Ratio 2020-11-04 17:29:47 -05:00
parent bc67d8eb11
commit 4fbaac8d3e
2 changed files with 34 additions and 15 deletions

View File

@ -1,8 +1,8 @@
{ nixpkgs ? <nixpkgs> { sources ? import ../nix/sources.nix
, config ? {} , pkgs ? import sources.nixpkgs {}
}: }:
with (import nixpkgs config); with pkgs;
let let
mkDerivation = mkDerivation =
@ -17,8 +17,7 @@ let
stdenv.mkDerivation { stdenv.mkDerivation {
inherit name src; inherit name src;
buildInputs = [ elmPackages.elm ] buildInputs = [ elmPackages.elm ];
++ lib.optional outputJavaScript nodePackages_10_x.uglify-js;
buildPhase = pkgs.elmPackages.fetchElmDeps { buildPhase = pkgs.elmPackages.fetchElmDeps {
elmPackages = import srcs; elmPackages = import srcs;
@ -34,11 +33,6 @@ let
${lib.concatStrings (map (module: '' ${lib.concatStrings (map (module: ''
echo "compiling ${elmfile module}" echo "compiling ${elmfile module}"
elm make ${elmfile module} --output $out/${module}.${extension} --docs $out/share/doc/${module}.json elm make ${elmfile module} --output $out/${module}.${extension} --docs $out/share/doc/${module}.json
${lib.optionalString outputJavaScript ''
echo "minifying ${elmfile module}"
uglifyjs $out/${module}.${extension} --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters,keep_fargs=false,unsafe_comps,unsafe' \
| uglifyjs --mangle --output=$out/${module}.min.${extension}
''}
'') targets)} '') targets)}
''; '';
}; };

View File

@ -1,5 +1,10 @@
{ {
"elm/json" = {
sha256 = "0kjwrz195z84kwywaxhhlnpl3p251qlbm5iz6byd6jky2crmyqyh";
version = "1.1.3";
};
"elm/html" = { "elm/html" = {
sha256 = "1n3gpzmpqqdsldys4ipgyl1zacn0kbpc3g4v3hdpiyfjlgh8bf3k"; sha256 = "1n3gpzmpqqdsldys4ipgyl1zacn0kbpc3g4v3hdpiyfjlgh8bf3k";
version = "1.0.0"; version = "1.0.0";
@ -15,21 +20,41 @@
version = "1.0.5"; version = "1.0.5";
}; };
"elm/json" = {
sha256 = "0kjwrz195z84kwywaxhhlnpl3p251qlbm5iz6byd6jky2crmyqyh";
version = "1.1.3";
};
"elm/url" = { "elm/url" = {
sha256 = "0av8x5syid40sgpl5vd7pry2rq0q4pga28b4yykn9gd9v12rs3l4"; sha256 = "0av8x5syid40sgpl5vd7pry2rq0q4pga28b4yykn9gd9v12rs3l4";
version = "1.0.0"; version = "1.0.0";
}; };
"elm/http" = {
sha256 = "008bs76mnp48b4dw8qwjj4fyvzbxvlrl4xpa2qh1gg2kfwyw56v1";
version = "2.0.0";
};
"elm/time" = { "elm/time" = {
sha256 = "0vch7i86vn0x8b850w1p69vplll1bnbkp8s383z7pinyg94cm2z1"; sha256 = "0vch7i86vn0x8b850w1p69vplll1bnbkp8s383z7pinyg94cm2z1";
version = "1.0.0"; version = "1.0.0";
}; };
"rtfeldman/elm-iso8601-date-strings" = {
sha256 = "1fa5sslklldy0dq8bm0zdkb9ni50yxhb09xb6lgk00x55bmza9ik";
version = "1.1.3";
};
"elm/bytes" = {
sha256 = "02ywbf52akvxclpxwj9n04jydajcbsbcbsnjs53yjc5lwck3abwj";
version = "1.0.8";
};
"elm/file" = {
sha256 = "1rljcb41dl97myidyjih2yliyzddkr2m7n74x7gg46rcw4jl0ny8";
version = "1.0.5";
};
"elm/parser" = {
sha256 = "0a3cxrvbm7mwg9ykynhp7vjid58zsw03r63qxipxp3z09qks7512";
version = "1.1.0";
};
"elm/virtual-dom" = { "elm/virtual-dom" = {
sha256 = "0q1v5gi4g336bzz1lgwpn5b1639lrn63d8y6k6pimcyismp2i1yg"; sha256 = "0q1v5gi4g336bzz1lgwpn5b1639lrn63d8y6k6pimcyismp2i1yg";
version = "1.0.2"; version = "1.0.2";