git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #9233 from abbradar/elm

elm: add the platform and helpful scripts

commit42ea0d3341e00f03743fd80c910bda7d84cb2709 authorNikolay Amiantov <ab@fmap.me> dateMon 17 Aug 2015, 22:31 (11 years ago) parent48f49a743cba71
14 files changed+332−3
doc/package-notes.xml+20 nixos/doc/manual/release-notes/rl-unstable.xml+3 pkgs/development/compilers/elm/default.nix+81 pkgs/development/compilers/elm/elm2nix.rb+26 pkgs/development/compilers/elm/packages/elm-compiler.nix+37 pkgs/development/compilers/elm/packages/elm-make.nix+25 pkgs/development/compilers/elm/packages/elm-package.nix+27 pkgs/development/compilers/elm/packages/elm-reactor-elm.nix+18 pkgs/development/compilers/elm/packages/elm-reactor.nix+27 pkgs/development/compilers/elm/packages/elm-repl.nix+30 pkgs/development/compilers/elm/packages/release.nix+11 pkgs/development/compilers/elm/update-elm.rb+25 pkgs/development/haskell-modules/configuration-common.nix−3 pkgs/top-level/all-packages.nix+2
doc/package-notes.xml+20
@@ -346,4 +346,24 @@ packageOverrides = pkgs: {
346346
347347</section>
348348
349+<section xml:id="sec-elm">
350+
351+<title>Elm</title>
352+
353+<para>
354+The Nix expressions for Elm reside in
355+<filename>pkgs/development/compilers/elm</filename>. They are generated
356+automatically by <command>update-elm.rb</command> script. One should
357+specify versions of Elm packages inside the script, clear the
358+<filename>packages</filename> directory and run the script from inside it.
359+<literal>elm-reactor</literal> is special because it also has Elm package
360+dependencies. The process is not automated very much for now -- you should
361+get the <literal>elm-reactor</literal> source tree (e.g. with
362+<command>nix-shell</command>) and run <command>elm2nix.rb</command> inside
363+it. Place the resulting <filename>package.nix</filename> file into
364+<filename>packages/elm-reactor-elm.nix</filename>.
365+</para>
366+
367+</section>
368+
349369</chapter>
nixos/doc/manual/release-notes/rl-unstable.xml+3
@@ -80,6 +80,9 @@ was accordingly renamed to <literal>bomi</literal>
8080was accordingly renamed to <literal>electron</literal>
8181</para></listitem>
8282
83+<listitem><para>Elm is not released on Hackage anymore. You should now use <literal>elmPackages.elm</literal>
84+which contains the latest Elm platform.</para></listitem>
85+
8386<listitem>
8487 <para>
8588 The CUPS printing service has been updated to version <literal>2.0.2</literal>.
pkgs/development/compilers/elm/default.nixnew file+81
@@ -0,0 +1,81 @@
1+{ lib, stdenv, buildEnv, haskell, nodejs, fetchurl, fetchpatch, makeWrapper }:
2+
3+let
4+ makeElmStuff = deps:
5+ let json = builtins.toJSON (lib.mapAttrs (name: info: info.version) deps);
6+ cmds = lib.mapAttrsToList (name: info: let
7+ pkg = stdenv.mkDerivation {
8+
9+ name = lib.replaceChars ["/"] ["-"] name + "-${info.version}";
10+
11+ src = fetchurl {
12+ url = "https://github.com/${name}/archive/${info.version}.tar.gz";
13+ meta.homepage = "https://github.com/${name}/";
14+ inherit (info) sha256;
15+ };
16+
17+ phases = [ "unpackPhase" "installPhase" ];
18+
19+ installPhase = ''
20+ mkdir -p $out
21+ cp -r * $out
22+ '';
23+
24+ };
25+ in ''
26+ mkdir -p elm-stuff/packages/${name}
27+ ln -s ${pkg} elm-stuff/packages/${name}/${info.version}
28+ '') deps;
29+ in ''
30+ export HOME=/tmp
31+ mkdir elm-stuff
32+ cat > elm-stuff/exact-dependencies.json <<EOF
33+ ${json}
34+ EOF
35+ '' + lib.concatStrings cmds;
36+
37+ hsPkgs = haskell.packages.ghc7102.override {
38+ overrides = self: super:
39+ let hlib = haskell.lib;
40+ elmRelease = import ./packages/release.nix { inherit (self) callPackage; };
41+ elmPkgs' = elmRelease.packages;
42+ elmPkgs = elmPkgs' // {
43+
44+ elm-reactor = hlib.overrideCabal elmPkgs'.elm-reactor (drv: {
45+ buildTools = drv.buildTools or [] ++ [ self.elm-make ];
46+ patches = [ (fetchpatch {
47+ url = "https://github.com/elm-lang/elm-reactor/commit/ca4d91d3fc7c6f72aa802d79fd1563ab5f3c4f2c.patch";
48+ sha256 = "1msq7rvjid27m11lwcz9r1vyczlk7bfknyywqln300c8bgqyl45j";
49+ }) ];
50+ preConfigure = makeElmStuff (import ./packages/elm-reactor-elm.nix);
51+ });
52+
53+ elm-package = hlib.appendPatch elmPkgs'.elm-package (fetchpatch {
54+ url = "https://github.com/elm-lang/elm-package/commit/af517f2ffe15f8ec1d8c38f01ce188bbdefea47a.patch";
55+ sha256 = "0yq5vawmp9qq5w6qfy12r32ahpvccra749pnhg0zdykrj369m8a8";
56+ });
57+
58+ elm-repl = hlib.overrideCabal elmPkgs'.elm-repl (drv: {
59+ doCheck = false;
60+ buildTools = drv.buildTools or [] ++ [ makeWrapper ];
61+ postInstall =
62+ let bins = lib.makeSearchPath "bin" [ nodejs self.elm-make ];
63+ in ''
64+ wrapProgram $out/bin/elm-repl \
65+ --prefix PATH ':' ${bins}
66+ '';
67+ });
68+
69+ };
70+ in elmPkgs // {
71+ inherit elmPkgs;
72+ elmVersion = elmRelease.version;
73+ };
74+ };
75+in hsPkgs.elmPkgs // {
76+ elm = buildEnv {
77+ name = "elm-${hsPkgs.elmVersion}";
78+ paths = lib.mapAttrsToList (name: pkg: pkg) hsPkgs.elmPkgs;
79+ pathsToLink = [ "/bin" ];
80+ };
81+}
pkgs/development/compilers/elm/elm2nix.rbnew file+26
@@ -0,0 +1,26 @@
1+#!/usr/bin/env ruby
2+
3+require 'json'
4+
5+system("elm-package install -y")
6+depsSrc = JSON.parse(File.read("elm-stuff/exact-dependencies.json"))
7+deps = Hash[ depsSrc.map { |pkg, ver|
8+ url = "https://github.com/#{pkg}/archive/#{ver}.tar.gz"
9+ sha256 = `nix-prefetch-url #{url}`
10+
11+ [ pkg, { version: ver,
12+ sha256: sha256.strip
13+ }
14+ ]
15+} ]
16+
17+File.open("package.nix", 'w') do |file|
18+ file.puts "{"
19+ for pkg, info in deps
20+ file.puts " \"#{pkg}\" = {"
21+ file.puts " version = \"#{info[:version]}\";"
22+ file.puts " sha256 = \"#{info[:sha256]}\";"
23+ file.puts " };"
24+ end
25+ file.puts "}"
26+end
pkgs/development/compilers/elm/packages/elm-compiler.nixnew file+37
@@ -0,0 +1,37 @@
1+{ mkDerivation, aeson, aeson-pretty, ansi-terminal, base, binary
2+, blaze-html, blaze-markup, bytestring, cmdargs, containers
3+, directory, edit-distance, fetchgit, filemanip, filepath, HUnit
4+, indents, language-ecmascript, language-glsl, mtl, parsec, pretty
5+, process, QuickCheck, stdenv, test-framework, test-framework-hunit
6+, test-framework-quickcheck2, text, transformers, union-find
7+, unordered-containers
8+}:
9+mkDerivation {
10+ pname = "elm-compiler";
11+ version = "0.15.1";
12+ src = fetchgit {
13+ url = "https://github.com/elm-lang/elm-compiler";
14+ sha256 = "379a38db4f240ab206a2bbedc49d4768d7cf6fdf497b2d25dea71fca1d58efaa";
15+ rev = "7fbdee067b494c0298d07c944629aaa5d3fa82f5";
16+ };
17+ isLibrary = true;
18+ isExecutable = true;
19+ buildDepends = [
20+ aeson aeson-pretty ansi-terminal base binary blaze-html
21+ blaze-markup bytestring cmdargs containers directory edit-distance
22+ filepath indents language-ecmascript language-glsl mtl parsec
23+ pretty process text transformers union-find unordered-containers
24+ ];
25+ testDepends = [
26+ aeson aeson-pretty ansi-terminal base binary blaze-html
27+ blaze-markup bytestring cmdargs containers directory edit-distance
28+ filemanip filepath HUnit indents language-ecmascript language-glsl
29+ mtl parsec pretty process QuickCheck test-framework
30+ test-framework-hunit test-framework-quickcheck2 text transformers
31+ union-find
32+ ];
33+ jailbreak = true;
34+ homepage = "http://elm-lang.org";
35+ description = "Values to help with elm-package, elm-make, and elm-lang.org.";
36+ license = stdenv.lib.licenses.bsd3;
37+}
pkgs/development/compilers/elm/packages/elm-make.nixnew file+25
@@ -0,0 +1,25 @@
1+{ mkDerivation, aeson, ansi-wl-pprint, base, binary, blaze-html
2+, blaze-markup, bytestring, containers, directory, elm-compiler
3+, elm-package, fetchgit, filepath, mtl, optparse-applicative
4+, stdenv, text
5+}:
6+mkDerivation {
7+ pname = "elm-make";
8+ version = "0.2";
9+ src = fetchgit {
10+ url = "https://github.com/elm-lang/elm-make";
11+ sha256 = "b618e827ca01ddeae38624f4bf5baa3dc4cb6e9e3c9bf15f2dda5a7c756bca33";
12+ rev = "d9bedfdadc9cefce8e5249db6a316a5e712158d0";
13+ };
14+ isLibrary = false;
15+ isExecutable = true;
16+ buildDepends = [
17+ aeson ansi-wl-pprint base binary blaze-html blaze-markup bytestring
18+ containers directory elm-compiler elm-package filepath mtl
19+ optparse-applicative text
20+ ];
21+ jailbreak = true;
22+ homepage = "http://elm-lang.org";
23+ description = "A build tool for Elm projects";
24+ license = stdenv.lib.licenses.bsd3;
25+}
pkgs/development/compilers/elm/packages/elm-package.nixnew file+27
@@ -0,0 +1,27 @@
1+{ mkDerivation, aeson, aeson-pretty, ansi-wl-pprint, base, binary
2+, bytestring, containers, directory, elm-compiler, fetchgit
3+, filepath, HTTP, http-client, http-client-tls, http-types, mtl
4+, network, optparse-applicative, pretty, process, stdenv, text
5+, time, unordered-containers, vector, zip-archive
6+}:
7+mkDerivation {
8+ pname = "elm-package";
9+ version = "0.5.1";
10+ src = fetchgit {
11+ url = "https://github.com/elm-lang/elm-package";
12+ sha256 = "0d69e68831f4a86c6c02aed33fc3a6aca87636a7fb0bb6e39ffc74ddd15b5435";
13+ rev = "365e2d86a8222c92e50951c7d30b3c5db44c383d";
14+ };
15+ isLibrary = true;
16+ isExecutable = true;
17+ buildDepends = [
18+ aeson aeson-pretty ansi-wl-pprint base binary bytestring containers
19+ directory elm-compiler filepath HTTP http-client http-client-tls
20+ http-types mtl network optparse-applicative pretty process text
21+ time unordered-containers vector zip-archive
22+ ];
23+ jailbreak = true;
24+ homepage = "http://github.com/elm-lang/elm-package";
25+ description = "Package manager for Elm libraries";
26+ license = stdenv.lib.licenses.bsd3;
27+}
pkgs/development/compilers/elm/packages/elm-reactor-elm.nixnew file+18
@@ -0,0 +1,18 @@
1+{
2+ "evancz/virtual-dom" = {
3+ version = "1.2.3";
4+ sha256 = "03iv9fpng3gvia00v3gl8rs83j5b112hx0vm36az13zjr378b1jr";
5+ };
6+ "evancz/elm-markdown" = {
7+ version = "1.1.5";
8+ sha256 = "01vdaz56i064lah7kd8485j0y33di8wa134sr4292wb3na990a8r";
9+ };
10+ "evancz/elm-html" = {
11+ version = "3.0.0";
12+ sha256 = "0a2iw45x3qwxkgibkc6qx1csfa06gpkfc9b04vkq1h7ynw2g5577";
13+ };
14+ "elm-lang/core" = {
15+ version = "2.1.0";
16+ sha256 = "10fg7bcc310b5bwv6sq7gjhy9r5xzc98nbk4zhs4jqykn36i6l43";
17+ };
18+}
pkgs/development/compilers/elm/packages/elm-reactor.nixnew file+27
@@ -0,0 +1,27 @@
1+{ mkDerivation, base, blaze-html, blaze-markup, bytestring, cmdargs
2+, containers, directory, elm-compiler, fetchgit, filepath, fsnotify
3+, HTTP, mtl, process, snap-core, snap-server, stdenv
4+, system-filepath, text, time, transformers, unordered-containers
5+, websockets, websockets-snap
6+}:
7+mkDerivation {
8+ pname = "elm-reactor";
9+ version = "0.3.2";
10+ src = fetchgit {
11+ url = "https://github.com/elm-lang/elm-reactor";
12+ sha256 = "a7775971ea6634f13436f10098c462d39c6e115dbda79e537831a71975451e9a";
13+ rev = "b6c11be539734e72015ce151a9189d06dfc9db76";
14+ };
15+ isLibrary = false;
16+ isExecutable = true;
17+ buildDepends = [
18+ base blaze-html blaze-markup bytestring cmdargs containers
19+ directory elm-compiler filepath fsnotify HTTP mtl process snap-core
20+ snap-server system-filepath text time transformers
21+ unordered-containers websockets websockets-snap
22+ ];
23+ jailbreak = true;
24+ homepage = "http://elm-lang.org";
25+ description = "Interactive development tool for Elm programs";
26+ license = stdenv.lib.licenses.bsd3;
27+}
pkgs/development/compilers/elm/packages/elm-repl.nixnew file+30
@@ -0,0 +1,30 @@
1+{ mkDerivation, base, binary, bytestring, bytestring-trie, cmdargs
2+, containers, directory, elm-compiler, elm-package, fetchgit
3+, filepath, haskeline, HUnit, mtl, parsec, process, QuickCheck
4+, stdenv, test-framework, test-framework-hunit
5+, test-framework-quickcheck2
6+}:
7+mkDerivation {
8+ pname = "elm-repl";
9+ version = "0.4.2";
10+ src = fetchgit {
11+ url = "https://github.com/elm-lang/elm-repl";
12+ sha256 = "a6eadbef7886c4c65243723f101910909bb0d53b2c48454ed7b39cf700f9649c";
13+ rev = "0c434fdb24b86a93b06c33c8f26857ce47caf165";
14+ };
15+ isLibrary = false;
16+ isExecutable = true;
17+ buildDepends = [
18+ base binary bytestring bytestring-trie cmdargs containers directory
19+ elm-compiler elm-package filepath haskeline mtl parsec process
20+ ];
21+ testDepends = [
22+ base bytestring bytestring-trie cmdargs directory elm-compiler
23+ elm-package filepath haskeline HUnit mtl parsec process QuickCheck
24+ test-framework test-framework-hunit test-framework-quickcheck2
25+ ];
26+ jailbreak = true;
27+ homepage = "https://github.com/elm-lang/elm-repl";
28+ description = "a REPL for Elm";
29+ license = stdenv.lib.licenses.bsd3;
30+}
pkgs/development/compilers/elm/packages/release.nixnew file+11
@@ -0,0 +1,11 @@
1+{ callPackage }:
2+{
3+ version = "0.15.1";
4+ packages = {
5+ elm-compiler = callPackage ./elm-compiler.nix { };
6+ elm-package = callPackage ./elm-package.nix { };
7+ elm-make = callPackage ./elm-make.nix { };
8+ elm-reactor = callPackage ./elm-reactor.nix { };
9+ elm-repl = callPackage ./elm-repl.nix { };
10+ };
11+}
pkgs/development/compilers/elm/update-elm.rbnew file+25
@@ -0,0 +1,25 @@
1+#!/usr/bin/env ruby
2+
3+# Take those from https://github.com/elm-lang/elm-platform/blob/master/installers/BuildFromSource.hs
4+$elm_version = "0.15.1"
5+$elm_packages = { "elm-compiler" => "0.15.1",
6+ "elm-package" => "0.5.1",
7+ "elm-make" => "0.2",
8+ "elm-reactor" => "0.3.2",
9+ "elm-repl" => "0.4.2"
10+ }
11+
12+for pkg, ver in $elm_packages
13+ system "cabal2nix https://github.com/elm-lang/#{pkg} --revision refs/tags/#{ver} --jailbreak > #{pkg}.nix"
14+end
15+
16+File.open("release.nix", 'w') do |file|
17+ file.puts "{"
18+ file.puts " version = \"#{$elm_version}\";"
19+ file.puts " packages = {"
20+ for pkg, ver in $elm_packages
21+ file.puts " #{pkg} = callPackage ./#{pkg}.nix { };"
22+ end
23+ file.puts " };"
24+ file.puts "}"
25+end
pkgs/development/haskell-modules/configuration-common.nix−3
@@ -910,12 +910,9 @@ self: super: {
910910
911911 # Elm is no longer actively maintained on Hackage: https://github.com/NixOS/nixpkgs/pull/9233.
912912 Elm = markBroken super.Elm;
913− elm-bridge = markBroken super.elm-bridge;
914913 elm-build-lib = markBroken super.elm-build-lib;
915914 elm-compiler = markBroken super.elm-compiler;
916− elm-core-sources = markBroken super.elm-core-sources;
917915 elm-get = markBroken super.elm-get;
918− elm-init = markBroken super.elm-init;
919916 elm-make = markBroken super.elm-make;
920917 elm-package = markBroken super.elm-package;
921918 elm-reactor = markBroken super.elm-reactor;
pkgs/top-level/all-packages.nix+2
@@ -3729,6 +3729,8 @@ let
37293729
37303730 eql = callPackage ../development/compilers/eql {};
37313731
3732+ elmPackages = callPackage ../development/compilers/elm { };
3733+
37323734 adobe_flex_sdk = callPackage ../development/compilers/adobe-flex-sdk { };
37333735
37343736 fpc = callPackage ../development/compilers/fpc { };