5 # official jre size is 500MB, but temurin-jre-bin is 100MB.
8 stdenv.mkDerivation rec {
12 url = "https://github.com/halo-dev/halo/releases/download/v${version}/halo-${version}.jar";
13 hash = "sha256-VGSSGc2caNO7+IK1ArqjZGz+LaHWZsaO68Jr06BCcfE=";
26 # Extract the jar file.
27 # Because jar vs extract, jar startup time is 4s slower than extract.
28 java -Djarmode=tools -jar halo.jar extract --layers --launcher
34 mkdir -p $out/share/halo
35 find halo -type d -empty -delete
36 for target in halo/*; do
37 cp -r $target/* $out/share/halo
41 # Set the working directory for halo, then plug-ins and other content will be stored in this directory.
42 # Note: that the '/' symbol is not required at the end of the path.
43 # default: /var/lib/halo
45 # Note: 'apache.lucene' requires us to set HotspotVMOptions.
46 # You can override this via environment variables.
47 # default: -Xms256m -Xmx256m
48 # 'SPRING_CONFIG_LOCATION'
49 # Note: 'spring.config.location' is used to specify the configuration file location.
50 # Warning: This variable is based on "HALO_WORK_DIR", you do not need and should not set or override it.
52 makeWrapper ${temurin-jre-bin}/bin/java $out/bin/halo \
53 --chdir $out/share/halo \
54 --set-default HALO_WORK_DIR "/var/lib/halo" \
55 --set-default JVM_OPTS "-Xms256m -Xmx256m" \
56 --set SPRING_CONFIG_LOCATION "optional:classpath:/;optional:file:\`\$HALO_WORK_DIR\`/" \
57 --add-flags "-server \$JVM_OPTS" \
58 --add-flags "org.springframework.boot.loader.launch.JarLauncher"
64 homepage = "https://www.halo.run";
65 description = "Self-hosted dynamic blogging program";
66 maintainers = with lib.maintainers; [ yah ];
67 license = lib.licenses.gpl3Only;
68 platforms = [ "aarch64-linux" "x86_64-linux" ];
70 sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];