nixpkgs/pkgs/servers/web-apps/wiki-js/default.nix
Maximilian Bosch 3dc2d95972
wiki-js: unpack into source
We effectively copy everything into `$out` (but this isn't using
`buildCommand` to allow applying custom patches). However, this had the
effect that `env-vars` was also copied into `$out` retaining a reference
to the source tarball.

Removing that reduces the closure size from 765.5M to 388.8M, i.e. by
about 50.7%.
2024-10-18 22:42:53 +02:00

45 lines
1.1 KiB
Nix

{ stdenv, fetchurl, lib, nixosTests }:
stdenv.mkDerivation rec {
pname = "wiki-js";
version = "2.5.305";
src = fetchurl {
url = "https://github.com/Requarks/wiki/releases/download/v${version}/${pname}.tar.gz";
sha256 = "sha256-beP9k1msJjg9IQbU/CmzTodjMvUnWrLYcw0EleR1OJk=";
};
# Unpack the tarball into a subdir. All the contents are copied into `$out`.
# Unpacking into the parent directory would also copy `env-vars` into `$out`
# in the `installPhase` which ultimately means that the package retains
# references to build tools and the tarball.
preUnpack = ''
mkdir source
cd source
'';
sourceRoot = ".";
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir $out
cp -r . $out
runHook postInstall
'';
passthru = {
tests = { inherit (nixosTests) wiki-js; };
updateScript = ./update.sh;
};
meta = with lib; {
homepage = "https://js.wiki/";
description = "Modern and powerful wiki app built on Node.js";
license = licenses.agpl3Only;
maintainers = with maintainers; [ ma27 ];
};
}