nixpkgs/pkgs/servers/web-apps/kavita/default.nix

79 lines
2 KiB
Nix
Raw Normal View History

2023-04-24 01:06:14 +02:00
{ lib
2023-04-30 05:27:25 +02:00
, stdenvNoCC
2023-04-24 01:06:14 +02:00
, fetchFromGitHub
, buildDotnetModule
, buildNpmPackage
, dotnetCorePackages
2023-04-30 05:27:25 +02:00
, nixosTests
, substituteAll
2023-04-24 01:06:14 +02:00
}:
2023-04-30 05:27:25 +02:00
stdenvNoCC.mkDerivation (finalAttrs: {
2023-04-24 01:06:14 +02:00
pname = "kavita";
version = "0.7.1.4";
src = fetchFromGitHub {
owner = "kareadita";
repo = "kavita";
2023-04-30 05:27:25 +02:00
rev = "v${finalAttrs.version}";
2023-04-24 01:06:14 +02:00
hash = "sha256-jNhiwyz6iVSLlvMNjI689TwQYuEvTJ+QaPvvDQ4UOwc=";
};
2023-04-30 05:27:25 +02:00
backend = buildDotnetModule {
pname = "kavita-backend";
inherit (finalAttrs) version src;
patches = [
# The webroot is hardcoded as ./wwwroot
(substituteAll {
src = ./change-webroot.diff;
web_root = "${finalAttrs.frontend}/lib/node_modules/kavita-webui/dist";
})
];
executables = [ "API" ];
projectFile = "API/API.csproj";
nugetDeps = ./nuget-deps.nix;
dotnet-sdk = dotnetCorePackages.sdk_6_0;
dotnet-runtime = dotnetCorePackages.aspnetcore_6_0;
};
2023-04-24 01:06:14 +02:00
frontend = buildNpmPackage {
2023-04-30 05:27:25 +02:00
pname = "kavita-frontend";
inherit (finalAttrs) version src;
2023-04-24 01:06:14 +02:00
sourceRoot = "${finalAttrs.src.name}/UI/Web";
2023-04-24 01:06:14 +02:00
npmBuildScript = "prod";
npmFlags = [ "--legacy-peer-deps" ];
npmRebuildFlags = [ "--ignore-scripts" ]; # Prevent playwright from trying to install browsers
npmDepsHash = "sha256-w0CuTPyCQyAxULvqd6+GiZaPlO8fh4xLmbEnGA47pL8=";
};
2023-04-30 05:27:25 +02:00
dontBuild = true;
installPhase = ''
runHook preInstall
2023-04-24 01:06:14 +02:00
2023-04-30 05:27:25 +02: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-24 01:06:14 +02:00
2023-04-30 05:27:25 +02:00
runHook postInstall
2023-04-24 01:06:14 +02:00
'';
2023-04-30 05:27:25 +02:00
passthru.tests = { inherit (nixosTests) kavita; };
2023-04-24 01:06:14 +02:00
meta = {
description = "A fast, feature rich, cross platform reading server";
homepage = "https://kavitareader.com";
2023-04-30 05:27:25 +02:00
changelog = "https://github.com/kareadita/kavita/releases/tag/${finalAttrs.src.rev}";
2023-04-24 01:06:14 +02:00
license = lib.licenses.gpl3Only;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ misterio77 ];
mainProgram = "kavita";
2023-04-24 01:06:14 +02:00
};
2023-04-30 05:27:25 +02:00
})