flake: Add NixOS tests to checks
This commit is contained in:
parent
767b80e7fe
commit
9158df5067
87
flake.nix
87
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 {};
|
||||
|
|
@ -388,5 +408,18 @@
|
|||
# the simulation justfile to symlink into a location talosctl can find.
|
||||
env.OVMF_FD_PATH = "${pkgs.OVMF.fd}/FV";
|
||||
};
|
||||
});
|
||||
})
|
||||
// {
|
||||
overlays = {
|
||||
default = final: prev: {
|
||||
radicle-node = prev.radicle-node.overrideAttrs (finalAttrs: prevAttrs: {
|
||||
inherit version;
|
||||
src = mkSrc final;
|
||||
cargoDeps = final.rustPlatform.importCargoLock {
|
||||
lockFile = ./Cargo.lock;
|
||||
};
|
||||
});
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue