3
0
Fork 0
forked from mirrors/nixpkgs

Elm: 0.19 builds with elm-format

This commit is contained in:
Domen Kožar 2018-08-25 11:52:48 +01:00 committed by Domen Kožar
parent 9f9e9d6433
commit 7c542d0c86
8 changed files with 56 additions and 117 deletions

View file

@ -1,10 +1,12 @@
{ lib, stdenv, buildEnv, haskell, nodejs, fetchurl, makeWrapper }:
{ lib, stdenv, buildEnv, haskell, nodejs, fetchurl, makeWrapper, git }:
# To update:
# 1) Update versions in ./update-elm.rb and run it.
# 2) Checkout elm-reactor and run `elm-package install -y` inside.
# 3) Run ./elm2nix.rb in elm-reactor's directory.
# 4) Move the resulting 'package.nix' to 'packages/elm-reactor-elm.nix'.
# 1) Modify ./update.sh and run it
# 2) XXX: generate packages/elm-elm.nix
# 3) XXX: versions.dat
# Notes:
# the elm binary embeds a piece of pre-compiled elm code, used by 'elm
# reactor'. this means that the build process for 'elm' effectively
@ -48,22 +50,25 @@ let
in ''
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 ''
in (lib.concatStrings cmds) + ''
mkdir -p .elm/${ver}/package;
ln -s ${versionsDat} .elm/${ver}/package/versions.dat;
'' + lib.concatStrings cmds;
cp ${versionsDat} .elm/${ver}/package/versions.dat;
chmod -R +w .elm
'';
hsPkgs = haskell.packages.ghc822.override {
overrides = self: super:
let hlib = haskell.lib;
elmPkgs = {
elm = hlib.overrideCabal (self.callPackage ./packages/elm.nix { }) {
overrides = self: super: with haskell.lib;
let elmPkgs = {
elm = overrideCabal (self.callPackage ./packages/elm.nix { }) (attrs: {
# sadly with parallelism most of the time breaks compilation
enableParallelBuilding = false;
preConfigure = ''
export ELM_HOME=`pwd`/.elm
'' + (makeDotElm "0.19.0" (import ./packages/elm-elm.nix));
};
});
/*
This is not a core Elm package, and it's hosted on GitHub.
@ -71,14 +76,28 @@ let
cabal2nix --jailbreak --revision refs/tags/foo http://github.com/avh4/elm-format > packages/elm-format.nix
where foo is a tag for a new version, for example "0.3.1-alpha".
where foo is a tag for a new version, for example "0.8.0".
*/
elm-format = self.callPackage ./packages/elm-format.nix { };
elm-interface-to-json = self.callPackage ./packages/elm-interface-to-json.nix {};
elm-format = overrideCabal (self.callPackage ./packages/elm-format.nix { }) (drv: {
# https://github.com/avh4/elm-format/issues/529
patchPhase = ''
cat >Setup.hs <<EOF
import Distribution.Simple
main = defaultMain
EOF
sed -i '/Build_elm_format/d' elm-format.cabal
sed -i 's/Build_elm_format.gitDescribe/""/' src/ElmFormat/Version.hs
sed -i '/Build_elm_format/d' src/ElmFormat/Version.hs
'';
});
};
in elmPkgs // {
inherit elmPkgs;
elmVersion = elmPkgs.elm.version;
# Needed for elm-format
indents = self.callPackage ./packages/indents.nix {};
};
};
in hsPkgs.elmPkgs

View file

@ -6,14 +6,12 @@
}:
mkDerivation {
pname = "elm-format";
version = "0.7.0";
version = "0.8.0";
src = fetchgit {
url = "http://github.com/avh4/elm-format";
sha256 = "1snl2lrrzdwgzi68agi3sdw84aslj04pzzxpm1mam9ic6dzhn3jf";
rev = "da4b415c6a2b7e77b7d9f00beca3e45230e603fb";
sha256 = "1w79xvsyq98vfz3jb4sv8433vdh6pcg8s7yh54lcxzr1p08yhsb6";
rev = "f19ac28046d7e83ff95f845849c033cc616f1bd6";
};
doHaddock = false;
isLibrary = true;
isExecutable = true;
setupHaskellDepends = [ base Cabal directory filepath process ];
@ -27,15 +25,10 @@ mkDerivation {
base cmark containers HUnit mtl parsec QuickCheck quickcheck-io
split tasty tasty-golden tasty-hunit tasty-quickcheck text
];
doHaddock = false;
jailbreak = true;
postInstall = ''
ln -s $out/bin/elm-format-0.18 $out/bin/elm-format
'';
postPatch = ''
sed -i "s|desc <-.*||" ./Setup.hs
sed -i "s|gitDescribe = .*|gitDescribe = \\\\\"da4b415c\\\\\"\"|" ./Setup.hs
'';
homepage = http://elm-lang.org;
doCheck = false;
homepage = "http://elm-lang.org";
description = "A source code formatter for Elm";
license = stdenv.lib.licenses.bsd3;
}

View file

@ -1,24 +0,0 @@
{ mkDerivation, aeson, aeson-pretty, base, binary, bytestring
, concatenative, containers, directory, either, elm-compiler
, filemanip, filepath, indents, optparse-applicative, parsec
, stdenv, text, transformers, fetchgit
}:
mkDerivation {
pname = "elm-interface-to-json";
version = "0.1.0.0";
src = fetchgit {
url = "https://github.com/stoeffel/elm-interface-to-json";
sha256 = "1izc78w91m7nrc9i2b3lgy3kyjsy4d5mkkblx96ws0bp3dpm5f9k";
rev = "9884c1c997a55f11cf7c3d99a8afa72cf2e97323";
};
isLibrary = false;
isExecutable = true;
jailbreak = true;
executableHaskellDepends = [
aeson aeson-pretty base binary bytestring concatenative containers
directory either elm-compiler filemanip filepath indents
optparse-applicative parsec text transformers
];
homepage = "https://github.com/githubuser/elm-interface-to-json#readme";
license = stdenv.lib.licenses.bsd3;
}

View file

@ -1,22 +0,0 @@
{
"elm-lang/virtual-dom" = {
version = "2.0.1";
sha256 = "19nfjx072m7a7bx8flc50vbmiww172jmscyq9x91cr2kby5hvbw3";
};
"evancz/elm-markdown" = {
version = "3.0.1";
sha256 = "144lzpcapf2mhqiz90mkllmm4skrcs0iha1daps42qn3xps7hvmj";
};
"elm-lang/html" = {
version = "2.0.0";
sha256 = "05sqjd5n8jnq4lv5v0ipcg98b8im1isnnl4wns1zzn4w5nbrjjzi";
};
"elm-lang/svg" = {
version = "2.0.0";
sha256 = "1c7p967n1yhynravqwgh80vprwz7r2r1n0x3icn5wzk9iaqs069l";
};
"elm-lang/core" = {
version = "5.0.0";
sha256 = "0gqyc09bh43pi7r2cizyjm5y0zpgarv3is17dl325qvxb9s1y2gn";
};
}

View file

@ -1,28 +0,0 @@
{ mkDerivation, aeson, base, blaze-html, blaze-markup, bytestring
, cmdargs, containers, directory, elm-compiler, elm-package
, fetchgit, file-embed, filepath, fsnotify, mtl, process, snap-core
, snap-server, stdenv, template-haskell, text, time, transformers
, unordered-containers, utf8-string, websockets, websockets-snap
}:
mkDerivation {
pname = "elm-reactor";
version = "0.18";
src = fetchgit {
url = "https://github.com/elm-lang/elm-reactor";
sha256 = "0lpidsckyfcr8d6bln735d98dx7ga7j1vyssw0qsv8ijj18gxx65";
rev = "c519d4ec0aaf2f043a416fe858346b0181eca516";
};
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [
aeson base blaze-html blaze-markup bytestring cmdargs containers
directory elm-compiler elm-package file-embed filepath fsnotify mtl
process snap-core snap-server template-haskell text time
transformers unordered-containers utf8-string websockets
websockets-snap
];
jailbreak = true;
homepage = http://elm-lang.org;
description = "Interactive development tool for Elm programs";
license = stdenv.lib.licenses.bsd3;
}

View file

@ -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;
}

View file

@ -1,13 +0,0 @@
# This file is auto-generated by ./update-elm.rb.
# Please, do not modify it by hand!
{ callPackage }:
{
version = "0.18.0";
packages = {
elm-compiler = callPackage ./elm-compiler.nix { };
elm-package = callPackage ./elm-package.nix { };
elm-make = callPackage ./elm-make.nix { };
elm-reactor = callPackage ./elm-reactor.nix { };
elm-repl = callPackage ./elm-repl.nix { };
};
}

View file

@ -0,0 +1,3 @@
cabal2nix https://github.com/elm/compiler --revision 32059a289d27e303fa1665e9ada0a52eb688f302 > packages/elm.nix
cabal2nix --no-check cabal://indents-0.3.3 > packages/indents.nix
cabal2nix --no-haddock --no-check --jailbreak --revision refs/tags/0.8.0 http://github.com/avh4/elm-format > packages/elm-format.nix