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.
This commit is contained in:
Fintan Halpenny
2026-04-21 17:08:57 +01:00
parent 1884084e12
commit 114b25322e
2 changed files with 132 additions and 153 deletions
+115 -85
View File
@@ -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
];
};
}));
}