diff options
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/elm')
-rw-r--r-- | nixpkgs/pkgs/development/compilers/elm/README.md | 24 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/compilers/elm/default.nix | 47 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/compilers/elm/fetchElmDeps.nix | 11 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/compilers/elm/makeDotElm.nix | 30 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/compilers/elm/packages/elm-format.nix | 36 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/compilers/elm/packages/elm-srcs.nix | 62 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/compilers/elm/packages/elm.nix | 31 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/compilers/elm/packages/indents.nix | 11 | ||||
-rwxr-xr-x | nixpkgs/pkgs/development/compilers/elm/update.sh | 8 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/compilers/elm/versions.dat | bin | 0 -> 94810 bytes |
10 files changed, 260 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/compilers/elm/README.md b/nixpkgs/pkgs/development/compilers/elm/README.md new file mode 100644 index 000000000000..f0254d0f9547 --- /dev/null +++ b/nixpkgs/pkgs/development/compilers/elm/README.md @@ -0,0 +1,24 @@ +# To update Elm: + +Modify revision in ./update.sh and run it + +# Notes about the build process: + +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. + +More: https://blog.hercules-ci.com/elm/2019/01/03/elm2nix-0.1/ diff --git a/nixpkgs/pkgs/development/compilers/elm/default.nix b/nixpkgs/pkgs/development/compilers/elm/default.nix new file mode 100644 index 000000000000..f14bce5d96b3 --- /dev/null +++ b/nixpkgs/pkgs/development/compilers/elm/default.nix @@ -0,0 +1,47 @@ +{ lib, stdenv, buildEnv +, haskell, nodejs +, fetchurl, fetchpatch, makeWrapper, git }: + +let + fetchElmDeps = import ./fetchElmDeps.nix { inherit stdenv lib fetchurl; }; + hsPkgs = haskell.packages.ghc864.override { + overrides = self: super: with haskell.lib; + let elmPkgs = { + elm = overrideCabal (self.callPackage ./packages/elm.nix { }) (drv: { + # sadly with parallelism most of the time breaks compilation + enableParallelBuilding = false; + preConfigure = self.fetchElmDeps { + elmPackages = (import ./packages/elm-srcs.nix); + versionsDat = ./versions.dat; + }; + patches = [ + (fetchpatch { + url = "https://github.com/elm/compiler/pull/1886/commits/39d86a735e28da514be185d4c3256142c37c2a8a.patch"; + sha256 = "0nni5qx1523rjz1ja42z6z9pijxvi3fgbw1dhq5qi11mh1nb9ay7"; + }) + ]; + buildTools = drv.buildTools or [] ++ [ makeWrapper ]; + jailbreak = true; + postInstall = '' + wrapProgram $out/bin/elm \ + --prefix PATH ':' ${lib.makeBinPath [ nodejs ]} + ''; + }); + + /* + The elm-format expression is updated via a script in the https://github.com/avh4/elm-format repo: + `pacakge/nix/build.sh` + */ + elm-format = justStaticExecutables (doJailbreak (self.callPackage ./packages/elm-format.nix {})); + + inherit fetchElmDeps; + elmVersion = elmPkgs.elm.version; + }; + in elmPkgs // { + inherit elmPkgs; + + # Needed for elm-format + indents = self.callPackage ./packages/indents.nix {}; + }; + }; +in hsPkgs.elmPkgs diff --git a/nixpkgs/pkgs/development/compilers/elm/fetchElmDeps.nix b/nixpkgs/pkgs/development/compilers/elm/fetchElmDeps.nix new file mode 100644 index 000000000000..3da2445e0c52 --- /dev/null +++ b/nixpkgs/pkgs/development/compilers/elm/fetchElmDeps.nix @@ -0,0 +1,11 @@ +{stdenv, lib, fetchurl}: + +{elmPackages, versionsDat}: + +let + makeDotElm = import ./makeDotElm.nix {inherit stdenv lib fetchurl versionsDat;}; + +in +'' + export ELM_HOME=`pwd`/.elm +'' + (makeDotElm "0.19.0" elmPackages) diff --git a/nixpkgs/pkgs/development/compilers/elm/makeDotElm.nix b/nixpkgs/pkgs/development/compilers/elm/makeDotElm.nix new file mode 100644 index 000000000000..1bc8e61d27ca --- /dev/null +++ b/nixpkgs/pkgs/development/compilers/elm/makeDotElm.nix @@ -0,0 +1,30 @@ +{stdenv, lib, fetchurl, versionsDat}: + +ver: deps: + let cmds = lib.mapAttrsToList (name: info: let + pkg = stdenv.mkDerivation { + name = lib.replaceChars ["/"] ["-"] name + "-${info.version}"; + + src = fetchurl { + url = "https://github.com/${name}/archive/${info.version}.tar.gz"; + meta.homepage = "https://github.com/${name}/"; + inherit (info) sha256; + }; + + phases = [ "unpackPhase" "installPhase" ]; + + installPhase = '' + mkdir -p $out + cp -r * $out + ''; + + }; + in '' + mkdir -p .elm/${ver}/package/${name} + cp -R ${pkg} .elm/${ver}/package/${name}/${info.version} + '') deps; + in (lib.concatStrings cmds) + '' + mkdir -p .elm/${ver}/package; + cp ${versionsDat} .elm/${ver}/package/versions.dat; + chmod -R +w .elm + '' diff --git a/nixpkgs/pkgs/development/compilers/elm/packages/elm-format.nix b/nixpkgs/pkgs/development/compilers/elm/packages/elm-format.nix new file mode 100644 index 000000000000..d773736bba56 --- /dev/null +++ b/nixpkgs/pkgs/development/compilers/elm/packages/elm-format.nix @@ -0,0 +1,36 @@ +{ mkDerivation, fetchgit, ansi-terminal, ansi-wl-pprint, base, binary +, bytestring, Cabal, cmark, containers, directory, filepath, free +, HUnit, indents, json, mtl, optparse-applicative, parsec, process +, QuickCheck, quickcheck-io, split, stdenv, tasty, tasty-golden +, tasty-hunit, tasty-quickcheck, text +}: +mkDerivation { + pname = "elm-format"; + version = "0.8.1"; + src = fetchgit { + url = "http://github.com/avh4/elm-format"; + sha256 = "0p1dy1m6illsl7i04zsv5jqw7i4znv7pfpdfm53zy0k7mq0fk09j"; + rev = "89694e858664329e3cbdaeb71b15c4456fd739ff"; + }; + postPatch = '' + sed -i "s|desc <-.*||" ./Setup.hs + sed -i "s|gitDescribe = .*|gitDescribe = \\\\\"0.8.1\\\\\"\"|" ./Setup.hs + ''; + isLibrary = true; + isExecutable = true; + setupHaskellDepends = [ base Cabal directory filepath process ]; + libraryHaskellDepends = [ + ansi-terminal ansi-wl-pprint base binary bytestring containers + directory filepath free indents json mtl optparse-applicative + parsec process split text + ]; + executableHaskellDepends = [ base ]; + testHaskellDepends = [ + base cmark containers HUnit mtl parsec QuickCheck quickcheck-io + split tasty tasty-golden tasty-hunit tasty-quickcheck text + ]; + doHaddock = false; + homepage = "http://elm-lang.org"; + description = "A source code formatter for Elm"; + license = stdenv.lib.licenses.bsd3; +} diff --git a/nixpkgs/pkgs/development/compilers/elm/packages/elm-srcs.nix b/nixpkgs/pkgs/development/compilers/elm/packages/elm-srcs.nix new file mode 100644 index 000000000000..e1f941626dd7 --- /dev/null +++ b/nixpkgs/pkgs/development/compilers/elm/packages/elm-srcs.nix @@ -0,0 +1,62 @@ +{ + + "elm-explorations/markdown" = { + sha256 = "0k3110ixa4wwf3vkkdplagwah9ypr965qxr1y147rnsc1xsxmr6y"; + version = "1.0.0"; + }; + + "elm/json" = { + sha256 = "1g0hafkqf2q633r7ir9wxpb1lnlzskhpsyi0h5bkzj0gl072zfnb"; + version = "1.0.0"; + }; + + "elm/html" = { + sha256 = "1n3gpzmpqqdsldys4ipgyl1zacn0kbpc3g4v3hdpiyfjlgh8bf3k"; + version = "1.0.0"; + }; + + "elm/svg" = { + sha256 = "08x0v8p9wm699jjmsnbq69pxv3jh60j4f6fg7y6hyr7xxj85y390"; + version = "1.0.0"; + }; + + "elm/project-metadata-utils" = { + sha256 = "1d4rd4grrnbdvj9gf00h7dr6hbkjzawgkzpizfrkp1z1pyr3mvq9"; + version = "1.0.0"; + }; + + "elm/browser" = { + sha256 = "1apmvyax93nvmagwj00y16zx10kfv640cxpi64xgqbgy7d2wphy4"; + version = "1.0.0"; + }; + + "elm/core" = { + sha256 = "10kr86h4v5h4p0586q406a5wbl8xvr1jyrf6097zp2wb8sv21ylw"; + version = "1.0.0"; + }; + + "elm/http" = { + sha256 = "1igmm89ialzrjib1j8xagkxalq1x2gj4l0hfxcd66mpwmvg7psl8"; + version = "1.0.0"; + }; + + "elm/parser" = { + sha256 = "0k4zlq30lrvawqvzwbvsl0hrmwf9s832mb41z7fdspm4549dj7wc"; + version = "1.0.0"; + }; + + "elm/url" = { + sha256 = "0av8x5syid40sgpl5vd7pry2rq0q4pga28b4yykn9gd9v12rs3l4"; + version = "1.0.0"; + }; + + "elm/time" = { + sha256 = "0vch7i86vn0x8b850w1p69vplll1bnbkp8s383z7pinyg94cm2z1"; + version = "1.0.0"; + }; + + "elm/virtual-dom" = { + sha256 = "0hm8g92h7z39km325dlnhk8n00nlyjkqp3r3jppr37k2k13md6aq"; + version = "1.0.0"; + }; +} diff --git a/nixpkgs/pkgs/development/compilers/elm/packages/elm.nix b/nixpkgs/pkgs/development/compilers/elm/packages/elm.nix new file mode 100644 index 000000000000..67e63ea2b8e8 --- /dev/null +++ b/nixpkgs/pkgs/development/compilers/elm/packages/elm.nix @@ -0,0 +1,31 @@ +{ mkDerivation, ansi-terminal, ansi-wl-pprint, base, binary +, bytestring, containers, directory, edit-distance, fetchgit +, file-embed, filepath, ghc-prim, haskeline, HTTP, http-client +, http-client-tls, http-types, language-glsl, logict, mtl, network +, parsec, process, raw-strings-qq, scientific, SHA, snap-core +, snap-server, stdenv, template-haskell, text, time +, unordered-containers, utf8-string, vector, zip-archive +}: +mkDerivation { + pname = "elm"; + version = "0.19.0"; + src = fetchgit { + url = "https://github.com/elm/compiler"; + sha256 = "13jks6c6i80z71mjjfg46ri570g5ini0k3xw3857v6z66zcl56x4"; + rev = "d5cbc41aac23da463236bbc250933d037da4055a"; + fetchSubmodules = true; + }; + isLibrary = false; + isExecutable = true; + executableHaskellDepends = [ + ansi-terminal ansi-wl-pprint base binary bytestring containers + directory edit-distance file-embed filepath ghc-prim haskeline HTTP + http-client http-client-tls http-types language-glsl logict mtl + network parsec process raw-strings-qq scientific SHA snap-core + snap-server template-haskell text time unordered-containers + utf8-string vector zip-archive + ]; + homepage = "http://elm-lang.org"; + description = "The `elm` command line interface"; + license = stdenv.lib.licenses.bsd3; +} diff --git a/nixpkgs/pkgs/development/compilers/elm/packages/indents.nix b/nixpkgs/pkgs/development/compilers/elm/packages/indents.nix new file mode 100644 index 000000000000..6bf7fa7890e8 --- /dev/null +++ b/nixpkgs/pkgs/development/compilers/elm/packages/indents.nix @@ -0,0 +1,11 @@ +{ mkDerivation, base, concatenative, mtl, parsec, stdenv }: +mkDerivation { + pname = "indents"; + version = "0.3.3"; + sha256 = "b61f51ac894609cb5571cc3ded12db5de97185a8de236c69ec24c87457109f9a"; + libraryHaskellDepends = [ base concatenative mtl parsec ]; + doCheck = false; + homepage = "http://patch-tag.com/r/salazar/indents"; + description = "indentation sensitive parser-combinators for parsec"; + license = stdenv.lib.licenses.bsd3; +} diff --git a/nixpkgs/pkgs/development/compilers/elm/update.sh b/nixpkgs/pkgs/development/compilers/elm/update.sh new file mode 100755 index 000000000000..920b95e5ad95 --- /dev/null +++ b/nixpkgs/pkgs/development/compilers/elm/update.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env nix-shell +#!nix-shell -p cabal2nix elm2nix -i bash ../../.. + +cabal2nix https://github.com/elm/compiler --revision d5cbc41aac23da463236bbc250933d037da4055a > packages/elm.nix +elm2nix snapshot > versions.dat +pushd "$(nix-build -A elmPackages.elm.src --no-out-link ../../../..)/ui/browser" + elm2nix convert > $OLDPWD/packages/elm-srcs.nix +popd diff --git a/nixpkgs/pkgs/development/compilers/elm/versions.dat b/nixpkgs/pkgs/development/compilers/elm/versions.dat new file mode 100644 index 000000000000..9dcfd8a2808f --- /dev/null +++ b/nixpkgs/pkgs/development/compilers/elm/versions.dat Binary files differ |