1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/pkgs/development/compilers/elm/makeDotElm.nix

31 lines
990 B
Nix
Raw Normal View History

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