Compare commits

..

No commits in common. "1abc3fba2f8d8fb01e5cc31f7cbbf474507fd84d" and "20affba4e49fefb0256a3b6a1faf73e20266555a" have entirely different histories.

2 changed files with 29 additions and 56 deletions

1
.gitignore vendored
View file

@ -1,3 +1,2 @@
/target
/.direnv
/result

View file

@ -20,18 +20,8 @@
};
};
outputs =
{
self,
nixpkgs,
crane,
fenix,
flake-utils,
advisory-db,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
outputs = { self, nixpkgs, crane, fenix, flake-utils, advisory-db, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
@ -47,8 +37,7 @@
buildInputs = [
# Add additional build inputs here
]
++ lib.optionals pkgs.stdenv.isDarwin [
] ++ lib.optionals pkgs.stdenv.isDarwin [
# Additional darwin specific inputs can be set here
pkgs.libiconv
];
@ -57,13 +46,12 @@
# MY_CUSTOM_VAR = "some value";
};
craneLibLLvmTools = craneLib.overrideToolchain (
fenix.packages.${system}.complete.withComponents [
craneLibLLvmTools = craneLib.overrideToolchain
(fenix.packages.${system}.complete.withComponents [
"cargo"
"llvm-tools"
"rustc"
]
);
]);
# Build *just* the cargo dependencies, so we can reuse
# all of that work (e.g. via cachix) when running in CI
@ -71,12 +59,9 @@
# Build the actual crate itself, reusing the dependency
# artifacts from above.
my-crate = craneLib.buildPackage (
commonArgs
// {
my-crate = craneLib.buildPackage (commonArgs // {
inherit cargoArtifacts;
}
);
});
in
{
checks = {
@ -89,20 +74,14 @@
# Note that this is done as a separate derivation so that
# we can block the CI if there are issues here, but not
# prevent downstream consumers from building our crate by itself.
my-crate-clippy = craneLib.cargoClippy (
commonArgs
// {
my-crate-clippy = craneLib.cargoClippy (commonArgs // {
inherit cargoArtifacts;
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
}
);
});
my-crate-doc = craneLib.cargoDoc (
commonArgs
// {
my-crate-doc = craneLib.cargoDoc (commonArgs // {
inherit cargoArtifacts;
}
);
});
# Check formatting
my-crate-fmt = craneLib.cargoFmt {
@ -128,26 +107,19 @@
# Run tests with cargo-nextest
# Consider setting `doCheck = false` on `my-crate` if you do not want
# the tests to run twice
my-crate-nextest = craneLib.cargoNextest (
commonArgs
// {
my-crate-nextest = craneLib.cargoNextest (commonArgs // {
inherit cargoArtifacts;
partitions = 1;
partitionType = "count";
}
);
});
};
packages = {
default = my-crate;
}
// lib.optionalAttrs (!pkgs.stdenv.isDarwin) {
my-crate-llvm-coverage = craneLibLLvmTools.cargoLlvmCov (
commonArgs
// {
} // lib.optionalAttrs (!pkgs.stdenv.isDarwin) {
my-crate-llvm-coverage = craneLibLLvmTools.cargoLlvmCov (commonArgs // {
inherit cargoArtifacts;
}
);
});
};
apps.default = flake-utils.lib.mkApp {
@ -163,8 +135,10 @@
# Extra inputs can be added here; cargo and rustc are provided by default.
packages = [
# pkgs.ripgrep
pkgs.wgo
pkgs.cargo-flamegraph
];
};
}
);
});
}