blob: 2a18474e2d2c42db9670e26405ea0610b2e910fb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
{ lib
, stdenv
, buildNpmPackage
, fetchFromGitHub
, fetchpatch
, makeBinaryWrapper
, perl
, ghostscript
, nixosTests
}:
buildNpmPackage rec {
pname = "lanraragi";
version = "0.9.0";
src = fetchFromGitHub {
owner = "Difegue";
repo = "LANraragi";
rev = "v.${version}";
hash = "sha256-euZotpXTUSmxlA5rbTUhHpHH0Ojd3AZjGasxYZ+L7NY=";
};
patches = [
(fetchpatch {
name = "fix-redis-auth.patch";
url = "https://github.com/Difegue/LANraragi/commit/1711b39759ad02ab2a8863ce1f35f6479c9a2917.patch";
hash = "sha256-WfKeieysIlS64qgVEc75JFKjxXuvZN85M6US/gwjTzw=";
})
(fetchpatch {
name = "fix-ghostscript-device.patch";
url = "https://github.com/Difegue/LANraragi/commit/087d63b11c89fda8cb3a30cdb2e86ecd6be66bb7.patch";
hash = "sha256-Cu9d/dDlO0yuFCTKOyg5A0gIuiA+FcWD9PjexB/BK0U=";
})
./install.patch
./fix-paths.patch
./expose-password-hashing.patch # Used by the NixOS module
];
npmDepsHash = "sha256-/F/lhQIVGbbFxFuQXXwHUVlV2jhHt0hFf94v0FrTKt8=";
nativeBuildInputs = [ perl makeBinaryWrapper ];
buildInputs = with perl.pkgs; [
perl
ImageMagick
locallib
Redis
Encode
ArchiveLibarchiveExtract
ArchiveLibarchivePeek
ListMoreUtils
NetDNSNative
SortNaturally
AuthenPassphrase
FileReadBackwards
URI
LogfileRotate
Mojolicious
MojoliciousPluginTemplateToolkit
MojoliciousPluginRenderFile
MojoliciousPluginStatus
IOSocketSSL
CpanelJSONXS
Minion
MinionBackendRedis
ProcSimple
ParallelLoops
SysCpuAffinity
FileChangeNotify
ModulePluggable
TimeLocal
YAMLSyck
StringSimilarity
] ++ lib.optional stdenv.isLinux LinuxInotify2;
buildPhase = ''
runHook preBuild
# 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
perl ./tools/install.pl install-full
rm -r node_modules public/js/vendor/*.map public/css/vendor/*.map
runHook postBuild
'';
doCheck = true;
nativeCheckInputs = with perl.pkgs; [
TestMockObject
TestTrap
TestDeep
];
checkPhase = ''
runHook preCheck
rm tests/plugins.t # Uses network
prove -r -l -v tests
runHook postCheck
'';
installPhase = ''
runHook preInstall
mkdir -p $out/share/lanraragi
chmod +x script/launcher.pl
cp -r lib public script templates package.json lrr.conf $out/share/lanraragi
makeWrapper $out/share/lanraragi/script/launcher.pl $out/bin/lanraragi \
--prefix PERL5LIB : $PERL5LIB \
--prefix PATH : ${lib.makeBinPath [ ghostscript ]} \
--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"
runHook postInstall
'';
passthru.tests.module = nixosTests.lanraragi;
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;
};
}
|