about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--nixos/doc/manual/release-notes/rl-2405.section.md2
-rw-r--r--pkgs/by-name/ha/haredoc/package.nix55
2 files changed, 57 insertions, 0 deletions
diff --git a/nixos/doc/manual/release-notes/rl-2405.section.md b/nixos/doc/manual/release-notes/rl-2405.section.md
index daabca2aee60..c75b062dcfe8 100644
--- a/nixos/doc/manual/release-notes/rl-2405.section.md
+++ b/nixos/doc/manual/release-notes/rl-2405.section.md
@@ -152,6 +152,8 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m
 
 - `services.homepage-dashboard` now takes it's configuration using native Nix expressions, rather than dumping templated configurations into `/var/lib/homepage-dashboard` where they were previously managed manually. There are now new options which allow the configuration of bookmarks, services, widgets and custom CSS/JS natively in Nix.
 
+- `hare` may now be cross-compiled. For that to work, however, `haredoc` needed to stop being built together with it. Thus, the latter is now its own package with the name of `haredoc`.
+
 - The legacy and long deprecated systemd target `network-interfaces.target` has been removed. Use `network.target` instead.
 
 - `services.frp.settings` now generates the frp configuration file in TOML format as [recommended by upstream](https://github.com/fatedier/frp#configuration-files), instead of the legacy INI format. This has also introduced other changes in the configuration file structure and options.
diff --git a/pkgs/by-name/ha/haredoc/package.nix b/pkgs/by-name/ha/haredoc/package.nix
new file mode 100644
index 000000000000..2476e7d937c5
--- /dev/null
+++ b/pkgs/by-name/ha/haredoc/package.nix
@@ -0,0 +1,55 @@
+{ lib
+, stdenv
+, scdoc
+, hare
+}:
+let
+  arch = stdenv.hostPlatform.uname.processor;
+in
+stdenv.mkDerivation {
+  pname = "haredoc";
+  outputs = [ "out" "man" ];
+  inherit (hare) version src;
+
+  strictDeps = true;
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [
+    scdoc
+    hare
+  ];
+
+  preBuild = ''
+    HARECACHE="$(mktemp -d)"
+    export HARECACHE
+  '';
+
+  buildPhase = ''
+    runHook preBuild
+
+    hare build -qR -a ${arch} -o haredoc ./cmd/haredoc
+    scdoc <docs/haredoc.1.scd >haredoc.1
+    scdoc <docs/haredoc.5.scd >haredoc.5
+
+    runHook postBuild
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    install -Dm0755 ./haredoc $out/bin/haredoc
+    install -Dm0644 ./haredoc.1 $out/share/man/man1/haredoc.1
+    install -Dm0644 ./haredoc.5 $out/share/man/man5/haredoc.5
+
+    runHook postInstall
+  '';
+
+  meta = {
+    homepage = "https://harelang.org/";
+    description = "Hare's documentation tool";
+    license = lib.licenses.gpl3Only;
+    maintainers = with lib.maintainers; [ onemoresuza ];
+    mainProgram = "haredoc";
+    inherit (hare.meta) platforms badPlatforms;
+  };
+}