111 lines
2.8 KiB
Nix
111 lines
2.8 KiB
Nix
{
|
|
description = "Various dylint lints";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs?ref=nixpkgs-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
crane.url = "github:ipetkov/crane";
|
|
rust-overlay = {
|
|
url = "github:oxalica/rust-overlay";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
dylint = {
|
|
url = "github:TheNeikos/nix-dylint";
|
|
inputs = {
|
|
nixpkgs.follows = "nixpkgs";
|
|
crane.follows = "crane";
|
|
rust-overlay.follows = "rust-overlay";
|
|
flake-utils.follows = "flake-utils";
|
|
};
|
|
};
|
|
};
|
|
|
|
outputs =
|
|
inputs:
|
|
inputs.flake-utils.lib.eachDefaultSystem (
|
|
system:
|
|
let
|
|
pkgs = import inputs.nixpkgs {
|
|
inherit system;
|
|
overlays = [
|
|
inputs.rust-overlay.overlays.default
|
|
];
|
|
};
|
|
|
|
inherit (pkgs) lib;
|
|
|
|
toolchain = (builtins.fromTOML (builtins.readFile ./rust-toolchain.toml)).toolchain.channel;
|
|
rustTarget = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
|
|
|
dylintLib = inputs.dylint.mkLib {
|
|
inherit pkgs;
|
|
inherit (inputs) crane;
|
|
};
|
|
|
|
craneLib = (inputs.crane.mkLib pkgs).overrideToolchain rustTarget;
|
|
|
|
src = craneLib.cleanCargoSource ./.;
|
|
|
|
commonLintArgs = {
|
|
inherit src;
|
|
strictDeps = true;
|
|
|
|
buildInputs = [ pkgs.openssl ];
|
|
nativeBuildInputs = [ pkgs.pkg-config ];
|
|
|
|
DOCS_RS = "true";
|
|
RUSTUP_TOOLCHAIN = toolchain;
|
|
};
|
|
|
|
cargoArtifacts = craneLib.buildDepsOnly commonLintArgs;
|
|
|
|
individualLintArgs = commonLintArgs // {
|
|
inherit cargoArtifacts;
|
|
inherit (craneLib.crateNameFromCargoToml { inherit src; }) version;
|
|
|
|
doCheck = false;
|
|
};
|
|
|
|
fileSetForCrate =
|
|
crate:
|
|
lib.fileset.toSource {
|
|
root = ./.;
|
|
fileset = lib.fileset.unions [
|
|
./Cargo.lock
|
|
./Cargo.toml
|
|
(craneLib.fileset.commonCargoSources ./hakari)
|
|
(craneLib.fileset.commonCargoSources crate)
|
|
];
|
|
};
|
|
|
|
dashmap-ref = craneLib.buildPackage (
|
|
individualLintArgs
|
|
// {
|
|
pname = "dashmap-ref";
|
|
cargoExtraArgs = "-p dashmap-ref";
|
|
src = fileSetForCrate ./lints/dashmap-ref;
|
|
}
|
|
);
|
|
|
|
lints = [
|
|
{
|
|
inherit toolchain;
|
|
package = dashmap-ref;
|
|
}
|
|
];
|
|
dylint = dylintLib.mkDylint { inherit lints; };
|
|
in
|
|
{
|
|
devShells.default = pkgs.mkShell {
|
|
nativeBuildInputs = [
|
|
rustTarget
|
|
dylint
|
|
|
|
pkgs.cargo-hakari
|
|
pkgs.openssl
|
|
pkgs.pkg-config
|
|
];
|
|
};
|
|
}
|
|
);
|
|
}
|