From 114b25322e6e690001ec3a3a25eb7cb6a2ff6d4f Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Tue, 21 Apr 2026 10:12:59 +0100 Subject: [PATCH] flake.nix: Update flake.nix The `flake.nix` file used `heartwood` as its source of truth for a lot of tooling. The `heartwood` library was pinned to its `1.0.0` version, causing issues when attempting run `nix develop`. Instead, modify the inputs to grab the tooling from their source of truth. The `heartwood` binaries can now be retrieved via the `radicle-node` entry in the Nix packages registry. --- flake.lock | 85 +++++------------------ flake.nix | 200 ++++++++++++++++++++++++++++++----------------------- 2 files changed, 132 insertions(+), 153 deletions(-) diff --git a/flake.lock b/flake.lock index dbbb328d2..a5f9ccc12 100644 --- a/flake.lock +++ b/flake.lock @@ -1,34 +1,12 @@ { "nodes": { - "advisory-db": { - "flake": false, - "locked": { - "lastModified": 1722017365, - "narHash": "sha256-9wYR5NZIgI+qzMDlJrUzevR31fvFQRgfjlYp50Xp3Ts=", - "owner": "rustsec", - "repo": "advisory-db", - "rev": "9d024c07ee8c18609b43436bc865abf46636e250", - "type": "github" - }, - "original": { - "owner": "rustsec", - "repo": "advisory-db", - "type": "github" - } - }, "crane": { - "inputs": { - "nixpkgs": [ - "heartwood", - "nixpkgs" - ] - }, "locked": { - "lastModified": 1722907532, - "narHash": "sha256-i/j/dMZPR7uJoQPFTa6UCahLu8kMtozYuR83lIKMERM=", + "lastModified": 1776635034, + "narHash": "sha256-OEOJrT3ZfwbChzODfIH4GzlNTtOFuZFWPtW7jIeR8xU=", "owner": "ipetkov", "repo": "crane", - "rev": "d0c8f4ed8571c533b31c1d68e4ebc534b790cc5c", + "rev": "dc7496d8ea6e526b1254b55d09b966e94673750f", "type": "github" }, "original": { @@ -42,11 +20,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -55,71 +33,42 @@ "type": "github" } }, - "heartwood": { - "inputs": { - "advisory-db": "advisory-db", - "crane": "crane", - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs", - "rust-overlay": "rust-overlay" - }, - "locked": { - "lastModified": 1725360130, - "narHash": "sha256-sb0GroWfZWC9YCGby88eiPnhFCdDA9EUhVpoyuAA+Mk=", - "ref": "refs/namespaces/z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT/refs/tags/v1.0.0", - "rev": "4218896764901bebeaeac6b7c1eaa2e798320cb1", - "revCount": 2100, - "type": "git", - "url": "https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git" - }, - "original": { - "ref": "refs/namespaces/z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT/refs/tags/v1.0.0", - "type": "git", - "url": "https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git" - } - }, "nixpkgs": { "locked": { - "lastModified": 1722940684, - "narHash": "sha256-X8JnSq0ruRWsU4PdYuxV+8W4W66F1lnCcxIZZMWzo4E=", + "lastModified": 1776760124, + "narHash": "sha256-rX4LyXNstQYJDywG5w8Qk+M+mn9id2oVNdQHncygf3c=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a3103d68517c6ad262ea27c96fc4a38ad81be7a0", + "rev": "3c01be97dcc435a5193fe1071b89fcfe00954959", "type": "github" }, "original": { "owner": "NixOS", - "ref": "release-24.05", + "ref": "release-25.11", "repo": "nixpkgs", "type": "github" } }, "root": { "inputs": { - "flake-utils": [ - "heartwood", - "flake-utils" - ], - "heartwood": "heartwood", - "nixpkgs": [ - "heartwood", - "nixpkgs" - ] + "crane": "crane", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" } }, "rust-overlay": { "inputs": { "nixpkgs": [ - "heartwood", "nixpkgs" ] }, "locked": { - "lastModified": 1722910815, - "narHash": "sha256-v6Vk/xlABhw2QzOa6xh3Jx/IvmlbKbOazFM+bDFQlWU=", + "lastModified": 1776741231, + "narHash": "sha256-k9G98qzn+7npROUaks8VqCFm7cFtEG8ulQLBBo5lItg=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "7df2ac544c203d21b63aac23bfaec7f9b919a733", + "rev": "02061303f7c4c964f7b4584dabd9e985b4cd442b", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 77ffde70b..48ce74ef5 100644 --- a/flake.nix +++ b/flake.nix @@ -1,28 +1,45 @@ { description = "Radicle web frontend"; + inputs = { - nixpkgs.follows = "heartwood/nixpkgs"; - flake-utils.follows = "heartwood/flake-utils"; - heartwood = { - url = "git+https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git?ref=refs/namespaces/z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT/refs/tags/v1.0.0"; + nixpkgs.url = "github:NixOS/nixpkgs/release-25.11"; + flake-utils.url = "github:numtide/flake-utils"; + + crane.url = "github:ipetkov/crane"; + + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { self, - heartwood, nixpkgs, flake-utils, + crane, + rust-overlay, ... - }@inputs: + }: { - nixosModules.radicle-explorer = { config, lib, pkgs, ... }: { + nixosModules.radicle-explorer = { + config, + lib, + pkgs, + ... + }: { options.services.radicle-explorer.enable = lib.mkEnableOption "Local radicle web interface"; config = lib.mkIf config.services.radicle-explorer.enable { services.nginx = { enable = true; virtualHosts.localhost = { - listen = [ { addr = "127.0.0.1"; port = 4433; ssl = false; } ]; + listen = [ + { + addr = "127.0.0.1"; + port = 4433; + ssl = false; + } + ]; rejectSSL = true; locations = { "/" = { @@ -37,27 +54,27 @@ }; }; }; - } // - - (flake-utils.lib.eachDefaultSystem (system: let + } + // (flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; - overlays = [(import heartwood.inputs.rust-overlay)]; + overlays = [(import rust-overlay)]; }; inherit (pkgs) lib; - rustToolChain = pkgs.rust-bin.fromRustupToolchainFile radicle-httpd/rust-toolchain; - craneLib = (heartwood.inputs.crane.mkLib pkgs).overrideToolchain rustToolChain; + rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./radicle-httpd/rust-toolchain; + craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain; basicArgs = { pname = "radicle-httpd"; src = ./radicle-httpd; strictDeps = true; }; in { + formatter = pkgs.alejandra; checks = { - radicle-explorer = self.packages.${system}.radicle-explorer.override { doCheck = true; }; - radicle-httpd = self.packages.${system}.radicle-httpd.overrideAttrs (_: { doCheck = true; }); + radicle-explorer = self.packages.${system}.radicle-explorer.override {doCheck = true;}; + radicle-httpd = self.packages.${system}.radicle-httpd.overrideAttrs (_: {doCheck = true;}); }; packages = { @@ -71,82 +88,95 @@ }; radicle-explorer = pkgs.callPackage ({ - lib, buildNpmPackage, doCheck ? false - }: buildNpmPackage rec { - pname = "radicle-explorer"; - version = (builtins.fromJSON (builtins.readFile ./package.json)).version; - src = ./.; - npmDepsHash = "sha256-RC+QQXtvXC48uM0oOAFA0ni5AU/l9m8k1LgrxykSu5M="; - postPatch = '' - patchShebangs --build ./scripts - mkdir -p "public/twemoji" - cp -t public/twemoji -r -- ${self.packages.${system}.twemoji-assets}/assets/svg/* - : >scripts/install-twemoji-assets - ''; - dontConfigure = true; + lib, + buildNpmPackage, + doCheck ? false, + }: + buildNpmPackage rec { + pname = "radicle-explorer"; + version = (builtins.fromJSON (builtins.readFile ./package.json)).version; + src = ./.; + npmDepsHash = "sha256-RC+QQXtvXC48uM0oOAFA0ni5AU/l9m8k1LgrxykSu5M="; + postPatch = '' + patchShebangs --build ./scripts + mkdir -p "public/twemoji" + cp -t public/twemoji -r -- ${self.packages.${system}.twemoji-assets}/assets/svg/* + : >scripts/install-twemoji-assets + ''; + dontConfigure = true; - inherit doCheck; - nativeCheckInputs = with pkgs; [ - which - gitMinimal - ]; - checkPhase = '' - runHook preCheck - bins=$(scripts/install-binaries -s) - mkdir -p "$bins" - cp -t "$bins" -- ${heartwood.packages.${system}.default}/bin/* ${self.checks.${system}.radicle-httpd}/bin/* - scripts/check - { - npm run test:unit - } | tee /dev/null - runHook postCheck - ''; + inherit doCheck; + nativeCheckInputs = with pkgs; [ + which + gitMinimal + ]; + checkPhase = '' + runHook preCheck + bins=$(scripts/install-binaries -s) + mkdir -p "$bins" + cp -t "$bins" -- ${pkgs.radicle-node}/bin/* ${self.packages.${system}.radicle-httpd}/bin/* + scripts/check + { + npm run test:unit + } | tee /dev/null + runHook postCheck + ''; - installPhase = '' - runHook preInstall - mkdir -p "$out" - cp -r -t "$out" build/* - runHook postInstall - ''; - }) {}; + installPhase = '' + runHook preInstall + mkdir -p "$out" + cp -r -t "$out" build/* + runHook postInstall + ''; + }) {}; - radicle-httpd = craneLib.buildPackage (basicArgs // { - inherit (craneLib.crateNameFromCargoToml {cargoToml = ./radicle-httpd + "/Cargo.toml";}) pname version; - cargoArtifacts = craneLib.buildDepsOnly basicArgs; + radicle-httpd = craneLib.buildPackage (basicArgs + // { + inherit (craneLib.crateNameFromCargoToml {cargoToml = ./radicle-httpd + "/Cargo.toml";}) pname version; + cargoArtifacts = craneLib.buildDepsOnly basicArgs; - nativeBuildInputs = with pkgs; - [ - git - # Add additional build inputs here - asciidoctor installShellFiles - ] - ++ lib.optionals pkgs.stdenv.isDarwin (with pkgs; [ - # Additional darwin specific inputs can be set here - libiconv - darwin.apple_sdk.frameworks.Security - ]); + nativeBuildInputs = with pkgs; + [ + git + asciidoctor + installShellFiles + ] + ++ lib.optionals pkgs.stdenv.isDarwin (with pkgs; [ + libiconv + darwin.apple_sdk.frameworks.Security + ]); - env = - { - RADICLE_VERSION = "nix-" + (self.shortRev or self.dirtyShortRev or "unknown"); - } - // ( - if self ? rev || self ? dirtyRev - then { - GIT_HEAD = self.rev or self.dirtyRev; + env = + { + RADICLE_VERSION = "nix-" + (self.shortRev or self.dirtyShortRev or "unknown"); } - else {} - ); + // ( + if self ? rev || self ? dirtyRev + then { + GIT_HEAD = self.rev or self.dirtyRev; + } + else {} + ); - cargoExtraArgs = "-p radicle-httpd"; - doCheck = false; - postInstall = '' - for page in radicle-httpd.1.adoc; do - asciidoctor -d manpage -b manpage $page - installManPage ''${page::-5} - done - ''; - }); + cargoExtraArgs = "-p radicle-httpd"; + doCheck = false; + postInstall = '' + for page in radicle-httpd.1.adoc; do + asciidoctor -d manpage -b manpage $page + installManPage ''${page::-5} + done + ''; + }); + }; + + devShells.default = pkgs.mkShell { + packages = with pkgs; [ + cargo-watch + nodejs_22 + radicle-node + rust-analyzer + rustToolchain + ]; }; })); }