nixpkgs/pkgs/by-name/ra/radicle-httpd/package.nix
Vincent Ambo f6c31a3b66 radicle-explorer: init at 0.17.0
This commit adds radicle-explorer, a web interface for Radicle which displays
repositories, issues and patches.

The package builds the web interface itself, but a web server still needs to be
configured to serve it. This is out-of-scope for this commit, but may be added
to the related NixOS modules in the future.

The web interface is based on the API exposed by radicle-httpd. For this reason
the sources and version of the web interface have been tied directly to the
radicle-httpd package, necessitating corresponding updates on this package
whenever httpd is updated.

There's a little bit of fixed-point magic in this change to enable two features:

* Overriding build-time configuration (required to, for example, display a
  different Radicle seed by default). Documentation for this is available in the
  upstream repo.

* Building radicle-explorer without plausible, a web tracking package which
  sends user-data to a remote host by default.

These are configured through slightly different overriding mechanisms, but I
hope to simplify this in the future with some upstream patches.
2024-09-19 07:17:08 +00:00

82 lines
1.9 KiB
Nix

{
asciidoctor,
darwin,
fetchgit,
git,
installShellFiles,
lib,
makeWrapper,
man-db,
rustPlatform,
stdenv,
xdg-utils,
}:
rustPlatform.buildRustPackage rec {
pname = "radicle-httpd";
version = "0.17.0";
env.RADICLE_VERSION = version;
# You must update the radicle-explorer source hash when changing this.
src = fetchgit {
url = "https://seed.radicle.xyz/z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git";
rev = "refs/namespaces/z6MkkfM3tPXNPrPevKr3uSiQtHPuwnNhu2yUVjgd2jXVsVz5/refs/tags/v${version}";
hash = "sha256-nstyb1rSll3Sl0DlA9JAAwvr6JN8okJ03WoQnE4dXEk=";
sparseCheckout = [ "radicle-httpd" ];
};
sourceRoot = "${src.name}/radicle-httpd";
cargoHash = "sha256-M4tDtUXS99/Zb1Z71CTdW9gMgRR30rbwA6wK7nlwblQ=";
nativeBuildInputs = [
asciidoctor
installShellFiles
makeWrapper
];
nativeCheckInputs = [ git ];
buildInputs = lib.optionals stdenv.buildPlatform.isDarwin [ darwin.apple_sdk.frameworks.Security ];
doCheck = stdenv.hostPlatform.isLinux;
postInstall = ''
for page in $(find -name '*.adoc'); do
asciidoctor -d manpage -b manpage $page
installManPage ''${page::-5}
done
'';
postFixup = ''
for program in $out/bin/* ;
do
wrapProgram "$program" \
--prefix PATH : "${
lib.makeBinPath [
git
man-db
xdg-utils
]
}"
done
'';
meta = {
description = "Radicle JSON HTTP API Daemon";
longDescription = ''
A Radicle HTTP daemon exposing a JSON HTTP API that allows someone to browse local
repositories on a Radicle node via their web browser.
'';
homepage = "https://radicle.xyz";
# cargo.toml says MIT and asl20, LICENSE file says GPL3
license = with lib.licenses; [
gpl3Only
mit
asl20
];
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [
gador
lorenzleutgeb
];
mainProgram = "radicle-httpd";
};
}