healthchecks-rs/flake.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

178 lines
5.0 KiB
Nix
Raw Permalink Normal View History

2022-12-28 12:51:37 +05:30
{
description = "healthchecks-rs monorepo";
2024-05-11 11:56:45 +05:30
inputs.nixpkgs.url = "github:msfjarvis/nixpkgs/nixpkgs-unstable";
2022-12-28 12:51:37 +05:30
inputs.systems.url = "github:msfjarvis/flake-systems";
inputs.advisory-db.url = "github:rustsec/advisory-db";
inputs.advisory-db.flake = false;
2022-12-28 12:51:37 +05:30
inputs.crane.url = "github:ipetkov/crane";
inputs.crane.inputs.nixpkgs.follows = "nixpkgs";
inputs.devshell.url = "github:numtide/devshell";
inputs.devshell.inputs.nixpkgs.follows = "nixpkgs";
2024-01-31 11:26:49 +05:30
inputs.devshell.inputs.flake-utils.follows = "flake-utils";
inputs.fenix.url = "github:nix-community/fenix/staging";
inputs.fenix.inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.flake-utils.inputs.systems.follows = "systems";
2022-12-28 12:51:37 +05:30
inputs.flake-compat.url = "github:nix-community/flake-compat";
inputs.flake-compat.flake = false;
# Keep in sync with healthchecks/Cargo.toml
inputs.rust-msrv.url = "https://static.rust-lang.org/dist/channel-rust-1.64.0.toml";
inputs.rust-msrv.flake = false;
2022-12-28 12:51:37 +05:30
outputs = {
nixpkgs,
devshell,
fenix,
2022-12-28 12:51:37 +05:30
crane,
flake-utils,
advisory-db,
rust-msrv,
2022-12-28 12:51:37 +05:30
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [devshell.overlays.default];
};
2022-12-28 12:51:37 +05:30
rustStable = (import fenix {inherit pkgs;}).fromToolchainFile {
file = ./rust-toolchain.toml;
2024-04-10 22:05:07 +05:30
sha256 = "sha256-7QfkHty6hSrgNM0fspycYkRcB82eEqYa4CoAJ9qA3tU=";
};
rustMsrv = (fenix.packages.${system}.fromManifestFile rust-msrv).minimalToolchain;
2022-12-28 12:51:37 +05:30
craneLib = (crane.mkLib pkgs).overrideToolchain rustStable;
markdownFilter = path: _type: builtins.match ".*md$" path != null;
markdownOrCargo = path: type:
(markdownFilter path type) || (craneLib.filterCargoSources path type);
2022-12-28 12:51:37 +05:30
commonArgs = {
src = pkgs.lib.cleanSourceWith {
src = craneLib.path ./.;
filter = markdownOrCargo;
};
2022-12-28 12:51:37 +05:30
buildInputs = [];
nativeBuildInputs = [];
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
# https://github.com/ipetkov/crane/issues/312
extraDummyScript = "rm -f $(find $out | grep bin/crane-dummy/main.rs)";
2022-12-28 12:51:37 +05:30
};
hcctlName = craneLib.crateNameFromCargoToml {
cargoToml = ./hcctl/Cargo.toml;
};
healthchecksName = craneLib.crateNameFromCargoToml {
cargoToml = ./healthchecks/Cargo.toml;
};
monitorName = craneLib.crateNameFromCargoToml {
cargoToml = ./monitor/Cargo.toml;
2022-12-28 12:51:37 +05:30
};
workspaceName = {
version = "1.0.0";
pname = "healthchecks-rs";
};
audit = craneLib.cargoAudit (commonArgs
// {
inherit advisory-db;
inherit (workspaceName) pname version;
});
2022-12-28 12:51:37 +05:30
cargoArtifacts = craneLib.buildDepsOnly (commonArgs
// {
inherit (workspaceName) pname version;
2022-12-28 12:51:37 +05:30
});
fmt = craneLib.cargoFmt (commonArgs
// {
inherit (workspaceName) pname version;
});
2024-03-26 16:34:16 +05:30
2022-12-28 12:51:37 +05:30
hcctl = craneLib.buildPackage (
commonArgs
// {
inherit (hcctlName) pname version;
inherit cargoArtifacts;
2024-03-26 16:34:16 +05:30
cargoExtraArgs = "-p hcctl";
doCheck = false;
2022-12-28 12:51:37 +05:30
}
);
monitor = craneLib.buildPackage (
commonArgs
// {
inherit (monitorName) pname version;
inherit cargoArtifacts;
2024-03-26 16:34:16 +05:30
cargoExtraArgs = "-p healthchecks-monitor";
doCheck = false;
2022-12-28 12:51:37 +05:30
}
);
2024-03-26 16:34:16 +05:30
workspace = craneLib.buildPackage (
2022-12-28 12:51:37 +05:30
commonArgs
// {
inherit (healthchecksName) pname version;
inherit cargoArtifacts;
doCheck = false;
2022-12-28 12:51:37 +05:30
}
);
2024-03-26 16:34:16 +05:30
workspace-clippy = craneLib.cargoClippy (commonArgs
// {
inherit (healthchecksName) pname version;
inherit cargoArtifacts;
});
workspace-nextest = craneLib.cargoNextest (commonArgs
2022-12-28 12:51:37 +05:30
// {
inherit (healthchecksName) pname version;
inherit cargoArtifacts;
2022-12-28 12:51:37 +05:30
partitions = 1;
partitionType = "count";
});
healthchecks-msrv = ((crane.mkLib pkgs).overrideToolchain rustMsrv).buildPackage (commonArgs
// {
inherit (healthchecksName) version;
2022-12-28 12:51:37 +05:30
pname = "healthchecks-msrv";
2024-03-26 16:34:16 +05:30
cargoExtraArgs = "-p healthchecks";
2022-12-28 12:51:37 +05:30
doCheck = false;
});
in {
checks = {
2024-03-26 16:34:16 +05:30
inherit audit fmt workspace workspace-clippy healthchecks-msrv workspace-nextest;
2022-12-28 12:51:37 +05:30
};
2024-03-26 16:34:16 +05:30
packages = {
inherit hcctl monitor;
};
2022-12-28 12:51:37 +05:30
apps.hcctl = flake-utils.lib.mkApp {drv = hcctl;};
apps.monitor = flake-utils.lib.mkApp {drv = monitor;};
devShells.default = pkgs.devshell.mkShell {
bash = {interactive = "";};
2022-12-28 12:51:37 +05:30
env = [
{
name = "DEVSHELL_NO_MOTD";
value = 1;
}
];
packages = with pkgs; [
2022-12-28 12:51:37 +05:30
cargo-nextest
cargo-release
cargo-semver-checks
2022-12-28 12:51:37 +05:30
nil
rustStable
2023-12-29 11:29:45 +05:30
stdenv.cc
2022-12-28 12:51:37 +05:30
];
};
});
}