Merge pull request #170509 from malob/fix-adguardhome

adguardhome: fix eval error when source does not exist and source for `aarch64-darwin`
This commit is contained in:
Sandro 2022-04-28 11:43:40 +02:00 committed by GitHub
commit ef93815863
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 9 deletions

View File

@ -1,18 +1,22 @@
{ fetchurl, fetchzip }:
{
"x86_64-darwin" = fetchzip {
x86_64-darwin = fetchzip {
sha256 = "sha256-vUOdHDyvVg+8GhctW925WfjONi7TnPRfVfXmehOweB4=";
url = "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.6/AdGuardHome_darwin_amd64.zip";
};
"i686-linux" = fetchurl {
aarch64-darwin = fetchzip {
sha256 = "sha256-3JmMvxd317Qmyrv7vWyfQsLol+yPuKBXHByt5YRrbX8=";
url = "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.6/AdGuardHome_darwin_arm64.zip";
};
i686-linux = fetchurl {
sha256 = "sha256-A6IsDRbRHyU0+IUKkrudKvlKiJkVNNs12MrKQ6RlpMQ=";
url = "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.6/AdGuardHome_linux_386.tar.gz";
};
"x86_64-linux" = fetchurl {
x86_64-linux = fetchurl {
sha256 = "sha256-nPcqAk0m1e9izkylBuNcatHESgvSewR+MKmVdz+HBec=";
url = "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.6/AdGuardHome_linux_amd64.tar.gz";
};
"aarch64-linux" = fetchurl {
aarch64-linux = fetchurl {
sha256 = "sha256-ITkZdVU03FG9AUAMgD6nlCyioPJX357wB9m1jYdPlS4=";
url = "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.6/AdGuardHome_linux_arm64.tar.gz";
};

View File

@ -1,10 +1,14 @@
{ lib, stdenv, fetchurl, fetchzip, nixosTests }:
let
inherit (stdenv.hostPlatform) system;
sources = import ./bins.nix { inherit fetchurl fetchzip; };
in
stdenv.mkDerivation rec {
pname = "adguardhome";
version = "0.107.6";
src = (import ./bins.nix { inherit fetchurl fetchzip; }).${stdenv.hostPlatform.system};
src = sources.${system} or (throw "Source for ${pname} is not available for ${system}");
installPhase = ''
install -m755 -D ./AdGuardHome $out/bin/adguardhome
@ -18,7 +22,7 @@ stdenv.mkDerivation rec {
meta = with lib; {
homepage = "https://github.com/AdguardTeam/AdGuardHome";
description = "Network-wide ads & trackers blocking DNS server";
platforms = [ "x86_64-linux" "aarch64-linux" "i686-linux" "x86_64-darwin" ];
platforms = builtins.attrNames sources;
maintainers = with maintainers; [ numkem iagoq ];
license = licenses.gpl3Only;
};

View File

@ -18,6 +18,7 @@ systems[linux_386]=i686-linux
systems[linux_amd64]=x86_64-linux
systems[linux_arm64]=aarch64-linux
systems[darwin_amd64]=x86_64-darwin
systems[darwin_arm64]=aarch64-darwin
echo '{ fetchurl, fetchzip }:' > "$bins"
echo '{' >> "$bins"
@ -29,7 +30,7 @@ for asset in $(curl --silent https://api.github.com/repos/AdguardTeam/AdGuardHom
fetch="$(grep '\.zip$' <<< "$url" > /dev/null && echo fetchzip || echo fetchurl)"
nix_system=${systems[$adg_system]}
nix_src="$(nix-prefetch -s --output nix $fetch --url $url)"
echo "\"$nix_system\" = $fetch $nix_src;" >> $bins
echo "$nix_system = $fetch $nix_src;" >> $bins
fi
done