lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Matt McHenry and committed by
Domen Kožar
9f9e9d64 db11c832

+77 -10
+27 -10
pkgs/development/compilers/elm/default.nix
··· 6 6 # 3) Run ./elm2nix.rb in elm-reactor's directory. 7 7 # 4) Move the resulting 'package.nix' to 'packages/elm-reactor-elm.nix'. 8 8 9 + # the elm binary embeds a piece of pre-compiled elm code, used by 'elm 10 + # reactor'. this means that the build process for 'elm' effectively 11 + # executes 'elm make'. that in turn expects to retrieve the elm 12 + # dependencies of that code (elm/core, etc.) from 13 + # package.elm-lang.org, as well as a cached bit of metadata 14 + # (versions.dat). 15 + 16 + # the makeDotElm function lets us retrieve these dependencies in the 17 + # standard nix way. we have to copy them in (rather than symlink) and 18 + # make them writable because the elm compiler writes other .dat files 19 + # alongside the source code. versions.dat was produced during an 20 + # impure build of this same code; the build complains that it can't 21 + # update this cache, but continues past that warning. 22 + 23 + # finally, we set ELM_HOME to point to these pre-fetched artifacts so 24 + # that the default of ~/.elm isn't used. 25 + 9 26 let 10 - makeElmStuff = deps: 11 - let json = builtins.toJSON (lib.mapAttrs (name: info: info.version) deps); 27 + makeDotElm = ver: deps: 28 + let versionsDat = ./versions.dat; 12 29 cmds = lib.mapAttrsToList (name: info: let 13 30 pkg = stdenv.mkDerivation { 14 31 ··· 29 46 30 47 }; 31 48 in '' 32 - mkdir -p elm-stuff/packages/${name} 33 - ln -s ${pkg} elm-stuff/packages/${name}/${info.version} 49 + mkdir -p .elm/${ver}/package/${name} 50 + cp -R ${pkg} .elm/${ver}/package/${name}/${info.version} 51 + chmod -R +w .elm/${ver}/package/${name}/${info.version} 34 52 '') deps; 35 53 in '' 36 - export HOME=/tmp 37 - mkdir elm-stuff 38 - cat > elm-stuff/exact-dependencies.json <<EOF 39 - ${json} 40 - EOF 54 + mkdir -p .elm/${ver}/package; 55 + ln -s ${versionsDat} .elm/${ver}/package/versions.dat; 41 56 '' + lib.concatStrings cmds; 42 57 43 58 hsPkgs = haskell.packages.ghc822.override { ··· 45 60 let hlib = haskell.lib; 46 61 elmPkgs = { 47 62 elm = hlib.overrideCabal (self.callPackage ./packages/elm.nix { }) { 48 - preConfigure = "export HOME=`pwd`"; 63 + preConfigure = '' 64 + export ELM_HOME=`pwd`/.elm 65 + '' + (makeDotElm "0.19.0" (import ./packages/elm-elm.nix)); 49 66 }; 50 67 51 68 /*
+50
pkgs/development/compilers/elm/packages/elm-elm.nix
··· 1 + { 2 + "elm/time" = { 3 + version = "1.0.0"; 4 + sha256 = "0vch7i86vn0x8b850w1p69vplll1bnbkp8s383z7pinyg94cm2z1"; 5 + }; 6 + "elm/url" = { 7 + version = "1.0.0"; 8 + sha256 = "0av8x5syid40sgpl5vd7pry2rq0q4pga28b4yykn9gd9v12rs3l4"; 9 + }; 10 + "elm/json" = { 11 + version = "1.0.0"; 12 + sha256 = "1g0hafkqf2q633r7ir9wxpb1lnlzskhpsyi0h5bkzj0gl072zfnb"; 13 + }; 14 + "elm/html" = { 15 + version = "1.0.0"; 16 + sha256 = "1n3gpzmpqqdsldys4ipgyl1zacn0kbpc3g4v3hdpiyfjlgh8bf3k"; 17 + }; 18 + "elm/parser" = { 19 + version = "1.0.0"; 20 + sha256 = "0k4zlq30lrvawqvzwbvsl0hrmwf9s832mb41z7fdspm4549dj7wc"; 21 + }; 22 + "elm/http" = { 23 + version = "1.0.0"; 24 + sha256 = "1igmm89ialzrjib1j8xagkxalq1x2gj4l0hfxcd66mpwmvg7psl8"; 25 + }; 26 + "elm/virtual-dom" = { 27 + version = "1.0.0"; 28 + sha256 = "0hm8g92h7z39km325dlnhk8n00nlyjkqp3r3jppr37k2k13md6aq"; 29 + }; 30 + "elm/browser" = { 31 + version = "1.0.0"; 32 + sha256 = "1apmvyax93nvmagwj00y16zx10kfv640cxpi64xgqbgy7d2wphy4"; 33 + }; 34 + "elm/core" = { 35 + version = "1.0.0"; 36 + sha256 = "10kr86h4v5h4p0586q406a5wbl8xvr1jyrf6097zp2wb8sv21ylw"; 37 + }; 38 + "elm/svg" = { 39 + version = "1.0.0"; 40 + sha256 = "08x0v8p9wm699jjmsnbq69pxv3jh60j4f6fg7y6hyr7xxj85y390"; 41 + }; 42 + "elm/project-metadata-utils" = { 43 + version = "1.0.0"; 44 + sha256 = "1d4rd4grrnbdvj9gf00h7dr6hbkjzawgkzpizfrkp1z1pyr3mvq9"; 45 + }; 46 + "elm-explorations/markdown" = { 47 + version = "1.0.0"; 48 + sha256 = "0k3110ixa4wwf3vkkdplagwah9ypr965qxr1y147rnsc1xsxmr6y"; 49 + }; 50 + }
pkgs/development/compilers/elm/versions.dat

This is a binary file and will not be displayed.