about summary refs log tree commit diff
path: root/pkgs/development/beam-modules/fetch-mix-deps.nix
diff options
context:
space:
mode:
authorhappysalada <raphael@megzari.com>2023-06-04 18:28:35 -0400
committerYt <happysalada@tuta.io>2023-06-05 09:29:32 -0400
commit6a050b80fa37f59ca8de60170a0571cd85cb78df (patch)
tree9a8e4a130e921c4451c5753d71b6d2a6807e25df /pkgs/development/beam-modules/fetch-mix-deps.nix
parent82801fe331d30408c3e5da826ca9dd3642098f4a (diff)
downloadnixlib-6a050b80fa37f59ca8de60170a0571cd85cb78df.tar
nixlib-6a050b80fa37f59ca8de60170a0571cd85cb78df.tar.gz
nixlib-6a050b80fa37f59ca8de60170a0571cd85cb78df.tar.bz2
nixlib-6a050b80fa37f59ca8de60170a0571cd85cb78df.tar.lz
nixlib-6a050b80fa37f59ca8de60170a0571cd85cb78df.tar.xz
nixlib-6a050b80fa37f59ca8de60170a0571cd85cb78df.tar.zst
nixlib-6a050b80fa37f59ca8de60170a0571cd85cb78df.zip
fetchMixDeps: transition to hash
Diffstat (limited to 'pkgs/development/beam-modules/fetch-mix-deps.nix')
-rw-r--r--pkgs/development/beam-modules/fetch-mix-deps.nix13
1 files changed, 9 insertions, 4 deletions
diff --git a/pkgs/development/beam-modules/fetch-mix-deps.nix b/pkgs/development/beam-modules/fetch-mix-deps.nix
index 6d047dbe1ca5..b9a1add3c7d1 100644
--- a/pkgs/development/beam-modules/fetch-mix-deps.nix
+++ b/pkgs/development/beam-modules/fetch-mix-deps.nix
@@ -2,7 +2,8 @@
 
 { pname
 , version
-, sha256
+, hash ? ""
+, sha256 ? ""
 , src
 , mixEnv ? "prod"
 , debug ? false
@@ -13,6 +14,12 @@
 , ...
 }@attrs:
 
+let
+  hash_ =
+    if hash != "" then { outputHashAlgo = null; outputHash = hash; }
+    else if sha256 != "" then { outputHashAlgo = "sha256"; outputHash = sha256; }
+    else { outputHashAlgo = "sha256"; outputHash = lib.fakeSha256; };
+in
 stdenvNoCC.mkDerivation (attrs // {
   nativeBuildInputs = [ elixir hex cacert git ];
 
@@ -51,10 +58,8 @@ stdenvNoCC.mkDerivation (attrs // {
     runHook postInstall
   '';
 
-  outputHashAlgo = "sha256";
   outputHashMode = "recursive";
-  outputHash = sha256;
 
   impureEnvVars = lib.fetchers.proxyImpureEnvVars;
   inherit meta;
-})
+} // hash_)