2022-01-20 07:56:15 +01:00
|
|
|
{ lib
|
2022-07-01 22:18:59 +02:00
|
|
|
, fetchFromGitLab
|
2022-01-20 07:56:15 +01:00
|
|
|
, installShellFiles
|
|
|
|
, libsodium
|
|
|
|
, pkg-config
|
|
|
|
, protobuf
|
|
|
|
, rustPlatform
|
2022-07-01 22:18:59 +02:00
|
|
|
, fetchYarnDeps
|
2023-12-12 10:48:10 +01:00
|
|
|
, prefetch-yarn-deps
|
2022-07-01 22:18:59 +02:00
|
|
|
, stdenv
|
|
|
|
, yarn
|
|
|
|
, nodejs
|
2022-01-20 07:56:15 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "ratman";
|
2022-07-01 22:18:59 +02:00
|
|
|
version = "0.4.0";
|
2022-01-20 07:56:15 +01:00
|
|
|
|
2022-07-01 22:18:59 +02:00
|
|
|
src = fetchFromGitLab {
|
|
|
|
domain = "git.irde.st";
|
|
|
|
owner = "we";
|
|
|
|
repo = "irdest";
|
|
|
|
rev = "${pname}-${version}";
|
|
|
|
sha256 = "sha256-ZZ7idZ67xvQFmQJqIFU/l77YU+yDQOqNthX5NR/l4k8=";
|
2022-01-20 07:56:15 +01:00
|
|
|
};
|
|
|
|
|
2022-07-01 22:18:59 +02:00
|
|
|
cargoSha256 = "Nsux0QblBtzlhLEgfKYvkQrOz8+oVd2pqT3CL8TnQEc=";
|
2022-01-20 07:56:15 +01:00
|
|
|
|
|
|
|
nativeBuildInputs = [ protobuf pkg-config installShellFiles ];
|
|
|
|
|
|
|
|
cargoBuildFlags = [ "--all-features" "-p" "ratman" ];
|
|
|
|
cargoTestFlags = cargoBuildFlags;
|
|
|
|
|
|
|
|
buildInputs = [ libsodium ];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
installManPage docs/man/ratmand.1
|
|
|
|
'';
|
|
|
|
|
|
|
|
SODIUM_USE_PKG_CONFIG = 1;
|
|
|
|
|
2022-07-01 22:18:59 +02:00
|
|
|
dashboard = stdenv.mkDerivation rec {
|
|
|
|
pname = "ratman-dashboard";
|
|
|
|
inherit version src;
|
2023-07-25 15:27:31 +02:00
|
|
|
sourceRoot = "${src.name}/ratman/dashboard";
|
2022-07-01 22:18:59 +02:00
|
|
|
|
|
|
|
yarnDeps = fetchYarnDeps {
|
|
|
|
yarnLock = src + "/ratman/dashboard/yarn.lock";
|
|
|
|
sha256 = "sha256-pWjKL41r/bTvWv+5qCgCFVL9+o64BiV2/ISdLeKEOqE=";
|
|
|
|
};
|
|
|
|
|
2023-12-12 10:48:10 +01:00
|
|
|
nativeBuildInputs = [ yarn nodejs prefetch-yarn-deps ];
|
2022-07-01 22:18:59 +02:00
|
|
|
|
|
|
|
outputs = [ "out" "dist" ];
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
# Yarn writes temporary files to $HOME. Copied from mkYarnModules.
|
|
|
|
export HOME=$NIX_BUILD_TOP/yarn_home
|
|
|
|
|
|
|
|
# Make yarn install packages from our offline cache, not the registry
|
|
|
|
yarn config --offline set yarn-offline-mirror ${yarnDeps}
|
|
|
|
|
|
|
|
# Fixup "resolved"-entries in yarn.lock to match our offline cache
|
2023-12-12 10:48:10 +01:00
|
|
|
fixup-yarn-lock yarn.lock
|
2022-07-01 22:18:59 +02:00
|
|
|
|
|
|
|
yarn install --offline --frozen-lockfile --ignore-scripts --no-progress --non-interactive
|
|
|
|
|
|
|
|
patchShebangs node_modules/
|
|
|
|
|
|
|
|
# Build into `./dist/`, suppress formatting.
|
|
|
|
yarn --offline build | cat
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
cp -R . $out
|
|
|
|
|
|
|
|
mv $out/dist $dist
|
|
|
|
ln -s $dist $out/dist
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
prePatch = ''
|
|
|
|
cp -r ${dashboard.dist} ratman/dashboard/dist
|
|
|
|
'';
|
|
|
|
|
2022-01-20 07:56:15 +01:00
|
|
|
meta = with lib; {
|
|
|
|
description = "A modular decentralised peer-to-peer packet router and associated tools";
|
|
|
|
homepage = "https://git.irde.st/we/irdest";
|
|
|
|
platforms = platforms.unix;
|
2024-03-19 13:26:06 +01:00
|
|
|
license = licenses.agpl3Only;
|
2022-01-20 07:56:15 +01:00
|
|
|
maintainers = with maintainers; [ spacekookie yuka ];
|
|
|
|
};
|
|
|
|
}
|