Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
flake: Add NixOS tests to checks
✓ CI success Lorenz Leutgeb committed 19 hours ago
commit cdd3e104a07579ffd1b4ebf7353a556ef097b79f
parent a3a681fd518da2c761e85cd85e7565ab7d539b2f
1 passed (1 total) View logs
1 file changed +60 -27
modified flake.nix
@@ -34,22 +34,47 @@

  outputs = {
    self,
-

    advisory-db,
    crane,
    flake-utils,
    nixpkgs,
+
    nixpkgs-stable,
+
    nixpkgs-unstable,
    rust-overlay,
-

    ...
-
  } @ inputs:
+
  } @ inputs: let
+
    version = "nix-" + (self.shortRev or self.dirtyShortRev or "unknown");
+

+
    lib = nixpkgs.lib;
+

+
    srcFilters = pkgs: path: type:
+
      builtins.any (suffix: lib.hasSuffix suffix path) [
+
        ".sql" # schemas
+
        ".diff" # testing
+
        ".md" # testing
+
        ".adoc" # man pages
+
        ".json" # testing samples
+
        ".txt" # might be included with `include_str!`
+
        "rad-cob-multiset" # testing external COBs
+
      ]
+
      ||
+
      # Default filter from crane (allow .rs files)
+
      ((crane.mkLib pkgs).filterCargoSources path type);
+

+
    mkSrc = pkgs:
+
      lib.cleanSourceWith {
+
        src = ./.;
+
        filter = srcFilters pkgs;
+
      };
+
  in
    flake-utils.lib.eachDefaultSystem (system: let
-
      lib = nixpkgs.lib;
      pkgs = import nixpkgs {
        inherit system;
        overlays = [(import rust-overlay)];
      };

+
      src = mkSrc pkgs;
+

      msrv = let
        msrv = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).workspace.package.rust-version;
      in rec {
@@ -72,27 +97,8 @@
        commonArgs = mkCommonArgs craneLib;
      };

-
      srcFilters = path: type:
-
        builtins.any (suffix: lib.hasSuffix suffix path) [
-
          ".sql" # schemas
-
          ".diff" # testing
-
          ".md" # testing
-
          ".adoc" # man pages
-
          ".json" # testing samples
-
          ".txt" # might be included with `include_str!`
-
          "rad-cob-multiset" # testing external COBs
-
        ]
-
        ||
-
        # Default filter from crane (allow .rs files)
-
        (rustup.craneLib.filterCargoSources path type);
-

-
      src = lib.cleanSourceWith {
-
        src = ./.;
-
        filter = srcFilters;
-
      };
-

      basicArgs = {
-
        inherit src;
+
        src = mkSrc pkgs;
        pname = "Heartwood";
        strictDeps = true;
      };
@@ -120,7 +126,7 @@

          env =
            {
-
              RADICLE_VERSION = "nix-" + (self.shortRev or self.dirtyShortRev or "unknown");
+
              RADICLE_VERSION = version;
            }
            // (
              if self ? rev || self ? dirtyRev
@@ -331,7 +337,21 @@
              env.CARGO_PROFILE = "dev";
              cargoNextestExtraArgs = "--no-capture";
            });
-
        };
+
        }
+
        // (
+
          let
+
            nixos = nixpkgs:
+
              (import nixpkgs {
+
                inherit system;
+
                overlays = [
+
                  self.overlays.default
+
                ];
+
              }).radicle-node.tests.nixos-run;
+
          in {
+
            nixos-stable = nixos nixpkgs-stable;
+
            nixos-unstable = nixos nixpkgs-unstable;
+
          }
+
        );

      packages = let
        crates = buildCrates {};
@@ -375,5 +395,18 @@
          RUST_SRC_PATH = "${rustupDevShell.toolchain}/lib/rustlib/src/rust/library";
        };
      };
-
    });
+
    })
+
    // {
+
      overlays = {
+
        default = final: prev: {
+
          radicle-node = prev.radicle-node.overrideAttrs (finalAttrs: prevAttrs: {
+
            inherit version;
+
            src = mkSrc final;
+
            cargoDeps = final.rustPlatform.importCargoLock {
+
              lockFile = ./Cargo.lock;
+
            };
+
          });
+
        };
+
      };
+
    };
}