From 89a2f870114de589262a6842bf9c3687a18cfdb2 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Thu, 13 Aug 2015 14:50:59 +0300 Subject: [PATCH 1/2] elm: add the platform and helpful scripts --- doc/package-notes.xml | 20 +++++ .../doc/manual/release-notes/rl-unstable.xml | 3 + pkgs/development/compilers/elm/default.nix | 81 +++++++++++++++++++ pkgs/development/compilers/elm/elm2nix.rb | 26 ++++++ .../compilers/elm/packages/elm-compiler.nix | 37 +++++++++ .../compilers/elm/packages/elm-make.nix | 25 ++++++ .../compilers/elm/packages/elm-package.nix | 27 +++++++ .../elm/packages/elm-reactor-elm.nix | 18 +++++ .../compilers/elm/packages/elm-reactor.nix | 27 +++++++ .../compilers/elm/packages/elm-repl.nix | 30 +++++++ .../compilers/elm/packages/release.nix | 11 +++ pkgs/development/compilers/elm/update-elm.rb | 25 ++++++ pkgs/top-level/all-packages.nix | 2 + 13 files changed, 332 insertions(+) create mode 100644 pkgs/development/compilers/elm/default.nix create mode 100755 pkgs/development/compilers/elm/elm2nix.rb create mode 100644 pkgs/development/compilers/elm/packages/elm-compiler.nix create mode 100644 pkgs/development/compilers/elm/packages/elm-make.nix create mode 100644 pkgs/development/compilers/elm/packages/elm-package.nix create mode 100644 pkgs/development/compilers/elm/packages/elm-reactor-elm.nix create mode 100644 pkgs/development/compilers/elm/packages/elm-reactor.nix create mode 100644 pkgs/development/compilers/elm/packages/elm-repl.nix create mode 100644 pkgs/development/compilers/elm/packages/release.nix create mode 100755 pkgs/development/compilers/elm/update-elm.rb diff --git a/doc/package-notes.xml b/doc/package-notes.xml index 266a80922160..9d8217d60bc8 100644 --- a/doc/package-notes.xml +++ b/doc/package-notes.xml @@ -346,4 +346,24 @@ packageOverrides = pkgs: { +
+ +Elm + + +The Nix expressions for Elm reside in +pkgs/development/compilers/elm. They are generated +automatically by update-elm.rb script. One should +specify versions of Elm packages inside the script, clear the +packages directory and run the script from inside it. +elm-reactor is special because it also has Elm package +dependencies. The process is not automated very much for now -- you should +get the elm-reactor source tree (e.g. with +nix-shell) and run elm2nix.rb inside +it. Place the resulting package.nix file into +packages/elm-reactor-elm.nix. + + +
+ diff --git a/nixos/doc/manual/release-notes/rl-unstable.xml b/nixos/doc/manual/release-notes/rl-unstable.xml index 30da98faa330..8fbac05e9684 100644 --- a/nixos/doc/manual/release-notes/rl-unstable.xml +++ b/nixos/doc/manual/release-notes/rl-unstable.xml @@ -80,6 +80,9 @@ was accordingly renamed to bomi was accordingly renamed to electron +Elm is not released on Hackage anymore. You should now use elmPackages.elm +which contains the latest Elm platform. + The CUPS printing service has been updated to version 2.0.2. diff --git a/pkgs/development/compilers/elm/default.nix b/pkgs/development/compilers/elm/default.nix new file mode 100644 index 000000000000..4a056e61de95 --- /dev/null +++ b/pkgs/development/compilers/elm/default.nix @@ -0,0 +1,81 @@ +{ lib, stdenv, buildEnv, haskell, nodejs, fetchurl, fetchpatch, makeWrapper }: + +let + makeElmStuff = deps: + let json = builtins.toJSON (lib.mapAttrs (name: info: info.version) deps); + 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-stuff/packages/${name} + ln -s ${pkg} elm-stuff/packages/${name}/${info.version} + '') deps; + in '' + export HOME=/tmp + mkdir elm-stuff + cat > elm-stuff/exact-dependencies.json < "0.15.1", + "elm-package" => "0.5.1", + "elm-make" => "0.2", + "elm-reactor" => "0.3.2", + "elm-repl" => "0.4.2" + } + +for pkg, ver in $elm_packages + system "cabal2nix https://github.com/elm-lang/#{pkg} --revision refs/tags/#{ver} --jailbreak > #{pkg}.nix" +end + +File.open("release.nix", 'w') do |file| + file.puts "{" + file.puts " version = \"#{$elm_version}\";" + file.puts " packages = {" + for pkg, ver in $elm_packages + file.puts " #{pkg} = callPackage ./#{pkg}.nix { };" + end + file.puts " };" + file.puts "}" +end diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 56b257669aa8..ecb009152e85 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3729,6 +3729,8 @@ let eql = callPackage ../development/compilers/eql {}; + elmPackages = callPackage ../development/compilers/elm { }; + adobe_flex_sdk = callPackage ../development/compilers/adobe-flex-sdk { }; fpc = callPackage ../development/compilers/fpc { }; From 43cba717d2309e37dbfc1da482f6d7f587e63d57 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Mon, 17 Aug 2015 20:59:18 +0300 Subject: [PATCH 2/2] haskell: partially revert marking Elm packages as broken See https://github.com/NixOS/nixpkgs/pull/9233#issuecomment-131596192 --- pkgs/development/haskell-modules/configuration-common.nix | 3 --- 1 file changed, 3 deletions(-) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 3c0e03095ce7..6423b0726d47 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -910,12 +910,9 @@ self: super: { # Elm is no longer actively maintained on Hackage: https://github.com/NixOS/nixpkgs/pull/9233. Elm = markBroken super.Elm; - elm-bridge = markBroken super.elm-bridge; elm-build-lib = markBroken super.elm-build-lib; elm-compiler = markBroken super.elm-compiler; - elm-core-sources = markBroken super.elm-core-sources; elm-get = markBroken super.elm-get; - elm-init = markBroken super.elm-init; elm-make = markBroken super.elm-make; elm-package = markBroken super.elm-package; elm-reactor = markBroken super.elm-reactor;