Skip to content

Commit a7e1041

Browse files
committed
mongo: use builtin fetch urls
1 parent 504e907 commit a7e1041

1 file changed

Lines changed: 4 additions & 24 deletions

File tree

mongodb.nix

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -48,34 +48,14 @@ let
4848
arch
4949
".deb"
5050
];
51-
expectedHash = if pkgs.lib.hasAttr versionDetail sha256dict then pkgs.lib.getAttr versionDetail sha256dict else "";
52-
debFile = pkgs.stdenvNoCC.mkDerivation {
53-
name = "mongodb-deb-${version}";
54-
inherit system;
55-
unpackPhase = "true";
56-
installPhase = (pkgs.lib.concatStringsSep "\n" (map
57-
(mirror: ''
58-
echo "Trying to download from ${mirror}${buildDownloadUrl system version}"
59-
SSL_CERT_FILE="${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" ${pkgs.curl}/bin/curl -o $out ${mirror}${buildDownloadUrl system version} || true
60-
hash=$(${pkgs.nix}/bin/nix --extra-experimental-features nix-command --extra-experimental-features flakes hash file $out --type sha256)
61-
echo "Got hash $hash , expect ${expectedHash}"
62-
if [ "$hash" == "${expectedHash}" ]; then
63-
echo "Download success"
64-
exit 0
65-
fi
66-
'')
67-
mirrors)) + ''
68-
exit 1
69-
'';
70-
outputHashMode = "flat";
71-
outputHashAlgo = "sha256";
72-
outputHash = expectedHash;
73-
};
7451
in
7552
pkgs.stdenvNoCC.mkDerivation {
7653
name = "hydro-mongodb-${version}";
7754
inherit system;
78-
src = debFile;
55+
src = pkgs.fetchurl {
56+
urls = map (mirror: "${mirror}${buildDownloadUrl system version}") mirrors;
57+
hash = if pkgs.lib.hasAttr versionDetail sha256dict then pkgs.lib.getAttr versionDetail sha256dict else "";
58+
};
7959
# https://github.com/oxalica/rust-overlay/commit/c949d341f2b507857d589c48d1bd719896a2a224
8060
depsHostHost = pkgs.lib.optional (!pkgs.stdenv.hostPlatform.isDarwin) pkgs.gccForLibs.lib;
8161
nativeBuildInputs = [

0 commit comments

Comments
 (0)