ombi: init at 4.0.1292
This commit is contained in:
parent
cfd56a4c04
commit
0cda2e2cb2
65
pkgs/servers/ombi/default.nix
Normal file
65
pkgs/servers/ombi/default.nix
Normal file
@ -0,0 +1,65 @@
|
||||
{ lib, stdenv, fetchurl, makeWrapper, patchelf, openssl, libunwind, zlib, krb5, icu }:
|
||||
|
||||
let
|
||||
os = if stdenv.isDarwin then "osx" else "linux";
|
||||
arch = {
|
||||
x86_64-linux = "x64";
|
||||
aarch64-linux = "arm64";
|
||||
x86_64-darwin = "x64";
|
||||
}."${stdenv.hostPlatform.system}" or (throw
|
||||
"Unsupported system: ${stdenv.hostPlatform.system}");
|
||||
|
||||
hash = {
|
||||
x64-linux_hash = "sha256-Cuvz9Mhwpg8RIaiSXib+QW00DM66qPRQulrchRL2BSk=";
|
||||
arm64-linux_hash = "sha256-uyVwa73moHWMZScNNSOU17lALuK3PC/cvTZPJ9qg7JQ=";
|
||||
x64-osx_hash = "sha256-FGXLsfEuCW94D786LJ/wvA9TakOn5sG2M1rDXPQicYw=";
|
||||
}."${arch}-${os}_hash";
|
||||
|
||||
rpath = lib.makeLibraryPath [
|
||||
stdenv.cc.cc openssl libunwind zlib krb5 icu
|
||||
];
|
||||
|
||||
dynamicLinker = stdenv.cc.bintools.dynamicLinker;
|
||||
|
||||
in stdenv.mkDerivation rec {
|
||||
pname = "ombi";
|
||||
version = "4.0.1292";
|
||||
|
||||
sourceRoot = ".";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/Ombi-app/Ombi/releases/download/v${version}/${os}-${arch}.tar.gz";
|
||||
sha256 = hash;
|
||||
};
|
||||
|
||||
buildInputs = [ makeWrapper patchelf ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/{bin,share/${pname}-${version}}
|
||||
cp -r * $out/share/${pname}-${version}
|
||||
|
||||
makeWrapper $out/share/${pname}-${version}/Ombi $out/bin/Ombi \
|
||||
--run "cd $out/share/${pname}-${version}"
|
||||
'';
|
||||
|
||||
dontPatchELF = true;
|
||||
postFixup = ''
|
||||
patchelf --set-interpreter "${dynamicLinker}" \
|
||||
--set-rpath "$ORIGIN:${rpath}" $out/share/${pname}-${version}/Ombi
|
||||
|
||||
find $out -type f -name "*.so" -exec \
|
||||
patchelf --set-rpath '$ORIGIN:${rpath}' {} ';'
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
updateScript = ./update.sh;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Self-hosted web application that automatically gives your shared Plex or Emby users the ability to request content by themselves";
|
||||
homepage = "https://ombi.io/";
|
||||
license = licenses.gpl2Only;
|
||||
maintainers = with maintainers; [ woky ];
|
||||
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
|
||||
};
|
||||
}
|
42
pkgs/servers/ombi/update.sh
Executable file
42
pkgs/servers/ombi/update.sh
Executable file
@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p curl gnused nix-prefetch jq
|
||||
|
||||
set -e
|
||||
|
||||
dirname="$(dirname "$0")"
|
||||
|
||||
updateHash()
|
||||
{
|
||||
version=$1
|
||||
arch=$2
|
||||
os=$3
|
||||
|
||||
hashKey="${arch}-${os}_hash"
|
||||
|
||||
url="https://github.com/Ombi-app/Ombi/releases/download/v$version/$os-$arch.tar.gz"
|
||||
hash=$(nix-prefetch-url --type sha256 $url)
|
||||
sriHash="$(nix to-sri --type sha256 $hash)"
|
||||
|
||||
sed -i "s|$hashKey = \"[a-zA-Z0-9\/+-=]*\";|$hashKey = \"$sriHash\";|g" "$dirname/default.nix"
|
||||
}
|
||||
|
||||
updateVersion()
|
||||
{
|
||||
sed -i "s/version = \"[0-9.]*\";/version = \"$1\";/g" "$dirname/default.nix"
|
||||
}
|
||||
|
||||
currentVersion=$(cd $dirname && nix eval --raw '(with import ../../.. {}; ombi.version)')
|
||||
|
||||
latestTag=$(curl https://api.github.com/repos/Ombi-App/Ombi/tags | jq -r '.[] | .name' | sort --version-sort | tail -1)
|
||||
latestVersion="$(expr $latestTag : 'v\(.*\)')"
|
||||
|
||||
if [[ "$currentVersion" == "$latestVersion" ]]; then
|
||||
echo "Ombi is up-to-date: ${currentVersion}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
updateVersion $latestVersion
|
||||
|
||||
updateHash $latestVersion x64 linux
|
||||
updateHash $latestVersion arm64 linux
|
||||
updateHash $latestVersion x64 osx
|
@ -6927,6 +6927,8 @@ in
|
||||
inherit (darwin.apple_sdk.frameworks) CoreFoundation;
|
||||
};
|
||||
|
||||
ombi = callPackage ../servers/ombi { };
|
||||
|
||||
omping = callPackage ../applications/networking/omping { };
|
||||
|
||||
onefetch = callPackage ../tools/misc/onefetch {
|
||||
|
Loading…
Reference in New Issue
Block a user