vifm: 0.13 -> 0.14 (#380559)
[NixPkgs.git] / pkgs / by-name / ha / halo / package.nix
blob7a1241b8088556c53fbed767d5baedd17f4ff82f
2   lib,
3   stdenv,
4   fetchurl,
5   makeWrapper,
6   # official jre size is 500MB, but temurin-jre-bin is 100MB.
7   temurin-jre-bin,
8 }:
9 stdenv.mkDerivation rec {
10   pname = "halo";
11   version = "2.20.14";
12   src = fetchurl {
13     url = "https://github.com/halo-dev/halo/releases/download/v${version}/halo-${version}.jar";
14     hash = "sha256-42prPQTrjTgfHiwcpIKHpuiQLw4xhZ3wK1PkVLaC4OQ=";
15   };
17   nativeBuildInputs = [
18     makeWrapper
19     temurin-jre-bin
20   ];
22   dontBuild = true;
23   dontConfigure = true;
25   unpackPhase = ''
26     cp $src halo.jar
27     # Extract the jar file.
28     # Because jar vs extract, jar startup time is 4s slower than extract.
29     java -Djarmode=tools -jar halo.jar extract --layers --launcher
30   '';
32   installPhase = ''
33     runHook preInstall
35     mkdir -p $out/share/halo
36     find halo -type d -empty -delete
37     for target in halo/*; do
38       cp -r $target/* $out/share/halo
39     done
41     # 'HALO_WORK_DIR'
42     # Set the working directory for halo, then plug-ins and other content will be stored in this directory.
43     # Note: that the '/' symbol is not required at the end of the path.
44     # default: /var/lib/halo
45     # 'JVM_OPTS'
46     # Note: 'apache.lucene' requires us to set HotspotVMOptions.
47     # You can override this via environment variables.
48     # default: -Xms256m -Xmx256m
49     # 'SPRING_CONFIG_LOCATION'
50     # Note: 'spring.config.location' is used to specify the configuration file location.
51     # Warning: This variable is based on "HALO_WORK_DIR", you do not need and should not set or override it.
52     mkdir -p $out/bin
53     makeWrapper ${temurin-jre-bin}/bin/java $out/bin/halo \
54       --chdir $out/share/halo \
55       --set-default HALO_WORK_DIR "/var/lib/halo" \
56       --set-default JVM_OPTS "-Xms256m -Xmx256m" \
57       --set SPRING_CONFIG_LOCATION "optional:classpath:/;optional:file:\`\$HALO_WORK_DIR\`/" \
58       --add-flags "-server \$JVM_OPTS" \
59       --add-flags "org.springframework.boot.loader.launch.JarLauncher"
61     runHook postInstall
62   '';
64   meta = {
65     homepage = "https://www.halo.run";
66     description = "Self-hosted dynamic blogging program";
67     maintainers = with lib.maintainers; [ yah ];
68     license = lib.licenses.gpl3Only;
69     platforms = [
70       "aarch64-linux"
71       "x86_64-linux"
72     ];
73     mainProgram = "halo";
74     sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
75   };