2024-09-22 06:50:26 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenvNoCC,
|
|
|
|
fetchFromGitHub,
|
|
|
|
buildDotnetModule,
|
|
|
|
buildNpmPackage,
|
|
|
|
dotnetCorePackages,
|
|
|
|
nixosTests,
|
2023-04-23 23:06:14 +00:00
|
|
|
}:
|
|
|
|
|
2023-04-30 03:27:25 +00:00
|
|
|
stdenvNoCC.mkDerivation (finalAttrs: {
|
2023-04-23 23:06:14 +00:00
|
|
|
pname = "kavita";
|
2024-09-22 06:50:26 +00:00
|
|
|
version = "0.8.3.2";
|
2023-04-23 23:06:14 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "kareadita";
|
|
|
|
repo = "kavita";
|
2024-09-22 06:50:26 +00:00
|
|
|
rev = "v${finalAttrs.version}";
|
|
|
|
hash = "sha256-8ZE3zlWX8DxLYUFj3AA04cIJTUWYgnNM+5FZhGmlRz8=";
|
2023-04-23 23:06:14 +00:00
|
|
|
};
|
|
|
|
|
2023-04-30 03:27:25 +00:00
|
|
|
backend = buildDotnetModule {
|
|
|
|
pname = "kavita-backend";
|
|
|
|
inherit (finalAttrs) version src;
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# The webroot is hardcoded as ./wwwroot
|
2024-03-27 04:13:18 +00:00
|
|
|
./change-webroot.diff
|
2024-03-31 13:55:30 +00:00
|
|
|
# Upstream removes database migrations between versions
|
|
|
|
# Restore them to avoid breaking on updates
|
|
|
|
# Info: Restores migrations for versions between v0.7.1.4 and v0.7.9
|
|
|
|
# On update: check if more migrations need to be restored!
|
|
|
|
# Migrations should at least allow updates from previous NixOS versions
|
|
|
|
./restore-migrations.diff
|
2023-04-30 03:27:25 +00:00
|
|
|
];
|
2024-03-27 04:13:18 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace API/Services/DirectoryService.cs --subst-var out
|
|
|
|
|
|
|
|
substituteInPlace API/Startup.cs API/Services/LocalizationService.cs API/Controllers/FallbackController.cs \
|
|
|
|
--subst-var-by webroot "${finalAttrs.frontend}/lib/node_modules/kavita-webui/dist/browser"
|
|
|
|
'';
|
2023-04-30 03:27:25 +00:00
|
|
|
|
|
|
|
executables = [ "API" ];
|
|
|
|
|
|
|
|
projectFile = "API/API.csproj";
|
|
|
|
nugetDeps = ./nuget-deps.nix;
|
2024-03-27 04:13:18 +00:00
|
|
|
dotnet-sdk = dotnetCorePackages.sdk_8_0;
|
|
|
|
dotnet-runtime = dotnetCorePackages.aspnetcore_8_0;
|
2023-04-30 03:27:25 +00:00
|
|
|
};
|
2023-04-23 23:06:14 +00:00
|
|
|
|
2024-09-22 06:50:26 +00:00
|
|
|
frontend = buildNpmPackage {
|
2023-04-30 03:27:25 +00:00
|
|
|
pname = "kavita-frontend";
|
|
|
|
inherit (finalAttrs) version src;
|
2023-04-23 23:06:14 +00:00
|
|
|
|
2023-07-25 13:27:31 +00:00
|
|
|
sourceRoot = "${finalAttrs.src.name}/UI/Web";
|
2023-04-23 23:06:14 +00:00
|
|
|
|
|
|
|
npmBuildScript = "prod";
|
|
|
|
npmFlags = [ "--legacy-peer-deps" ];
|
|
|
|
npmRebuildFlags = [ "--ignore-scripts" ]; # Prevent playwright from trying to install browsers
|
2024-09-22 06:50:26 +00:00
|
|
|
npmDepsHash = "sha256-EB4B6BHiRi6A4nhj2dR+3q1MZKcfcYUuo4ls4WMJEUI=";
|
2023-04-23 23:06:14 +00:00
|
|
|
};
|
|
|
|
|
2023-04-30 03:27:25 +00:00
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
2023-04-23 23:06:14 +00:00
|
|
|
|
2023-04-30 03:27:25 +00:00
|
|
|
mkdir -p $out/bin $out/lib/kavita
|
|
|
|
ln -s $backend/lib/kavita-backend $out/lib/kavita/backend
|
|
|
|
ln -s $frontend/lib/node_modules/kavita-webui/dist $out/lib/kavita/frontend
|
|
|
|
ln -s $backend/bin/API $out/bin/kavita
|
2023-04-23 23:06:14 +00:00
|
|
|
|
2023-04-30 03:27:25 +00:00
|
|
|
runHook postInstall
|
2023-04-23 23:06:14 +00:00
|
|
|
'';
|
|
|
|
|
2023-12-20 13:17:14 +00:00
|
|
|
passthru = {
|
2024-09-22 06:50:26 +00:00
|
|
|
tests = {
|
|
|
|
inherit (nixosTests) kavita;
|
|
|
|
};
|
2023-12-20 13:17:14 +00:00
|
|
|
updateScript = ./update.sh;
|
|
|
|
};
|
2023-04-23 23:06:14 +00:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Fast, feature rich, cross platform reading server";
|
|
|
|
homepage = "https://kavitareader.com";
|
2023-04-30 03:27:25 +00:00
|
|
|
changelog = "https://github.com/kareadita/kavita/releases/tag/${finalAttrs.src.rev}";
|
2023-04-23 23:06:14 +00:00
|
|
|
license = lib.licenses.gpl3Only;
|
|
|
|
platforms = lib.platforms.linux;
|
2024-09-22 06:50:26 +00:00
|
|
|
maintainers = with lib.maintainers; [
|
|
|
|
misterio77
|
|
|
|
nevivurn
|
|
|
|
];
|
2023-07-31 19:21:43 +00:00
|
|
|
mainProgram = "kavita";
|
2023-04-23 23:06:14 +00:00
|
|
|
};
|
2023-04-30 03:27:25 +00:00
|
|
|
})
|