From 478cff8d326d7848fb9a8a1d242db7fe18688a61 Mon Sep 17 00:00:00 2001 From: Coutinho de Souza Date: Wed, 6 Mar 2024 11:10:27 -0300 Subject: [PATCH] haredoc: init at 0.24.0 Also add a mention to the release notes of 24.05 about `hare` and `haredoc` being split into different packages. --- .../manual/release-notes/rl-2405.section.md | 2 + pkgs/by-name/ha/haredoc/package.nix | 55 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 pkgs/by-name/ha/haredoc/package.nix 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 haredoc.1 + scdoc 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; + }; +}