depot/third_party/nixpkgs/pkgs/development/compilers/elm/lib/makeDotElm.nix
Default email 587713944a Project import generated by Copybara.
GitOrigin-RevId: 6143fc5eeb9c4f00163267708e26191d1e918932
2024-04-21 17:54:59 +02:00

36 lines
899 B
Nix

{ stdenv, lib, fetchurl, registryDat }:
ver: deps:
let
cmds = lib.mapAttrsToList
(name: info:
let
pkg = stdenv.mkDerivation {
name = lib.replaceStrings [ "/" ] [ "-" ] name + "-${info.version}";
src = fetchurl {
url = "https://github.com/${name}/archive/${info.version}.tar.gz";
meta.homepage = "https://github.com/${name}/";
inherit (info) sha256;
};
dontConfigure = true;
dontBuild = true;
installPhase = ''
mkdir -p $out
cp -r * $out
'';
};
in
''
mkdir -p .elm/${ver}/packages/${name}
cp -R ${pkg} .elm/${ver}/packages/${name}/${info.version}
'')
deps;
in
(lib.concatStrings cmds) + ''
mkdir -p .elm/${ver}/packages;
cp ${registryDat} .elm/${ver}/packages/registry.dat;
chmod -R +w .elm
''