mirror of
https://seed.radicle.dev/rad:z3trNYnLWS11cJWC6BbxDs5niGo82.git
synced 2026-10-31 00:41:02 +08:00
Building on the work that Lorenz Leutgeb did in patch
rad:z3trNYnLWS11cJWC6BbxDs5niGo82/patch/19ba16634fbde97156255ed97069d0aa3ab2bf12,
the URI scheme is brought to a final RIP document, with full ABNF and Nearley
grammars as well as examples, and a couple of scripts to extract and test those
grammars against those examples.
Compared to the URL scheme in RIP 3, this RIP brings a subtly different URL form,
while also supporting the RIP 3 scheme (now considered legacy). In short, these
two forms are supported by this RIP:
- rad://{rid}/{nid} (considered legacy)
- rad://{rad-auth}/{rid}[/{namespace}][/{resource-type-and-identifier}]
(rad-auth is the authority part, which can take the form of {nid}@{host-and-port}
or parts thereof)
This works, because the {rid} and the {nid} are distinguishable, as a {nid} always
starts with z6Mk, while a {rid} does start with a z, but never with z6Mk, and they
have different lengths (a {rid} is always 28 or 29 characters long, which a {nid}
is always 48 characters long).
Co-authored-by: Fintan Halpenny <fintan.halpenn@gmail.com>
Co-authored-by: Lorenz Leutgeb <lorenz.leutgeb@radicle.dev>
55 lines
1.2 KiB
Nix
55 lines
1.2 KiB
Nix
{
|
|
description = "RIPs development environment";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = {
|
|
nixpkgs,
|
|
flake-utils,
|
|
...
|
|
}:
|
|
flake-utils.lib.eachDefaultSystem (system: let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
nearley = pkgs.buildNpmPackage {
|
|
pname = "nearley";
|
|
version = "2.20.1";
|
|
src = ./nix/nearley;
|
|
npmDepsHash = "sha256-a0RjAhSlzEbe6tM6QsZa06xKc0uzEe0cK6OsuVQSSzo=";
|
|
dontNpmBuild = true;
|
|
};
|
|
in {
|
|
devShells.default = pkgs.mkShell {
|
|
buildInputs =
|
|
(with pkgs; [
|
|
asciidoctor
|
|
nodejs
|
|
shellcheck
|
|
yq
|
|
])
|
|
++ [
|
|
nearley
|
|
];
|
|
};
|
|
|
|
checks.grammar =
|
|
pkgs.runCommand "grammar-check" {
|
|
nativeBuildInputs =
|
|
(with pkgs; [
|
|
nearley
|
|
nodejs
|
|
yq
|
|
])
|
|
++ [
|
|
nearley
|
|
];
|
|
} ''
|
|
${./0004-general-uri-scheme/data/test/uri-scheme-tester.sh} ${./0004-general-uri-scheme/data}
|
|
touch $out
|
|
'';
|
|
});
|
|
}
|