]> Git — Sourcephile - julm/julm-nix.git/blob - nixpkgs/by-name/ra/radicle-node/package.nix
hm: v4l2: init profile
[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";
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-sb0GroWfZWC9YCGby88eiPnhFCdDA9EUhVpoyuAA+Mk=";
28 };
29 cargoHash = "sha256-+VjYX1gGf5aIGSQRMtvK6JI118X50HaxFwg5H14Vq7g=";
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 # tests regularly time out on aarch64
38 #doCheck = stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86;
39 doCheck = false;
40
41 preCheck = ''
42 export PATH=$PATH:$PWD/target/${stdenv.hostPlatform.rust.rustcTargetSpec}/release
43 # Tests want to open many files.
44 ulimit -n 4096
45 '';
46 checkFlags = [
47 "--skip=service::message::tests::test_node_announcement_validate"
48 "--skip=tests::test_announcement_relay"
49 # https://radicle.zulipchat.com/#narrow/stream/369277-heartwood/topic/Flaky.20tests/near/438352360
50 "--skip=tests::e2e::test_connection_crossing"
51 # https://radicle.zulipchat.com/#narrow/stream/369277-heartwood/topic/Clone.20Partial.20Fail.20Flake
52 "--skip=rad_clone_partial_fail"
53 ];
54
55 postInstall = ''
56 for page in $(find -name '*.adoc'); do
57 asciidoctor -d manpage -b manpage $page
58 installManPage ''${page::-5}
59 done
60 '';
61
62 postFixup = ''
63 for program in $out/bin/* ;
64 do
65 wrapProgram "$program" \
66 --prefix PATH : "${lib.makeBinPath [ git man-db openssh xdg-utils ]}"
67 done
68 '';
69
70 passthru.tests =
71 let
72 package = radicle-node;
73 in
74 {
75 version = testers.testVersion { inherit package; };
76 basic = runCommand "${package.name}-basic-test"
77 {
78 nativeBuildInputs = [ jq openssh radicle-node ];
79 } ''
80 set -e
81 export RAD_HOME="$PWD/.radicle"
82 mkdir -p "$RAD_HOME/keys"
83 ssh-keygen -t ed25519 -N "" -f "$RAD_HOME/keys/radicle" > /dev/null
84 jq -n '.node.alias |= "nix"' > "$RAD_HOME/config.json"
85
86 rad config > /dev/null
87 rad debug | jq -e '
88 (.sshVersion | contains("${openssh.version}"))
89 and
90 (.gitVersion | contains("${git.version}"))
91 '
92
93 touch $out
94 '';
95 nixos-build = lib.recurseIntoAttrs {
96 checkConfig-success = (nixos {
97 services.radicle.settings = {
98 node.alias = "foo";
99 };
100 }).config.services.radicle.configFile;
101 checkConfig-failure = testers.testBuildFailure (nixos {
102 services.radicle.settings = {
103 node.alias = null;
104 };
105 }).config.services.radicle.configFile;
106 };
107 nixos-run = nixosTests.radicle;
108 };
109
110 meta = {
111 description = "Radicle node and CLI for decentralized code collaboration";
112 longDescription = ''
113 Radicle is an open source, peer-to-peer code collaboration stack built on Git.
114 Unlike centralized code hosting platforms, there is no single entity controlling the network.
115 Repositories are replicated across peers in a decentralized manner, and users are in full control of their data and workflow.
116 '';
117 homepage = "https://radicle.xyz";
118 license = with lib.licenses; [ asl20 mit ];
119 platforms = lib.platforms.unix;
120 maintainers = with lib.maintainers; [ amesgen lorenzleutgeb ];
121 mainProgram = "rad";
122 };
123 }
124