adguardhome: 0.105.2 -> 0.106.3
This commit is contained in:
parent
1b01b72d85
commit
12c6592208
3 changed files with 66 additions and 8 deletions
19
pkgs/servers/adguardhome/bins.nix
Normal file
19
pkgs/servers/adguardhome/bins.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{ fetchurl, fetchzip }:
|
||||
{
|
||||
"x86_64-darwin" = fetchzip {
|
||||
sha256 = "sha256-ec1l4KxKJH4Iwg9hW+xlxLADGLN1vParYaWIw7nCfKA=";
|
||||
url = "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.106.3/AdGuardHome_darwin_amd64.zip";
|
||||
};
|
||||
"i686-linux" = fetchurl {
|
||||
sha256 = "sha256-9aGyC76WyzwHlAkR72kuNcd/68XdWWC3gfT92IuW2LY=";
|
||||
url = "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.106.3/AdGuardHome_linux_386.tar.gz";
|
||||
};
|
||||
"x86_64-linux" = fetchurl {
|
||||
sha256 = "sha256-qJMymTxmoPlIhuJD6zFBWWwzz+CFx+9+MOrRiFtA4IY=";
|
||||
url = "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.106.3/AdGuardHome_linux_amd64.tar.gz";
|
||||
};
|
||||
"aarch64-linux" = fetchurl {
|
||||
sha256 = "sha256-Z5hekNxeemqWsMu7n3UTmYCzdKp5Xsp9ku0G2LOqC80=";
|
||||
url = "https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.106.3/AdGuardHome_linux_arm64.tar.gz";
|
||||
};
|
||||
}
|
|
@ -1,23 +1,24 @@
|
|||
{ lib, stdenv, fetchurl }:
|
||||
{ lib, stdenv, fetchurl, fetchzip, system ? stdenv.targetPlatform }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "adguardhome";
|
||||
version = "0.106.3";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/AdguardTeam/AdGuardHome/releases/download/v${version}/AdGuardHome_linux_amd64.tar.gz";
|
||||
sha256 = "11p081dqilga61zfziw5w37k6v2r84qynhz2hr4gk8367jck54x8";
|
||||
};
|
||||
src = (import ./bins.nix { inherit fetchurl fetchzip; }).${system};
|
||||
|
||||
installPhase = ''
|
||||
install -m755 -D ./AdGuardHome $out/bin/adguardhome
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
updateScript = ./update.sh;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/AdguardTeam/AdGuardHome";
|
||||
description = "Network-wide ads & trackers blocking DNS server";
|
||||
platforms = platforms.linux;
|
||||
maintainers = with maintainers; [ numkem ];
|
||||
license = licenses.gpl3;
|
||||
platforms = [ "x86_64-linux" "aarch64-linux" "i686-linux" "x86_64-darwin" ];
|
||||
maintainers = with maintainers; [ numkem iagoq ];
|
||||
license = licenses.gpl3Only;
|
||||
};
|
||||
}
|
||||
|
|
38
pkgs/servers/adguardhome/update.sh
Executable file
38
pkgs/servers/adguardhome/update.sh
Executable file
|
@ -0,0 +1,38 @@
|
|||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p curl gnugrep nix-prefetch jq
|
||||
|
||||
# This file is based on /pkgs/servers/gotify/update.sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
dirname="$(dirname "$0")"
|
||||
bins="$dirname/bins.nix"
|
||||
|
||||
latest_release=$(curl --silent https://api.github.com/repos/AdguardTeam/AdGuardHome/releases/latest)
|
||||
version=$(jq -r '.tag_name' <<<"$latest_release")
|
||||
|
||||
echo "got version $version"
|
||||
|
||||
declare -A systems
|
||||
systems[linux_386]=i686-linux
|
||||
systems[linux_amd64]=x86_64-linux
|
||||
systems[linux_arm64]=aarch64-linux
|
||||
systems[darwin_amd64]=x86_64-darwin
|
||||
|
||||
echo '{ fetchurl, fetchzip }:' > "$bins"
|
||||
echo '{' >> "$bins"
|
||||
|
||||
for asset in $(curl --silent https://api.github.com/repos/AdguardTeam/AdGuardHome/releases/latest | jq -c '.assets[]') ; do
|
||||
url="$(jq -r '.browser_download_url' <<< "$asset")"
|
||||
adg_system="$(grep -Eo '(darwin|linux)_(386|amd64|arm64)' <<< "$url" || true)"
|
||||
if [ -n "$adg_system" ]; then
|
||||
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
|
||||
fi
|
||||
done
|
||||
|
||||
echo '}' >> "$bins"
|
||||
|
||||
sed -i -r -e "s/version\s*?=\s*?.*?;/version = \"${version#v}\";/" "$dirname/default.nix"
|
Loading…
Reference in a new issue