tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
lidarr: 0.8.1.2135 -> 1.0.2.2592
J2ghz
3 years ago
aa5e70ec
a7a5b8d5
+74
-15
2 changed files
expand all
collapse all
unified
split
pkgs
servers
lidarr
default.nix
update.sh
+32
-15
pkgs/servers/lidarr/default.nix
···
1
1
-
{ lib, stdenv, fetchurl, mono, libmediainfo, sqlite, curl, chromaprint, makeWrapper }:
1
1
+
{ lib, stdenv, fetchurl, mono, libmediainfo, sqlite, curl, chromaprint, makeWrapper, icu, dotnet-runtime, openssl, nixosTests }:
2
2
3
3
-
stdenv.mkDerivation rec {
3
3
+
let
4
4
+
os = if stdenv.isDarwin then "osx" else "linux";
5
5
+
arch = {
6
6
+
x86_64-linux = "x64";
7
7
+
aarch64-linux = "arm64";
8
8
+
x86_64-darwin = "x64";
9
9
+
}."${stdenv.hostPlatform.system}" or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
10
10
+
hash = {
11
11
+
x64-linux_hash = "sha256-iuI24gT7/RFZ9xc4csd+zWEzPSPsxqYY5F+78IWRjxQ=";
12
12
+
arm64-linux_hash = "sha256-yHAoZxLeKF6mlR/Av0EH0Lh2XquM9Vx6huNDTEs4wyU=";
13
13
+
x64-osx_hash = "sha256-ES6njZTSfd/36+RvibE1hlQlCT+hEEcOem8epBSsnXc=";
14
14
+
}."${arch}-${os}_hash";
15
15
+
in stdenv.mkDerivation rec {
4
16
pname = "lidarr";
5
5
-
version = "0.8.1.2135";
17
17
+
version = "1.0.2.2592";
6
18
7
19
src = fetchurl {
8
8
-
url = "https://github.com/lidarr/Lidarr/releases/download/v${version}/Lidarr.master.${version}.linux.tar.gz";
9
9
-
sha256 = "sha256-eJX6t19D2slX68fXSMd/Vix3XSgCVylK+Wd8VH9jsuI=";
20
20
+
url = "https://github.com/lidarr/Lidarr/releases/download/v${version}/Lidarr.master.${version}.${os}-core-${arch}.tar.gz";
21
21
+
sha256 = hash;
10
22
};
11
23
12
24
nativeBuildInputs = [ makeWrapper ];
13
25
14
26
installPhase = ''
15
15
-
mkdir -p $out/bin
16
16
-
cp -r * $out/bin/
27
27
+
runHook preInstall
17
28
18
18
-
# Mark main executable as executable
19
19
-
chmod +x $out/bin/Lidarr.exe
29
29
+
mkdir -p $out/{bin,share/${pname}-${version}}
30
30
+
cp -r * $out/share/${pname}-${version}/.
31
31
+
makeWrapper "${dotnet-runtime}/bin/dotnet" $out/bin/Lidarr \
32
32
+
--add-flags "$out/share/${pname}-${version}/Lidarr.dll" \
33
33
+
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [
34
34
+
curl sqlite libmediainfo icu openssl ]}
20
35
21
21
-
makeWrapper "${mono}/bin/mono" $out/bin/Lidarr \
22
22
-
--add-flags "$out/bin/Lidarr.exe" \
23
23
-
--prefix PATH : ${lib.makeBinPath [ chromaprint ]} \
24
24
-
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [
25
25
-
curl sqlite libmediainfo ]}
36
36
+
runHook postInstall
26
37
'';
27
38
39
39
+
40
40
+
passthru = {
41
41
+
updateScript = ./update.sh;
42
42
+
tests.smoke-test = nixosTests.lidarr;
43
43
+
};
44
44
+
28
45
meta = with lib; {
29
46
description = "A Usenet/BitTorrent music downloader";
30
47
homepage = "https://lidarr.audio/";
31
48
license = licenses.gpl3;
32
49
maintainers = [ maintainers.etu ];
33
33
-
platforms = platforms.all;
50
50
+
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
34
51
};
35
52
}
+42
pkgs/servers/lidarr/update.sh
···
1
1
+
#!/usr/bin/env nix-shell
2
2
+
#!nix-shell -i bash -p curl gnused nix-prefetch jq
3
3
+
4
4
+
set -e
5
5
+
6
6
+
dirname="$(dirname "$0")"
7
7
+
8
8
+
updateHash()
9
9
+
{
10
10
+
version=$1
11
11
+
arch=$2
12
12
+
os=$3
13
13
+
14
14
+
hashKey="${arch}-${os}_hash"
15
15
+
16
16
+
url="https://github.com/Lidarr/Lidarr/releases/download/v$version/Lidarr.master.$version.$os-core-$arch.tar.gz"
17
17
+
hash=$(nix-prefetch-url --type sha256 $url)
18
18
+
sriHash="$(nix hash to-sri --type sha256 $hash)"
19
19
+
20
20
+
sed -i "s|$hashKey = \"[a-zA-Z0-9\/+-=]*\";|$hashKey = \"$sriHash\";|g" "$dirname/default.nix"
21
21
+
}
22
22
+
23
23
+
updateVersion()
24
24
+
{
25
25
+
sed -i "s/version = \"[0-9.]*\";/version = \"$1\";/g" "$dirname/default.nix"
26
26
+
}
27
27
+
28
28
+
currentVersion=$(cd $dirname && nix eval --raw -f ../../.. radarr.version)
29
29
+
30
30
+
latestTag=$(curl https://api.github.com/repos/Lidarr/Lidarr/releases/latest | jq -r ".tag_name")
31
31
+
latestVersion="$(expr $latestTag : 'v\(.*\)')"
32
32
+
33
33
+
if [[ "$currentVersion" == "$latestVersion" ]]; then
34
34
+
echo "Lidarr is up-to-date: ${currentVersion}"
35
35
+
exit 0
36
36
+
fi
37
37
+
38
38
+
updateVersion $latestVersion
39
39
+
40
40
+
updateHash $latestVersion x64 linux
41
41
+
updateHash $latestVersion arm64 linux
42
42
+
updateHash $latestVersion x64 osx