summaryrefslogtreecommitdiffstats
path: root/pkgs/development/beam-modules
diff options
context:
space:
mode:
authorRyan Rasti <ryanrasti@protonmail.com>2023-01-30 02:35:12 -0800
committerYt <happysalada@proton.me>2023-02-17 20:50:47 -0500
commitbe1f8ec4f599a5325216850bcae6e18a8d96cdec (patch)
treea2c8596285d0fca7390fd29e0231acc414328959 /pkgs/development/beam-modules
parentd48c8e181e6e6c7ed9825339e6144619745ec841 (diff)
fetchHex produces outputs that mix will accept
Diffstat (limited to 'pkgs/development/beam-modules')
-rw-r--r--pkgs/development/beam-modules/fetch-hex.nix11
1 files changed, 10 insertions, 1 deletions
diff --git a/pkgs/development/beam-modules/fetch-hex.nix b/pkgs/development/beam-modules/fetch-hex.nix
index 9d7e18ce24ed..2d1fa623745a 100644
--- a/pkgs/development/beam-modules/fetch-hex.nix
+++ b/pkgs/development/beam-modules/fetch-hex.nix
@@ -19,9 +19,18 @@ stdenv.mkDerivation ({
};
unpackCmd = ''
- tar -xf $curSrc contents.tar.gz
+ tar -xf $curSrc contents.tar.gz CHECKSUM metadata.config
mkdir contents
tar -C contents -xzf contents.tar.gz
+ mv metadata.config contents/hex_metadata.config
+
+ # To make the extracted hex tarballs appear legitimate to mix, we need to
+ # make sure they contain not just the contents of contents.tar.gz but also
+ # a .hex file with some lock metadata.
+ # We use an old version of .hex file per hex's mix_task_test.exs since it
+ # is just plain-text instead of an encoded format.
+ # See: https://github.com/hexpm/hex/blob/main/test/hex/mix_task_test.exs#L410
+ echo -n "${pkg},${version},$(cat CHECKSUM | tr '[:upper:]' '[:lower:]'),hexpm" > contents/.hex
'';
installPhase = ''