adguardhome: fix eval error when source does not exist

This commit is contained in:
Malo Bourgon 2022-04-26 14:16:43 -07:00
parent 1651000b71
commit 0384323c9d

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;
};