Silvan Mosberger 374e6bcc40 treewide: Format all Nix files
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:

  nix-build ci -A fmt.check

This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).

This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).

Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase).

If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
2025-04-01 20:10:43 +02:00

135 lines
3.2 KiB
Nix

{
lib,
stdenv,
buildNpmPackage,
fetchFromGitHub,
makeBinaryWrapper,
perl,
ghostscript,
nixosTests,
}:
buildNpmPackage rec {
pname = "lanraragi";
version = "0.9.21";
src = fetchFromGitHub {
owner = "Difegue";
repo = "LANraragi";
rev = "v.${version}";
hash = "sha256-2YdQeBW1MQiUs5nliloISaxG0yhFJ6ulkU/Urx8PN3Y=";
};
patches = [
./install.patch
./fix-paths.patch
./expose-password-hashing.patch # Used by the NixOS module
];
npmDepsHash = "sha256-RAjZGuK0C6R22fVFq82GPQoD1HpRs3MYMluUAV5ZEc8=";
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
IOSocketSocks
IOSocketSSL
CpanelJSONXS
Minion
MinionBackendRedis
ProcSimple
ParallelLoops
SysCpuAffinity
FileChangeNotify
ModulePluggable
TimeLocal
YAMLPP
StringSimilarity
]
++ lib.optionals stdenv.hostPlatform.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;
};
}