nixpkgs/pkgs/by-name/la/lanraragi/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

128 lines
3.1 KiB
Nix
Raw Normal View History

2023-09-17 15:12:40 +00:00
{ lib
, stdenv
, buildNpmPackage
, fetchFromGitHub
, makeBinaryWrapper
, perl
, ghostscript
, nixosTests
}:
2023-11-05 12:28:47 +00:00
buildNpmPackage rec {
pname = "lanraragi";
2024-06-28 10:25:35 +00:00
version = "0.9.10";
2023-11-05 12:28:47 +00:00
src = fetchFromGitHub {
owner = "Difegue";
repo = "LANraragi";
rev = "v.${version}";
2024-06-28 10:25:35 +00:00
hash = "sha256-mW2cVd+SPbjc/+b0KY3je1eqw5ZT/GKFruE4Y/eFdD4=";
2023-11-05 12:28:47 +00:00
};
patches = [
./install.patch
./fix-paths.patch
./expose-password-hashing.patch # Used by the NixOS module
];
2024-06-28 10:25:35 +00:00
npmDepsHash = "sha256-RAjZGuK0C6R22fVFq82GPQoD1HpRs3MYMluUAV5ZEc8=";
2023-09-17 15:12:40 +00:00
2023-11-05 12:28:47 +00:00
nativeBuildInputs = [ perl makeBinaryWrapper ];
buildInputs = with perl.pkgs; [
perl
2023-09-17 15:12:40 +00:00
ImageMagick
locallib
Redis
Encode
ArchiveLibarchiveExtract
ArchiveLibarchivePeek
2023-11-05 12:28:47 +00:00
ListMoreUtils
2023-09-17 15:12:40 +00:00
NetDNSNative
SortNaturally
AuthenPassphrase
FileReadBackwards
URI
LogfileRotate
Mojolicious
MojoliciousPluginTemplateToolkit
MojoliciousPluginRenderFile
MojoliciousPluginStatus
2024-06-28 10:25:35 +00:00
IOSocketSocks
2023-09-17 15:12:40 +00:00
IOSocketSSL
CpanelJSONXS
Minion
MinionBackendRedis
ProcSimple
ParallelLoops
SysCpuAffinity
FileChangeNotify
ModulePluggable
TimeLocal
2024-06-28 10:25:35 +00:00
YAMLPP
2023-11-05 12:28:47 +00:00
StringSimilarity
2024-06-28 10:25:35 +00:00
] ++ lib.optionals stdenv.isLinux [ LinuxInotify2 ];
2023-09-17 15:12:40 +00:00
buildPhase = ''
runHook preBuild
2023-11-05 12:28:47 +00:00
# Check if every perl dependency was installed
# explicitly call cpanm with perl because the shebang is broken on darwin
perl ${perl.pkgs.Appcpanminus}/bin/cpanm --installdeps ./tools --notest
2023-09-17 15:12:40 +00:00
perl ./tools/install.pl install-full
rm -r node_modules public/js/vendor/*.map public/css/vendor/*.map
runHook postBuild
'';
doCheck = true;
2023-11-05 12:28:47 +00:00
nativeCheckInputs = with perl.pkgs; [
TestMockObject
TestTrap
TestDeep
];
2023-09-17 15:12:40 +00:00
checkPhase = ''
runHook preCheck
rm tests/plugins.t # Uses network
prove -r -l -v tests
runHook postCheck
'';
installPhase = ''
runHook preInstall
mkdir -p $out/share/lanraragi
2023-11-05 12:28:47 +00:00
chmod +x script/launcher.pl
cp -r lib public script templates package.json lrr.conf $out/share/lanraragi
2023-09-17 15:12:40 +00:00
2023-11-05 12:28:47 +00:00
makeWrapper $out/share/lanraragi/script/launcher.pl $out/bin/lanraragi \
--prefix PERL5LIB : $PERL5LIB \
2023-09-17 15:12:40 +00:00
--prefix PATH : ${lib.makeBinPath [ ghostscript ]} \
2023-11-05 12:28:47 +00:00
--run "cp -n --no-preserve=all $out/share/lanraragi/lrr.conf ./lrr.conf 2>/dev/null || true" \
--add-flags "-f $out/share/lanraragi/script/lanraragi"
makeWrapper ${lib.getExe perl} $out/bin/helpers/lrr-make-password-hash \
--prefix PERL5LIB : $out/share/lanraragi/lib:$PERL5LIB \
--add-flags "-e 'use LANraragi::Controller::Config; print LANraragi::Controller::Config::make_password_hash(@ARGV[0])' 2>/dev/null"
2023-09-17 15:12:40 +00:00
runHook postInstall
'';
2023-11-05 12:28:47 +00:00
passthru.tests.module = nixosTests.lanraragi;
2023-09-17 15:12:40 +00:00
meta = {
changelog = "https://github.com/Difegue/LANraragi/releases/tag/${src.rev}";
description = "Web application for archival and reading of manga/doujinshi";
homepage = "https://github.com/Difegue/LANraragi";
license = lib.licenses.mit;
mainProgram = "lanraragi";
maintainers = with lib.maintainers; [ tomasajt ];
platforms = lib.platforms.unix;
};
}