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