nixpkgs/pkgs/development/compilers/elm/makeDotElm.nix
2018-11-21 10:57:11 +00:00

31 lines
990 B
Nix

{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
''