Commit Graph

34 Commits

Author SHA1 Message Date
Aaron Würth 537eaba8d1 Use rust-analyzer from tool chain in devShell
The devShell now uses rust-analyzer from the tool chain. Previously,
using the nixpkgs rust-analyzer (from an older rust version) led to
inaccurate results.
2026-02-10 11:06:05 +00:00
Lorenz Leutgeb 11cbc2e515 hooks: Run "pre-push" by default 2025-11-04 14:04:24 +00:00
Yaroslav Halchenko f7e57361dc hooks: Add codespell
Co-authored-by: Lorenz Leutgeb <lorenz.leutgeb@radicle.xyz>
2025-11-01 12:06:08 +01:00
Lorenz Leutgeb 44efdc02f9
flake: Fix source filtering
The more complicated filter for `*.txt` did not work. Filtering by
extension directly is not as precise, but there are not many `*.txt`
files in this repository anyway, so the difference should be
neglegible.
2025-10-17 13:00:30 +02:00
Lorenz Leutgeb 837f4694df
hook: Add check for `git2` in `radicle`
Extend facilities for `rg` based hook generation to also cover includes
and excludes, then add a hook that helps catch usage of `git2` in the
`radicle` crate, *with the exception of* `…/raw.rs`.

At the same time, these hooks are also enabled to run pre-push, as they
are very quick, just for convenience of Jujutsu users, because Jujutsu
currently does not support Git's commit hooks.
2025-10-10 11:29:24 +02:00
Lorenz Leutgeb 0095fdc585 flake: Keep `crates/**/*.txt` files for build
Fix builds broken due to `include_str!` failing to read a text file.
2025-10-02 15:45:22 +01:00
Lorenz Leutgeb 9954a79490
flake: Add binary cache configuration
Advertise our own binary cache a bit more.
2025-10-02 13:04:28 +02:00
Lorenz Leutgeb 731688d3f2 flake: Install Jujutsu for testing 2025-09-26 12:03:01 +01:00
Lorenz Leutgeb 9b7529baa7 hooks: Filter for "radicle.{xyz,zulipchat.com}"
This hook should make people think before committing domain names
like "radicle.xyz" and "radicle.zulipchat.com" to our Rust code.

Note that these checks can be easily skipped as follows:

    SKIP=grep-radicle.xyz,grep-radicle.zulipchat.com git commit …

See also <https://pre-commit.com/#temporarily-disabling-hooks>
2025-09-04 16:44:05 +03:00
Lorenz Leutgeb d7aa2d9da2 flake/hooks: Reconfigure Git Hooks
1. Introduce a new hook to run `cargo doc` in the "pre-commit"
    phase. We have to resort to wrapping the command in a shell
    script, since we cannot configure environment variables via
    `.pre-commit.yaml` but need `RUSTDOCFLAGS` so that `cargo doc`
    actually exists non-zero when there are warnings.
 2. Move `cargo check` from the "pre-push" to the "pre-commit"
    phase, as it is relatively quick, and redundant to run before
    `clippy`.
 3. Let `cargo check` and `cargo doc` run after `rustfmt`.
 4. Let a failure of `rustfmt` fail the whole check.
 5. Wire through `packageOverrides` to `rustfmt` so we use the
    same toolchain as the other tools.
 6. Additionally enable `cargo clippy` to consider all features.
2025-08-25 21:51:01 +02:00
Fintan Halpenny 11d29b280a nix: Update nix packages to 25.05 2025-08-12 08:38:57 +01:00
Lorenz Leutgeb db3b3b0548 flake: Delete Apps
Nix Flake Apps are used by `nix run`, but none of the defined apps are
useful to run "one off" anyways.
2025-07-09 12:54:03 +01:00
Lorenz Leutgeb deb823f3b3 flake: Fix path to crates
This is a fix after my oversight of adjusting the path alongside
5bc2dc677b.
2025-06-24 23:04:23 +02:00
Fintan Halpenny f4c8ff7a64 chore: prepare crates release
This prepares the crate versions for a new release. The version bumps were
determined by the `cargo-semver-checks` tool.

However, there were some issues with the `radicle-fetch` crate – where when
attempting to check it, it was unable to compile due to the previous version
expecting the kind of `Doc` with a generic parameter. I believe this is due to
the version for `radicle` being specified as simply `0`. This prompted changing
the version specifications to use `major.minor` for all the internal crates.
This, for example, would mean that `radicle-fetch` that relies on `0.15` can use
`>=0.15.0,<0.16.0` – allowing any patch versions but must require a minor
version bump.
2025-05-30 12:58:18 +02:00
Lorenz Leutgeb ee12f76cbe cli/tests: Fix nextest running via Nix 2025-05-22 10:25:59 +02:00
Lorenz Leutgeb 41f9048d96 nix: Add flake check that builds at MSRV 2025-05-16 13:49:38 +02:00
Lorenz Leutgeb 59a1021410 hook: Make `cargo check` and `cargo clippy` only execute pre-push
These hook take relatively long on my machine, and my impatience has
lead to me doing `git commit --no-verify`, which defeats the purpose of
having these hooks.

Note that others (like `alejandra`, `cargo fmt` and `shellcheck`) are
reasonably fast and will keep doing good.
2025-05-07 13:56:55 +01:00
Lorenz Leutgeb e4d23fe56a
cli: Introduce `cob [create|update]` 2025-04-28 16:19:02 +02:00
Lorenz Leutgeb ce07e92a2e
Add Git pre-commit hooks via Nix 2025-04-22 15:43:02 +02:00
Fintan Halpenny 170915ffcf nix: Nix flake maintenance
The nix flake's checks were failing for various reasons. The following fixes are
applied to get it up to date again.

- Update to release-24.11, since `crane` requires it – also to keep up-to-date
- Add `.json` to the source filters to allow for testing patch migration
- Ensure that the `rad` and `git-remote-rad` binaries are built for the nextest
  check. N.b. the binaries need to be in the target dir of `radicle-cli` since
  that is where the nextest check runs from.
- Add `cargo-audit` and `cargo-deny`, to the devShell, to allow for running those
  tools locally
- Bump `gix-path` to 0.10.11 to avoid a vulnerability[^0]

[^0]: https://rustsec.org/advisories/RUSTSEC-2024-0371
2025-04-10 15:29:08 +02:00
Lorenz Leutgeb 4b955fff15
nix: Fix macOS build 2024-09-12 17:50:06 +02:00
Lorenz Leutgeb 0dd06b91c1
nix: Correctly set `RUST_SRC_DIR` 2024-08-22 11:12:10 +01:00
Lorenz Leutgeb b398e54b83
nix: Update flake to get to reach Rust 1.80 2024-08-22 11:12:09 +01:00
cloudhead a4989b7ce7
Remove `radicle-httpd` crate
The HTTP daemon is moved to the `radicle-explorer` repository. Hence,
all traces of it are removed from this repository.
2024-06-06 11:14:00 +02:00
Lorenz Leutgeb b2992814b6
nix: Polish `flake.nix`
* Remove empty `inherit`s

  These were not doing anything.

      { inherit (f) x; }

  is equivalent to

      { x = f.x; }

  but

      { inherit (f); }

  is equivalent to

      {}

  since there is no attribute name given.

* Refactor `srcFilters` to use `any`

  That's more lighweight and easier to extend.

* Use `installShellFiles` for `buildManPages`
* Produce a more stable version
* Move package `radicle` next to the others

  It's nothing special!

* Refactor Flake

  More code reuse, and a little more direct, basically.

* Set environment variable on derivation
* Compress even more by removing special crate
* Use `with pkgs` before lists of packages
* Use system-independent `lib`
* Clean up
* Update `flake.lock`
* Enable checks `audit`, `deny`
2024-05-17 12:19:30 +02:00
cloudhead cf8f262cb2
man: Add `rad-id.1` man page 2024-03-17 21:14:58 +01:00
Timm Behner 00102beb29
nix: Fix linker error on macos 14.3 with nix build
Using nix build resulted in a linker error

ld: framework not found Security

Following the proposed solution in
https://discourse.nixos.org/t/compile-a-rust-binary-on-macos-dbcrossbar/8612
resolves the issue.
2024-03-08 23:40:09 +01:00
Michael Raitza 4b1ca18d0c
nix: Compile commit hash into program version
Changes build.rs to take the GIT_HEAD environment variable into account
if `git rev-parse` is unable to determine the current commit hash.
2024-03-08 23:37:34 +01:00
Michael Raitza fb13e5f970
nix: Install man pages when building from flake 2024-03-08 23:35:45 +01:00
Fintan Halpenny 64fd41961e
nix: add radicle-full
To allow Nix users to install radicle with all tools and helpers.
2024-03-08 23:19:15 +01:00
Fintan Halpenny e1affc2da6
nix: use rust-overlay for toolchain pinning
To ensure the Nix derivations are using the correct toolchain, defined
in the `rust-toolchain` file, use the `rust-overlay` library.

Also remove the `fenix` input, since this was actually never used and
was an artefact of some copy-paste shenanigans.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-03-08 23:19:15 +01:00
Fintan Halpenny 150130e99b
nix: add sqlite in devShell
Since sqlite is used for the databases, including the sqlite3 binary
in the devShell is useful for debugging purposes.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-01-02 15:23:08 +01:00
Fintan Halpenny 4afe235a3c
nix: simplify devShell and envrc
There is no need for the ';' in the `.envrc` file.

Do not run checks in devShell so that it's possible to enter the shell
while code is being edited and is not compiling. Also include
`cargo-nextest` so that one can test in the shell.

Signed-off-by: Fintan Halpenny <Fintan Halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-12-14 10:52:04 +01:00
Fintan Halpenny 9f544ef8c1
nix: switch to use nix flakes
Nix Flakes[[0]] are a more modular way of expressing nix derivations.

The `flake.nix` file describes:
- How to build the project, or components of a projet, via `nix build`
- What "checks" can run for a project, which can be executed via
  `nix flake check`
- What binaries can be run, e.g. `nix run .#rad` to execute the CLI

This approach is preferable since a lot of the Nix ecosystem is using
Flakes -- despite it still being marked as experimental.

One interesting benefit, that needs confirming, is that a check can be
run from a remote Git source. So if someone creates a patch on
Radicle, someone else with the `nix` binary can execute:

         nix flake check git+https://app.radicle.xyz/nodes/seed.radicle.xyz/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5?refs=patches/<patch id>

This means that anyone with `nix` can check patches without having to
fetch the patch itself.

Another obvious benefit will be that it allows the Radicle binaries to
enter the Nix ecosystem.

The big caveat to both of the above is that, currently, the tests are
failing while running `nix flake check`. They are currently disabled
with `doCheck = false`. They are potentially failing due to some
strange sandboxing issues which are being looked into.

[0]: https://nixos.wiki/wiki/Flakes

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-12-13 12:25:12 +01:00