From 1795ddbbe908360d051289e450eb2cf054b44dfc Mon Sep 17 00:00:00 2001 From: stuebinm Date: Thu, 12 Oct 2023 01:02:42 +0200 Subject: playing around with radicle.xyz this packages the heartwood cli tools, the radicle web interface, and runs a small example deployment on chaski. TODO: decide if i want to keep this thing, then add declarative config of the web interface, `rad auth`, and the radicle node to a NixOS module; the current state is kinda suboptimal to deploy. --- chaski/services/radicle.nix | 68 +++++++++++++++++++++++++++++++++++ flake.nix | 2 +- home/packages.nix | 1 + pkgs/overlay.nix | 9 +++-- pkgs/radicle-remove-curl-script.patch | 23 ++++++++++++ pkgs/radicle.nix | 47 ++++++++++++++++++++++++ 6 files changed, 146 insertions(+), 4 deletions(-) create mode 100644 chaski/services/radicle.nix create mode 100644 pkgs/radicle-remove-curl-script.patch create mode 100644 pkgs/radicle.nix diff --git a/chaski/services/radicle.nix b/chaski/services/radicle.nix new file mode 100644 index 0000000..f02a934 --- /dev/null +++ b/chaski/services/radicle.nix @@ -0,0 +1,68 @@ +{ config, lib, pkgs, ... }: + +{ + services.nginx.virtualHosts."node.radicle.stuebinm.eu" = { + enableACME = true; + forceSSL = true; + locations."/".proxyPass = "http://localhost:4444"; + }; + + services.nginx.virtualHosts."radicle.stuebinm.eu" = { + enableACME = true; + forceSSL = true; + locations."/nodes".tryFiles = "/index.html =404"; + root = pkgs.radicle-interface.override { + config = { + nodes = { + defaultHttpdPort = 443; + defaultLocalHttpdPort = 8080; + defaultHttpdScheme = "https"; + defaultNodePort = 8776; + pinned = [ { + baseUrl = { + hostname = "node.radicle.stuebinm.eu"; + port = 443; + scheme = "https"; + }; + } ]; + }; + reactions = ["👍" "👎" "😄" "🎉" "🙁" "🚀" "👀"]; + projects.pinned = [ { + name = "radicle-interface"; + id = "rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5"; + baseUrl = { + hostname = "seed.radicle.xyz"; + port = 443; + scheme = "https"; + }; + } ]; + }; + }; + }; + + systemd.services.radicle-httpd = { + enable = true; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Type = "simple"; + Restart = "always"; + MemoryMax = "1G"; + User = "radicle"; + Group = "radicle"; + }; + environment.RAD_HOME = "/var/lib/radicle"; + path = [ pkgs.heartwood pkgs.gitMinimal ]; + script = '' + cd /var/lib/radicle + radicle-httpd --listen 0.0.0.0:4444; + ''; + }; + + users.users.radicle = { + group = "radicle"; + isSystemUser = true; + }; + users.groups.radicle = {}; + + environment.systemPackages = [ pkgs.heartwood ]; +} diff --git a/flake.nix b/flake.nix index 80932c0..d5416be 100644 --- a/flake.nix +++ b/flake.nix @@ -140,7 +140,7 @@ galmon-core galmon-full glitchtip typst almanac rustex kijetesantakaluotokieni showrt isabelle-utils isabat travelynx crs-tracker crs-php bahnhof-name matrix-to - hikari_unstable; + hikari_unstable heartwood radicle-interface; }; nixosModules = { glitchtip = import ./modules/glitchtip.nix; }; diff --git a/home/packages.nix b/home/packages.nix index 8f17f94..72c6f2a 100644 --- a/home/packages.nix +++ b/home/packages.nix @@ -12,6 +12,7 @@ in # internet apps & clients firefox keepassxc mumble lynx thunderbird offpunk openconnect matterhorn tdesktop monolith magic-wormhole-rs + heartwood # graphics & audio audacity blender darktable kdenlive moc ffmpeg-full gimp-with-plugins inkscape krita meshlab pavucontrol moc diff --git a/pkgs/overlay.nix b/pkgs/overlay.nix index 7dc036e..59905f9 100644 --- a/pkgs/overlay.nix +++ b/pkgs/overlay.nix @@ -9,6 +9,7 @@ let cargo = self.rust-bin.stable.latest.minimal; rustc = self.rust-bin.stable.latest.minimal; }; + radicle = import ./radicle.nix; in { galmon-core = self.callPackage (import ./galmon.nix {}) {}; @@ -70,9 +71,7 @@ in version = "git"; src = inputs.isabelle-utils; cargoLock.lockFile = "${src}/Cargo.lock"; - checkPhase = " - echo skipping tests - "; + doCheck = false; }; isabat = import "${inputs.isabelle-utils}/isabat.nix" { @@ -114,4 +113,8 @@ in [ "PREFIX=$(out)" "WITH_POSIX_C_SOURCE=YES" "WITH_GAMMACONTROL=YES" "WITH_LAYERSHELL=YES" "WITH_SCREENCOPY=YES" ]; })).override { wlroots = unstable.wlroots_0_16; stdenv = self.clangStdenv; }; + + heartwood = self.callPackage radicle.heartwood { inherit (rustPlatform) buildRustPackage; }; + + radicle-interface = self.callPackage radicle.interface {}; } diff --git a/pkgs/radicle-remove-curl-script.patch b/pkgs/radicle-remove-curl-script.patch new file mode 100644 index 0000000..ea8905d --- /dev/null +++ b/pkgs/radicle-remove-curl-script.patch @@ -0,0 +1,23 @@ +From 5e1c17c4b14925ec3c0610e8557a19215ac8eb4e Mon Sep 17 00:00:00 2001 +From: stuebinm +Date: Wed, 11 Oct 2023 17:11:30 +0200 +Subject: [PATCH] remove curl invocation + +--- + scripts/install-twemoji-assets | 4 +--- + 3 files changed, 3 insertions(+), 5 deletions(-) + +diff --git a/scripts/install-twemoji-assets b/scripts/install-twemoji-assets +index 741a02e..6990ba5 100755 +--- a/scripts/install-twemoji-assets ++++ b/scripts/install-twemoji-assets +@@ -1,6 +1,4 @@ + version="$(node -e 'console.log(require("twemoji/package.json").version)')" + + echo "Installing Twemoji SVG assets v${version}" + +-curl -sSL "https://github.com/twitter/twemoji/archive/refs/tags/v${version}.tar.gz" \ +- | tar -x -z -C public/twemoji/ --strip-components=3 "twemoji-${version}/assets/svg" +-- +2.40.1 + diff --git a/pkgs/radicle.nix b/pkgs/radicle.nix new file mode 100644 index 0000000..ff65ecc --- /dev/null +++ b/pkgs/radicle.nix @@ -0,0 +1,47 @@ +let + interface = { lib, buildNpmPackage, fetchgit, bash, config ? null, ...}: buildNpmPackage { + pname = "radicle-interface"; + version = "git"; + src = fetchgit { + url = "https://seed.radicle.xyz/z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git"; + rev = "288f55da7667d0678d4c1abc248da2cff54891e4"; + hash = "sha256-bdXsK01mLrz4g8rVlMQfZDB+p7ldMIsTJP7jfGeobkM="; + }; + + patches = [ ./radicle-remove-curl-script.patch ]; + postPatch = '' + patchShebangs scripts/* + ${if config == null then "" else '' + rm -f src/config.json + echo ${lib.escapeShellArg (builtins.toJSON config)} > src/config.json + ''} + ''; + makeCacheWritable = true; + + installPhase = '' + mkdir -p $out + cp -r build/* $out + ''; + + buildInputs = [ bash ]; + + npmDepsHash = "sha256-jqkkqLGojMfk75Chm/CG46ZE+VBAkXTGntwyj3l06jw="; + }; + + heartwood = { buildRustPackage, fetchgit }: buildRustPackage rec{ + pname = "heartwood"; + version = "git"; + src = fetchgit { + url = "https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git"; + rev = "499738de711ee96343163550f2e053bdba248c1a"; + hash = "sha256-CnpiNynCtGEBpqcUCnTBR6T900bICyDTIp32T6RNQdo="; + }; + cargoLock.lockFile = "${src}/Cargo.lock"; + cargoBuildFlags = [ "--all" ]; + # tests seem to be a little nondeterministic, and sometimes hang + doCheck = false; + }; +in +{ + inherit interface heartwood; +} -- cgit v1.2.3