6 # official jre size is 500MB, but temurin-jre-bin is 100MB.
9 stdenv.mkDerivation rec {
13 url = "https://github.com/halo-dev/halo/releases/download/v${version}/halo-${version}.jar";
14 hash = "sha256-42prPQTrjTgfHiwcpIKHpuiQLw4xhZ3wK1PkVLaC4OQ=";
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
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
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
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.
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"
65 homepage = "https://www.halo.run";
66 description = "Self-hosted dynamic blogging program";
67 maintainers = with lib.maintainers; [ yah ];
68 license = lib.licenses.gpl3Only;
74 sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];