nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchFromCodeberg,
4 fetchNpmDeps,
5 installShellFiles,
6 pkg-config,
7 rustPlatform,
8 npmHooks,
9 stdenv,
10 nodejs,
11 udev,
12}:
13
14rustPlatform.buildRustPackage rec {
15 pname = "ratman";
16 version = "0.7.0";
17
18 src = fetchFromCodeberg {
19 owner = "irdest";
20 repo = "irdest";
21 tag = version;
22 hash = "sha256-rdKfKbikyqs0Y/y9A8XRVSKenjHD5rS3blxwy98Tvmg=";
23 };
24
25 cargoHash = "sha256-H1XE+khN6sU9WTM87foEQRTK0u5fgDZvoG3//hvd464=";
26
27 nativeBuildInputs = [
28 pkg-config
29 installShellFiles
30 ];
31
32 buildInputs = [ udev ];
33
34 cargoBuildFlags = [
35 "-p"
36 "ratmand"
37 "-p"
38 "ratman-tools"
39 ];
40 cargoTestFlags = cargoBuildFlags;
41
42 dashboard = stdenv.mkDerivation rec {
43 pname = "ratman-dashboard";
44 inherit version src;
45 sourceRoot = "${src.name}/ratman/dashboard";
46
47 npmDeps = fetchNpmDeps {
48 pname = "npm-deps-${pname}";
49 inherit version;
50 src = "${src}/ratman/dashboard";
51 hash = "sha256-47L4V/Vf8DK3q63MYw3x22+rzIN3UPD0N/REmXh5h3w=";
52 };
53
54 nativeBuildInputs = [
55 nodejs
56 npmHooks.npmConfigHook
57 npmHooks.npmBuildHook
58 ];
59
60 npmBuildScript = "build";
61
62 installPhase = ''
63 mkdir $out
64 cp -r dist/* $out/
65 '';
66 };
67
68 prePatch = ''
69 cp -r ${dashboard} ratman/dashboard/dist
70 '';
71
72 meta = {
73 description = "Modular decentralised peer-to-peer packet router and associated tools";
74 homepage = "https://git.irde.st/we/irdest";
75 platforms = lib.platforms.unix;
76 license = lib.licenses.agpl3Only;
77 maintainers = with lib.maintainers; [ spacekookie ];
78 };
79}