elm: 0.18 -> 0.19
update makeElmStuff to makeDotElm, create elm-elm.nix listing the elm code that elm itself embeds, and pre-fetch it so that the elm build can function offline. also include a versions.dat file, as created during an impure build of elm. set ELM_HOME so that the elm build can find these things. continues #45448 (cherry picked from commit e7d0df84676d51fb0cbfbeb10dd32153489c3565) Signed-off-by: Domen Kožar <domen@dev.si>
This commit is contained in:
parent
db11c832fb
commit
9f9e9d6433
@ -6,9 +6,26 @@
|
||||
# 3) Run ./elm2nix.rb in elm-reactor's directory.
|
||||
# 4) Move the resulting 'package.nix' to 'packages/elm-reactor-elm.nix'.
|
||||
|
||||
# the elm binary embeds a piece of pre-compiled elm code, used by 'elm
|
||||
# reactor'. this means that the build process for 'elm' effectively
|
||||
# executes 'elm make'. that in turn expects to retrieve the elm
|
||||
# dependencies of that code (elm/core, etc.) from
|
||||
# package.elm-lang.org, as well as a cached bit of metadata
|
||||
# (versions.dat).
|
||||
|
||||
# the makeDotElm function lets us retrieve these dependencies in the
|
||||
# standard nix way. we have to copy them in (rather than symlink) and
|
||||
# make them writable because the elm compiler writes other .dat files
|
||||
# alongside the source code. versions.dat was produced during an
|
||||
# impure build of this same code; the build complains that it can't
|
||||
# update this cache, but continues past that warning.
|
||||
|
||||
# finally, we set ELM_HOME to point to these pre-fetched artifacts so
|
||||
# that the default of ~/.elm isn't used.
|
||||
|
||||
let
|
||||
makeElmStuff = deps:
|
||||
let json = builtins.toJSON (lib.mapAttrs (name: info: info.version) deps);
|
||||
makeDotElm = ver: deps:
|
||||
let versionsDat = ./versions.dat;
|
||||
cmds = lib.mapAttrsToList (name: info: let
|
||||
pkg = stdenv.mkDerivation {
|
||||
|
||||
@ -29,15 +46,13 @@ let
|
||||
|
||||
};
|
||||
in ''
|
||||
mkdir -p elm-stuff/packages/${name}
|
||||
ln -s ${pkg} elm-stuff/packages/${name}/${info.version}
|
||||
mkdir -p .elm/${ver}/package/${name}
|
||||
cp -R ${pkg} .elm/${ver}/package/${name}/${info.version}
|
||||
chmod -R +w .elm/${ver}/package/${name}/${info.version}
|
||||
'') deps;
|
||||
in ''
|
||||
export HOME=/tmp
|
||||
mkdir elm-stuff
|
||||
cat > elm-stuff/exact-dependencies.json <<EOF
|
||||
${json}
|
||||
EOF
|
||||
mkdir -p .elm/${ver}/package;
|
||||
ln -s ${versionsDat} .elm/${ver}/package/versions.dat;
|
||||
'' + lib.concatStrings cmds;
|
||||
|
||||
hsPkgs = haskell.packages.ghc822.override {
|
||||
@ -45,7 +60,9 @@ let
|
||||
let hlib = haskell.lib;
|
||||
elmPkgs = {
|
||||
elm = hlib.overrideCabal (self.callPackage ./packages/elm.nix { }) {
|
||||
preConfigure = "export HOME=`pwd`";
|
||||
preConfigure = ''
|
||||
export ELM_HOME=`pwd`/.elm
|
||||
'' + (makeDotElm "0.19.0" (import ./packages/elm-elm.nix));
|
||||
};
|
||||
|
||||
/*
|
||||
|
50
pkgs/development/compilers/elm/packages/elm-elm.nix
Normal file
50
pkgs/development/compilers/elm/packages/elm-elm.nix
Normal file
@ -0,0 +1,50 @@
|
||||
{
|
||||
"elm/time" = {
|
||||
version = "1.0.0";
|
||||
sha256 = "0vch7i86vn0x8b850w1p69vplll1bnbkp8s383z7pinyg94cm2z1";
|
||||
};
|
||||
"elm/url" = {
|
||||
version = "1.0.0";
|
||||
sha256 = "0av8x5syid40sgpl5vd7pry2rq0q4pga28b4yykn9gd9v12rs3l4";
|
||||
};
|
||||
"elm/json" = {
|
||||
version = "1.0.0";
|
||||
sha256 = "1g0hafkqf2q633r7ir9wxpb1lnlzskhpsyi0h5bkzj0gl072zfnb";
|
||||
};
|
||||
"elm/html" = {
|
||||
version = "1.0.0";
|
||||
sha256 = "1n3gpzmpqqdsldys4ipgyl1zacn0kbpc3g4v3hdpiyfjlgh8bf3k";
|
||||
};
|
||||
"elm/parser" = {
|
||||
version = "1.0.0";
|
||||
sha256 = "0k4zlq30lrvawqvzwbvsl0hrmwf9s832mb41z7fdspm4549dj7wc";
|
||||
};
|
||||
"elm/http" = {
|
||||
version = "1.0.0";
|
||||
sha256 = "1igmm89ialzrjib1j8xagkxalq1x2gj4l0hfxcd66mpwmvg7psl8";
|
||||
};
|
||||
"elm/virtual-dom" = {
|
||||
version = "1.0.0";
|
||||
sha256 = "0hm8g92h7z39km325dlnhk8n00nlyjkqp3r3jppr37k2k13md6aq";
|
||||
};
|
||||
"elm/browser" = {
|
||||
version = "1.0.0";
|
||||
sha256 = "1apmvyax93nvmagwj00y16zx10kfv640cxpi64xgqbgy7d2wphy4";
|
||||
};
|
||||
"elm/core" = {
|
||||
version = "1.0.0";
|
||||
sha256 = "10kr86h4v5h4p0586q406a5wbl8xvr1jyrf6097zp2wb8sv21ylw";
|
||||
};
|
||||
"elm/svg" = {
|
||||
version = "1.0.0";
|
||||
sha256 = "08x0v8p9wm699jjmsnbq69pxv3jh60j4f6fg7y6hyr7xxj85y390";
|
||||
};
|
||||
"elm/project-metadata-utils" = {
|
||||
version = "1.0.0";
|
||||
sha256 = "1d4rd4grrnbdvj9gf00h7dr6hbkjzawgkzpizfrkp1z1pyr3mvq9";
|
||||
};
|
||||
"elm-explorations/markdown" = {
|
||||
version = "1.0.0";
|
||||
sha256 = "0k3110ixa4wwf3vkkdplagwah9ypr965qxr1y147rnsc1xsxmr6y";
|
||||
};
|
||||
}
|
BIN
pkgs/development/compilers/elm/versions.dat
Normal file
BIN
pkgs/development/compilers/elm/versions.dat
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user