recyclarr: refactor - build from source

recyclarr: add openssl as runtime dependency

Addresses issue from #331498
This commit is contained in:
Joseph Stahl 2024-07-22 11:26:18 -04:00
parent 4e7d996aa8
commit 038c94d189
No known key found for this signature in database
4 changed files with 1297 additions and 81 deletions

View File

@ -0,0 +1,14 @@
diff --git a/Directory.Build.props b/Directory.Build.props
index af8e3b12..07dd1898 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -9,7 +9,7 @@
<RepositoryRoot>$(MSBuildThisFileDirectory)</RepositoryRoot>
<TestDirectory>$(RepositoryRoot)tests\</TestDirectory>
<GitVersionBaseDirectory>$(RepositoryRoot)</GitVersionBaseDirectory>
- <!--<DisableGitVersionTask>true</DisableGitVersionTask>-->
+ <DisableGitVersionTask>true</DisableGitVersionTask>
</PropertyGroup>
<!--

View File

@ -1,82 +1,67 @@
{ lib {
, stdenv lib,
, fetchurl openssl,
, makeWrapper writeText,
, autoPatchelfHook git,
, fixDarwinDylibNames buildDotnetModule,
, darwin dotnetCorePackages,
, recyclarr fetchFromGitHub,
, git recyclarr,
, icu testers,
, openssl
, testers
, zlib
}: }:
let let
os = nuget-config = writeText "nuget.config" ''
if stdenv.isDarwin <configuration>
then "osx" <packageSources>
else "linux"; <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
arch = { </configuration>
x86_64-linux = "x64"; '';
aarch64-linux = "arm64";
x86_64-darwin = "x64";
aarch64-darwin = "arm64";
}."${stdenv.hostPlatform.system}"
or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
hash = {
x64-linux_hash = "sha256-LMAY1UIwvB+ne4rpwLKaYO6QGTwdiS3YBndr73zIzvQ=";
arm64-linux_hash = "sha256-by3PSYdN7TPjA0Cx4pfzIbpZ/YVU1agfcuvuZh6mbfU=";
x64-osx_hash = "sha256-/YqdlVktgbBUNdm+mAD053pf6wCMXYt6gQP+iTQdKqw=";
arm64-osx_hash = "sha256-2RRQGNTztK14KDFRqgpagNCWTizHVNY67psaxFfyDZ4=";
}."${arch}-${os}_hash";
libPath = {
osx = "DYLD_LIBRARY_PATH : ${lib.makeLibraryPath [darwin.ICU openssl zlib]}";
linux = "LD_LIBRARY_PATH : ${lib.makeLibraryPath [icu openssl zlib]}";
}."${os}";
in in
stdenv.mkDerivation rec { buildDotnetModule rec {
pname = "recyclarr"; pname = "recyclarr";
version = "7.0.0"; version = "7.1.1";
src = fetchurl { src = fetchFromGitHub {
url = "https://github.com/recyclarr/recyclarr/releases/download/v${version}/recyclarr-${os}-${arch}.tar.xz"; owner = "recyclarr";
inherit hash; repo = pname;
rev = "v${version}";
hash = "sha256-0VPoCvhZQGMu8wZzQIk54J2OTlxe7+h/9QOxx+HuL+c=";
}; };
sourceRoot = "."; projectFile = "Recyclarr.sln";
nugetDeps = ./deps.nix;
nativeBuildInputs = [ makeWrapper ] prePatch = ''
++ lib.optional stdenv.isLinux autoPatchelfHook substituteInPlace src/Recyclarr.Cli/Program.cs \
++ lib.optional stdenv.isDarwin fixDarwinDylibNames; --replace-fail '$"v{GitVersionInformation.SemVer} ({GitVersionInformation.FullBuildMetaData})"' '"${version}-nixpkgs"'
buildInputs = [ icu zlib ];
installPhase = '' substituteInPlace src/Recyclarr.Cli/Console/Setup/ProgramInformationDisplayTask.cs \
runHook preInstall --replace-fail 'GitVersionInformation.InformationalVersion' '"${version}-nixpkgs"'
install -Dm755 recyclarr -t $out/bin
runHook postInstall
''; '';
patches = [ ./001-Git-Version.patch ];
postInstall = '' dotnetRestoreFlags = [ "--configfile=${nuget-config}" ];
wrapProgram $out/bin/recyclarr \
--prefix PATH : ${lib.makeBinPath [git]} \
--prefix ${libPath}
'';
dontStrip = true; # stripping messes up dotnet single-file deployment doCheck = false;
dotnet-sdk = dotnetCorePackages.sdk_8_0;
dotnet-runtime = dotnetCorePackages.runtime_8_0;
dotnet-test-sdk = dotnetCorePackages.sdk_8_0;
executables = [ "recyclarr" ];
makeWrapperArgs = [
"--prefix PATH : ${
lib.makeBinPath [
git
openssl
]
}"
];
passthru = { passthru = {
updateScript = ./update.sh; updateScript = ./update.sh;
tests.version = testers.testVersion { tests.version = testers.testVersion { package = recyclarr; };
package = recyclarr;
version = "v${version}";
};
}; };
meta = with lib; { meta = with lib; {
@ -84,8 +69,15 @@ stdenv.mkDerivation rec {
homepage = "https://recyclarr.dev/"; homepage = "https://recyclarr.dev/";
changelog = "https://github.com/recyclarr/recyclarr/releases/tag/v${version}"; changelog = "https://github.com/recyclarr/recyclarr/releases/tag/v${version}";
license = licenses.mit; license = licenses.mit;
maintainers = with maintainers; [ josephst ]; maintainers = with maintainers; [
mainProgram = "recyclarr"; josephst
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; aldoborrero
];
platforms = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
}; };
} }

1221
pkgs/tools/video/recyclarr/deps.nix generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
#!/usr/bin/env nix-shell #!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=./. -i bash -p curl jq common-updater-scripts gnused nix coreutils #!nix-shell -I nixpkgs=./. -i bash -p curl jq common-updater-scripts gnused nix coreutils
#shellcheck shell=bash #shellcheck shell=bash
#shellcheck source=/dev/null
set -euo pipefail set -euo pipefail
@ -14,18 +15,6 @@ if [[ "$currentVersion" == "$latestVersion" ]]; then
exit 0 exit 0
fi fi
function get_hash() { update-source-version recyclarr "$latestVersion"
local os=$1
local arch=$2
local version=$3
local pkg_hash=$(nix-prefetch-url --type sha256 \
https://github.com/recyclarr/recyclarr/releases/download/v"${version}"/recyclarr-"${os}"-"${arch}".tar.xz)
nix hash to-sri "sha256:$pkg_hash"
}
update-source-version recyclarr "$latestVersion" $(get_hash osx arm64 "$latestVersion") --system="aarch64-darwin" --ignore-same-version
update-source-version recyclarr "$latestVersion" $(get_hash osx x64 "$latestVersion") --system="x86_64-darwin" --ignore-same-version
update-source-version recyclarr "$latestVersion" $(get_hash linux arm64 "$latestVersion") --system="aarch64-linux" --ignore-same-version
update-source-version recyclarr "$latestVersion" $(get_hash linux x64 "$latestVersion") --system="x86_64-linux" --ignore-same-version
. "$(nix-build . -A recyclarr.fetch-deps --no-out-link)"