adx/flake.nix

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

122 lines
3.4 KiB
Nix
Raw Permalink Normal View History

2022-11-29 20:09:28 +05:30
{
description = "adx";
2022-11-29 20:09:28 +05:30
2024-05-11 11:56:45 +05:30
inputs.nixpkgs.url = "github:msfjarvis/nixpkgs/nixpkgs-unstable";
inputs.systems.url = "github:msfjarvis/flake-systems";
inputs.advisory-db.url = "github:rustsec/advisory-db";
inputs.advisory-db.flake = false;
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";
inputs.fenix.inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.flake-utils.inputs.systems.follows = "systems";
inputs.flake-compat.url = "github:nix-community/flake-compat";
inputs.flake-compat.flake = false;
2022-11-29 20:09:28 +05:30
outputs = {
self,
nixpkgs,
advisory-db,
crane,
devshell,
fenix,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [devshell.overlays.default];
};
rustStable = (import fenix {inherit pkgs;}).fromToolchainFile {
file = ./rust-toolchain.toml;
2024-04-10 22:02:55 +05:30
sha256 = "sha256-7QfkHty6hSrgNM0fspycYkRcB82eEqYa4CoAJ9qA3tU=";
};
2022-11-29 20:09:28 +05:30
craneLib = (crane.mkLib pkgs).overrideToolchain rustStable;
2024-02-28 10:14:50 +05:30
xmlFilter = path: builtins.match ".*xml$" path != null;
instaFilter = path: builtins.match ".*snap$" path != null;
filter = path: type:
(xmlFilter path) || (instaFilter path) || (craneLib.filterCargoSources path type);
workspaceName = craneLib.crateNameFromCargoToml {cargoToml = ./adx/Cargo.toml;};
2023-03-10 15:03:01 +05:30
commonArgs = {
inherit (workspaceName) pname version;
src = pkgs.lib.cleanSourceWith {
src = craneLib.path ./.;
2024-02-28 10:14:50 +05:30
inherit filter;
};
2023-03-10 15:03:01 +05:30
buildInputs = [];
nativeBuildInputs = [];
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
2023-03-10 15:03:01 +05:30
cargoToml = ./adx/Cargo.toml;
};
2023-03-10 15:03:01 +05:30
2024-02-28 10:14:50 +05:30
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
adx-build = craneLib.cargoBuild (commonArgs
// {
inherit cargoArtifacts;
CARGO_BUILD_RUSTFLAGS = "--cfg nix_check";
});
adx = craneLib.buildPackage (commonArgs
// {
cargoArtifacts = adx-build;
doCheck = false;
});
2023-03-10 15:03:01 +05:30
adx-clippy = craneLib.cargoClippy (commonArgs
// {
inherit cargoArtifacts;
});
adx-fmt = craneLib.cargoFmt (commonArgs // {});
adx-audit = craneLib.cargoAudit (commonArgs // {inherit advisory-db;});
adx-nextest = craneLib.cargoNextest (commonArgs
// {
2024-02-28 10:14:50 +05:30
cargoArtifacts = adx-build;
2023-03-10 15:03:01 +05:30
partitions = 1;
partitionType = "count";
2024-02-28 10:14:50 +05:30
CARGO_BUILD_RUSTFLAGS = "--cfg nix_check";
2023-03-10 15:03:01 +05:30
});
in {
checks = {
2024-04-21 17:51:37 +05:30
inherit adx adx-audit adx-clippy adx-fmt adx-nextest;
};
2022-11-29 20:09:28 +05:30
packages.default = adx;
2022-11-29 20:09:28 +05:30
apps.default = flake-utils.lib.mkApp {drv = adx;};
2022-11-29 20:09:28 +05:30
devShells.default = pkgs.devshell.mkShell {
bash = {interactive = "";};
2022-11-29 20:09:28 +05:30
env = [
{
name = "DEVSHELL_NO_MOTD";
value = 1;
}
];
packages = with pkgs; [
cargo-dist
2024-02-28 10:14:50 +05:30
cargo-insta
cargo-nextest
cargo-release
oranda
rustStable
2023-12-29 11:25:16 +05:30
stdenv.cc
];
};
});
2022-11-29 20:09:28 +05:30
}