Radish alpha
r
rad:z254T5p17bdFPmzfDojsdjo4HjpoZ
Radicle Infrastructure as Code (NixOS, OpenTofu, …)
Radicle
Git
flake: Remove dependency on radicle-nix
Lorenz Leutgeb committed 8 months ago
commit 10393fc636a4528ad34d12999dd6be7883800f1c
parent 715b374
5 files changed +90 -47
modified README.md
@@ -4,32 +4,30 @@ Easing the deployment of Radicle seed nodes with the magic of Nix 🌱 ➕ ❄

## Deployment

-
Using `radicle-nix` (`rad:zTGn5tnYJgF8qd6KDuodURvUvwLe`) we can easily deploy
-
seed nodes to target hosts.
-

-
To update the version of `radicle-node` package, changes are made in
-
`radicle-nix`. To reflect those changes in `radicle-infra`, first update the
-
Flake input:
+
Then to deploy to the target, for example `seed.radicle.xyz`, use the following
+
command. You might have to adjust the value of `$USER` if the username on your
+
local machine does not match the username of your account on the target machine.
+
Also, note that you may have to get permission to be added as a user first:

```
-
nix flake lock --update-input radicle
+
HOST=seed.radicle.xyz; nixos-rebuild switch --target-host "${USER}@${HOST}" --build-host "${USER}@${HOST}" --use-remote-sudo --flake .
```

+
### Overlays
+

+
To deploy a versions of packages that are not upstreamed (e.g. pre-releases),
+
use the overlays in `./overlay`.
+

Then the following option should be changed in `os/host/seed/radicle.nix`:

```nix
{pkgs, ...}: {
-
  services.radicle.package = pkgs.radicle-node-1_2;
-
}
-
```
+
  # Use Nixpkgs
+
  services.radicle.package = pkgs.radicle-node;

-
Then to deploy to the target, for example `seed.radicle.xyz`, use the following
-
command. You might have to adjust the value of `$USER` if the username on your
-
local machine does not match the username of your account on the target machine.
-
Also, note that you may have to get permission to be added as a user first:
-

-
```
-
HOST=seed.radicle.xyz; nixos-rebuild switch --target-host "${USER}@${HOST}" --build-host "${USER}@${HOST}" --use-remote-sudo --flake .
+
  # Use overlaid version.
+
  services.radicle.package = pkgs.radicle-node-overlay;
+
}
```

## DNS
modified flake.lock
@@ -87,6 +87,7 @@
    "crane": {
      "inputs": {
        "nixpkgs": [
+
          "lorenz",
          "radicle",
          "radicle-tui",
          "nixpkgs"
@@ -129,6 +130,7 @@
    "dream2nix": {
      "inputs": {
        "nixpkgs": [
+
          "lorenz",
          "radicle",
          "nixpkgs"
        ],
@@ -303,10 +305,8 @@
        "pre-commit-hooks": [
          "pre-commit-hooks"
        ],
-
        "radicle": [
-
          "radicle"
-
        ],
-
        "rust-overlay": "rust-overlay",
+
        "radicle": "radicle",
+
        "rust-overlay": "rust-overlay_2",
        "sbt": "sbt",
        "sops": [
          "sops"
@@ -474,6 +474,7 @@
      "inputs": {
        "flake-compat": "flake-compat",
        "nixpkgs": [
+
          "lorenz",
          "radicle",
          "dream2nix",
          "nixpkgs"
@@ -569,19 +570,24 @@
      "inputs": {
        "dream2nix": "dream2nix",
        "flake-utils": [
+
          "lorenz",
          "utils"
        ],
        "nixpkgs": [
+
          "lorenz",
          "nixpkgs"
        ],
        "nixpkgs-stable": [
+
          "lorenz",
          "nixpkgs-stable"
        ],
        "pre-commit-hooks": [
+
          "lorenz",
          "pre-commit-hooks"
        ],
        "radicle-tui": "radicle-tui",
        "sops-nix": [
+
          "lorenz",
          "sops"
        ],
        "systems": "systems_2"
@@ -605,14 +611,16 @@
        "advisory-db": "advisory-db",
        "crane": "crane",
        "flake-utils": [
+
          "lorenz",
          "radicle",
          "flake-utils"
        ],
        "nixpkgs": [
+
          "lorenz",
          "radicle",
          "nixpkgs"
        ],
-
        "rust-overlay": "rust-overlay_2"
+
        "rust-overlay": "rust-overlay"
      },
      "locked": {
        "lastModified": 1744642603,
@@ -643,7 +651,6 @@
        "nixpkgs-stable": "nixpkgs-stable",
        "nixpkgs-unstable": "nixpkgs-unstable",
        "pre-commit-hooks": "pre-commit-hooks",
-
        "radicle": "radicle",
        "sops": "sops",
        "utils": "utils"
      }
@@ -652,15 +659,17 @@
      "inputs": {
        "nixpkgs": [
          "lorenz",
+
          "radicle",
+
          "radicle-tui",
          "nixpkgs"
        ]
      },
      "locked": {
-
        "lastModified": 1750127910,
-
        "narHash": "sha256-FIgEIS0RAlOyXGqoj/OufTfcKItYq668yPYL4SXdU0M=",
+
        "lastModified": 1723170066,
+
        "narHash": "sha256-SFkQfOA+8AIYJsPlQtxNP+z5jRLfz91z/aOrV94pPmw=",
        "owner": "oxalica",
        "repo": "rust-overlay",
-
        "rev": "45418795a73b77b7726c62ce265d68cf541ffb49",
+
        "rev": "fecfe4d7c96fea2982c7907997b387a6b52c1093",
        "type": "github"
      },
      "original": {
@@ -672,17 +681,16 @@
    "rust-overlay_2": {
      "inputs": {
        "nixpkgs": [
-
          "radicle",
-
          "radicle-tui",
+
          "lorenz",
          "nixpkgs"
        ]
      },
      "locked": {
-
        "lastModified": 1723170066,
-
        "narHash": "sha256-SFkQfOA+8AIYJsPlQtxNP+z5jRLfz91z/aOrV94pPmw=",
+
        "lastModified": 1750127910,
+
        "narHash": "sha256-FIgEIS0RAlOyXGqoj/OufTfcKItYq668yPYL4SXdU0M=",
        "owner": "oxalica",
        "repo": "rust-overlay",
-
        "rev": "fecfe4d7c96fea2982c7907997b387a6b52c1093",
+
        "rev": "45418795a73b77b7726c62ce265d68cf541ffb49",
        "type": "github"
      },
      "original": {
@@ -719,6 +727,7 @@
    "slimlock": {
      "inputs": {
        "nixpkgs": [
+
          "lorenz",
          "radicle",
          "dream2nix",
          "purescript-overlay",
modified flake.nix
@@ -24,17 +24,6 @@
      inputs.nixpkgs.follows = "nixpkgs";
    };

-
    radicle = {
-
      url = "github:radicle-nix/radicle-nix";
-
      inputs = {
-
        sops-nix.follows = "sops";
-
        flake-utils.follows = "utils";
-
        nixpkgs-stable.follows = "nixpkgs-stable";
-
        nixpkgs.follows = "nixpkgs";
-
        pre-commit-hooks.follows = "pre-commit-hooks";
-
      };
-
    };
-

    compat.url = "github:edolstra/flake-compat";
    sops = {
      url = "github:Mic92/sops-nix";
@@ -64,7 +53,6 @@
        compat.follows = "compat";
        utils.follows = "utils";
        pre-commit-hooks.follows = "pre-commit-hooks";
-
        radicle.follows = "radicle";
      };
    };
  };
@@ -78,7 +66,6 @@
    nixpkgs,
    nixpkgs-unstable,
    pre-commit-hooks,
-
    radicle,
    sops,
    ...
  }: let
@@ -142,7 +129,7 @@
              };
              nixpkgs = {
                overlays = [
-
                  radicle.overlays.master
+
                  (import ./overlay/radicle-node.nix)
                ];
                config.allowUnfree = true;
              };
modified os/mixin/radicle.nix
@@ -6,7 +6,7 @@
}: {
  services.radicle = {
    enable = true;
-
    package = pkgs.radicle-node-1_4_0-rc_1;
+
    package = pkgs.radicle-node-overlay;
    privateKeyFile = "/etc/ssh/ssh_host_ed25519_key";
    publicKey = "/etc/ssh/ssh_host_ed25519_key.pub";
    settings = {
@@ -51,7 +51,6 @@

    httpd = {
      enable = true;
-
      package = pkgs.radicle-httpd-master;
      nginx = {
        addSSL = true;
        enableACME = true;
added overlay/radicle-node.nix
@@ -0,0 +1,50 @@
+
final: prev: (let
+
  version = "1.4.0-rc.1";
+
  overlayRustPackage = {
+
    final,
+
    prev,
+
    old,
+
    new ? old,
+
    override,
+
  }: {
+
    ${new} = final.callPackage prev.${old}.override {
+
      rustPlatform =
+
        final.rustPlatform
+
        // {
+
          buildRustPackage = args:
+
            final.rustPlatform.buildRustPackage (
+
              args
+
              // (override args)
+
            );
+
        };
+
    };
+
  };
+
in
+
  overlayRustPackage rec {
+
    inherit final prev;
+
    old = "radicle-node";
+
    new = "${old}-overlay";
+

+
    override = args: {
+
      inherit version;
+
      name = new;
+
      env.RADICLE_VERSION = version;
+

+
      src = final.fetchgit {
+
        inherit (args.src) url;
+
        tag = "releases/${version}";
+
        hash = "sha256-jGh8ZZPmElmLCspWvR3gBAOQXX0vtXKsVAzqr32uWpQ=";
+
        leaveDotGit = true;
+
        postFetch = ''
+
          git -C $out rev-parse HEAD > $out/.git_head
+
          git -C $out log -1 --pretty=%ct HEAD > $out/.git_time
+
          rm -rf $out/.git
+
        '';
+
      };
+

+
      cargoHash = "sha256-64SDz0wHKcp/tPGDDOlCRFr3Z1q6cWOafhP0howSFhA=";
+

+
      doCheck = false;
+
      passthru = {};
+
    };
+
  })