]> Git — Sourcephile - julm/julm-nix.git/blob - nixpkgs/by-name/ra/radicle-node/package.nix
bash: alias ju
[julm/julm-nix.git] / nixpkgs / by-name / ra / radicle-node / package.nix
1 { asciidoctor
2 , darwin
3 , fetchgit
4 , git
5 , installShellFiles
6 , jq
7 , lib
8 , makeWrapper
9 , man-db
10 , nixos
11 , nixosTests
12 , openssh
13 , radicle-node
14 , runCommand
15 , rustPlatform
16 , stdenv
17 , testers
18 , xdg-utils
19 }: rustPlatform.buildRustPackage rec {
20 pname = "radicle-node";
21 version = "1.0.0-rc.11";
22 env.RADICLE_VERSION = version;
23
24 src = fetchgit {
25 url = "https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git";
26 rev = "refs/namespaces/z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT/refs/tags/v${version}";
27 hash = "sha256-P1Gg2uk87ppco7CAPjEqN0uqgb0K8apOSC7cfdgaT0Y=";
28 };
29 cargoHash = "sha256-M01NjqvMSaa3+YPb4vDtIucBeF5BYx3cpmMoLJOwRsI=";
30
31 nativeBuildInputs = [ asciidoctor installShellFiles makeWrapper ];
32 nativeCheckInputs = [ git ];
33 buildInputs = lib.optionals stdenv.buildPlatform.isDarwin [
34 darwin.apple_sdk.frameworks.Security
35 ];
36
37 doCheck = stdenv.hostPlatform.isLinux;
38
39 preCheck = ''
40 export PATH=$PATH:$PWD/target/${stdenv.hostPlatform.rust.rustcTargetSpec}/release
41 # Tests want to open many files.
42 ulimit -n 4096
43 '';
44 checkFlags = [
45 "--skip=service::message::tests::test_node_announcement_validate"
46 "--skip=tests::test_announcement_relay"
47 # https://radicle.zulipchat.com/#narrow/stream/369277-heartwood/topic/Flaky.20tests/near/438352360
48 "--skip=tests::e2e::test_connection_crossing"
49 ];
50
51 postInstall = ''
52 for page in $(find -name '*.adoc'); do
53 asciidoctor -d manpage -b manpage $page
54 installManPage ''${page::-5}
55 done
56 '';
57
58 postFixup = ''
59 for program in $out/bin/* ;
60 do
61 wrapProgram "$program" \
62 --prefix PATH : "${lib.makeBinPath [ git man-db openssh xdg-utils ]}"
63 done
64 '';
65
66 passthru.tests =
67 let
68 package = radicle-node;
69 in
70 {
71 version = testers.testVersion { inherit package; };
72 basic = runCommand "${package.name}-basic-test"
73 {
74 nativeBuildInputs = [ jq openssh radicle-node ];
75 } ''
76 set -e
77 export RAD_HOME="$PWD/.radicle"
78 mkdir -p "$RAD_HOME/keys"
79 ssh-keygen -t ed25519 -N "" -f "$RAD_HOME/keys/radicle" > /dev/null
80 jq -n '.node.alias |= "nix"' > "$RAD_HOME/config.json"
81
82 rad config > /dev/null
83 rad debug | jq -e '
84 (.sshVersion | contains("${openssh.version}"))
85 and
86 (.gitVersion | contains("${git.version}"))
87 '
88
89 touch $out
90 '';
91 nixos-build = lib.recurseIntoAttrs {
92 checkConfig-success = (nixos {
93 services.radicle.settings = {
94 node.alias = "foo";
95 };
96 }).config.services.radicle.configFile;
97 checkConfig-failure = testers.testBuildFailure (nixos {
98 services.radicle.settings = {
99 node.alias = null;
100 };
101 }).config.services.radicle.configFile;
102 };
103 nixos-run = nixosTests.radicle;
104 };
105
106 meta = {
107 description = "Radicle node and CLI for decentralized code collaboration";
108 longDescription = ''
109 Radicle is an open source, peer-to-peer code collaboration stack built on Git.
110 Unlike centralized code hosting platforms, there is no single entity controlling the network.
111 Repositories are replicated across peers in a decentralized manner, and users are in full control of their data and workflow.
112 '';
113 homepage = "https://radicle.xyz";
114 license = with lib.licenses; [ asl20 mit ];
115 platforms = lib.platforms.unix;
116 maintainers = with lib.maintainers; [ amesgen lorenzleutgeb ];
117 mainProgram = "rad";
118 };
119 }