2019-06-25 16:13:08 +02:00
|
|
|
{ lib, stdenv, pkgs
|
2018-09-15 18:16:13 +02:00
|
|
|
, haskell, nodejs
|
2020-08-10 20:25:06 +02:00
|
|
|
, fetchurl, fetchpatch, makeWrapper, writeScriptBin
|
|
|
|
# Rust dependecies
|
|
|
|
, rustPlatform, openssl, pkg-config }:
|
2015-08-13 13:50:59 +02:00
|
|
|
let
|
2018-11-18 21:07:31 +01:00
|
|
|
fetchElmDeps = import ./fetchElmDeps.nix { inherit stdenv lib fetchurl; };
|
2019-06-09 16:25:00 +02:00
|
|
|
|
2020-04-11 12:05:08 +02:00
|
|
|
hsPkgs = haskell.packages.ghc883.override {
|
2018-08-25 12:52:48 +02:00
|
|
|
overrides = self: super: with haskell.lib;
|
2019-06-09 16:25:00 +02:00
|
|
|
let elmPkgs = rec {
|
2018-08-25 13:01:52 +02:00
|
|
|
elm = overrideCabal (self.callPackage ./packages/elm.nix { }) (drv: {
|
2018-08-25 12:52:48 +02:00
|
|
|
# sadly with parallelism most of the time breaks compilation
|
|
|
|
enableParallelBuilding = false;
|
2019-01-03 17:31:00 +01:00
|
|
|
preConfigure = self.fetchElmDeps {
|
|
|
|
elmPackages = (import ./packages/elm-srcs.nix);
|
2019-10-21 16:31:02 +02:00
|
|
|
elmVersion = drv.version;
|
|
|
|
registryDat = ./registry.dat;
|
2018-11-18 21:07:31 +01:00
|
|
|
};
|
2018-08-25 13:01:52 +02:00
|
|
|
buildTools = drv.buildTools or [] ++ [ makeWrapper ];
|
2019-01-04 14:03:24 +01:00
|
|
|
jailbreak = true;
|
2018-08-25 13:01:52 +02:00
|
|
|
postInstall = ''
|
|
|
|
wrapProgram $out/bin/elm \
|
|
|
|
--prefix PATH ':' ${lib.makeBinPath [ nodejs ]}
|
|
|
|
'';
|
2018-08-25 12:52:48 +02:00
|
|
|
});
|
|
|
|
|
2016-05-29 23:34:23 +02:00
|
|
|
/*
|
2018-10-03 20:41:58 +02:00
|
|
|
The elm-format expression is updated via a script in the https://github.com/avh4/elm-format repo:
|
2019-06-09 16:25:00 +02:00
|
|
|
`package/nix/build.sh`
|
2016-05-29 23:34:23 +02:00
|
|
|
*/
|
2019-10-21 22:41:29 +02:00
|
|
|
elm-format = justStaticExecutables (overrideCabal (self.callPackage ./packages/elm-format.nix {}) (drv: {
|
|
|
|
jailbreak = true;
|
|
|
|
}));
|
2020-03-16 20:10:34 +01:00
|
|
|
|
2019-10-21 16:31:02 +02:00
|
|
|
elmi-to-json = justStaticExecutables (overrideCabal (self.callPackage ./packages/elmi-to-json.nix {}) (drv: {
|
2019-10-21 22:41:29 +02:00
|
|
|
prePatch = ''
|
2019-10-21 16:31:02 +02:00
|
|
|
substituteInPlace package.yaml --replace "- -Werror" ""
|
|
|
|
hpack
|
|
|
|
'';
|
|
|
|
jailbreak = true;
|
|
|
|
}));
|
2019-06-09 16:25:00 +02:00
|
|
|
|
2020-03-16 20:10:34 +01:00
|
|
|
elm-instrument = justStaticExecutables (overrideCabal (self.callPackage ./packages/elm-instrument.nix {}) (drv: {
|
|
|
|
prePatch = ''
|
|
|
|
sed "s/desc <-.*/let desc = \"${drv.version}\"/g" Setup.hs --in-place
|
|
|
|
'';
|
|
|
|
jailbreak = true;
|
|
|
|
# Tests are failing because of missing instances for Eq and Show type classes
|
|
|
|
doCheck = false;
|
|
|
|
}));
|
|
|
|
|
2018-11-18 21:07:31 +01:00
|
|
|
inherit fetchElmDeps;
|
2019-01-04 14:03:24 +01:00
|
|
|
elmVersion = elmPkgs.elm.version;
|
2015-08-13 13:50:59 +02:00
|
|
|
};
|
|
|
|
in elmPkgs // {
|
|
|
|
inherit elmPkgs;
|
2018-08-25 12:52:48 +02:00
|
|
|
|
|
|
|
# Needed for elm-format
|
|
|
|
indents = self.callPackage ./packages/indents.nix {};
|
2015-08-13 13:50:59 +02:00
|
|
|
};
|
|
|
|
};
|
2019-09-29 12:57:55 +02:00
|
|
|
|
2020-04-15 21:29:52 +02:00
|
|
|
/* Node/NPM based dependecies can be upgraded using script `packages/generate-node-packages.sh`.
|
|
|
|
|
|
|
|
* Packages which rely on `bin-wrap` will fail by default
|
|
|
|
and can be patched using `patchBinwrap` function defined in `packages/lib.nix`.
|
|
|
|
|
|
|
|
* Packages which depend on npm installation of elm can be patched using
|
|
|
|
`patchNpmElm` function also defined in `packages/lib.nix`.
|
2019-09-29 12:57:55 +02:00
|
|
|
*/
|
2020-04-15 21:29:52 +02:00
|
|
|
elmLib = import ./packages/lib.nix {
|
|
|
|
inherit lib writeScriptBin stdenv;
|
|
|
|
inherit (hsPkgs.elmPkgs) elm;
|
|
|
|
};
|
|
|
|
|
2020-11-29 16:23:10 +01:00
|
|
|
elmRustPackages = {
|
|
|
|
elm-json = import ./packages/elm-json.nix {
|
|
|
|
inherit rustPlatform fetchurl openssl stdenv pkg-config;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-04-15 21:29:52 +02:00
|
|
|
elmNodePackages = with elmLib;
|
2019-09-29 12:57:55 +02:00
|
|
|
let
|
|
|
|
nodePkgs = import ./packages/node-composition.nix {
|
|
|
|
inherit nodejs pkgs;
|
|
|
|
inherit (stdenv.hostPlatform) system;
|
|
|
|
};
|
2020-03-18 20:36:36 +01:00
|
|
|
in with hsPkgs.elmPkgs; {
|
2020-04-15 21:29:52 +02:00
|
|
|
|
|
|
|
elm-test = patchBinwrap [elmi-to-json]
|
|
|
|
nodePkgs.elm-test;
|
|
|
|
|
|
|
|
elm-verify-examples = patchBinwrap [elmi-to-json]
|
|
|
|
nodePkgs.elm-verify-examples;
|
|
|
|
|
2020-03-17 13:56:14 +01:00
|
|
|
elm-coverage =
|
2020-04-15 21:29:52 +02:00
|
|
|
let patched = patchNpmElm (patchBinwrap [elmi-to-json] nodePkgs.elm-coverage);
|
|
|
|
in patched.override (old: {
|
|
|
|
# Symlink Elm instrument binary
|
|
|
|
preRebuild = (old.preRebuild or "") + ''
|
|
|
|
# Noop custom installation script
|
2020-03-17 13:56:14 +01:00
|
|
|
sed 's/\"install\".*/\"install\":\"echo no-op\"/g' --in-place package.json
|
|
|
|
|
|
|
|
# This should not be needed (thanks to binwrap* being nooped) but for some reason it still needs to be done
|
|
|
|
# in case of just this package
|
2020-04-15 21:29:52 +02:00
|
|
|
# TODO: investigate
|
2020-03-17 13:56:14 +01:00
|
|
|
sed 's/\"install\".*/\"install\":\"echo no-op\",/g' --in-place node_modules/elmi-to-json/package.json
|
|
|
|
'';
|
2020-04-15 21:29:52 +02:00
|
|
|
postInstall = (old.postInstall or "") + ''
|
2020-03-17 13:56:14 +01:00
|
|
|
mkdir -p unpacked_bin
|
|
|
|
ln -sf ${elm-instrument}/bin/elm-instrument unpacked_bin/elm-instrument
|
|
|
|
'';
|
2020-04-15 21:29:52 +02:00
|
|
|
});
|
2020-04-04 22:21:46 +02:00
|
|
|
|
2020-04-15 21:29:52 +02:00
|
|
|
create-elm-app = patchNpmElm (patchBinwrap [elmi-to-json]
|
|
|
|
nodePkgs.create-elm-app);
|
2020-04-04 22:21:46 +02:00
|
|
|
|
2020-11-29 16:23:10 +01:00
|
|
|
elm-review = patchBinwrap [elmRustPackages.elm-json]
|
|
|
|
nodePkgs.elm-review;
|
|
|
|
|
2019-09-29 12:57:55 +02:00
|
|
|
elm-language-server = nodePkgs."@elm-tooling/elm-language-server";
|
|
|
|
|
2020-08-29 11:59:03 +02:00
|
|
|
elm-optimize-level-2 = nodePkgs."elm-optimize-level-2";
|
|
|
|
|
2019-10-22 19:03:58 +02:00
|
|
|
inherit (nodePkgs) elm-doc-preview elm-live elm-upgrade elm-xref elm-analyse;
|
2019-09-29 12:57:55 +02:00
|
|
|
};
|
|
|
|
|
2020-11-29 16:23:10 +01:00
|
|
|
in hsPkgs.elmPkgs // elmNodePackages // elmRustPackages // {
|
2020-04-15 21:29:52 +02:00
|
|
|
lib = elmLib;
|
2019-09-29 12:57:55 +02:00
|
|
|
}
|