2022-01-17 01:25:41 +03:00
|
|
|
{
|
2022-01-17 03:54:55 +03:00
|
|
|
description = "Build a cargo project without extra checks";
|
2022-01-17 01:25:41 +03:00
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
|
|
|
2024-08-30 02:29:16 +03:00
|
|
|
crane.url = "github:ipetkov/crane";
|
2022-01-17 01:25:41 +03:00
|
|
|
|
2022-04-28 04:10:22 +03:00
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
2022-01-17 01:25:41 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = { self, nixpkgs, crane, flake-utils, ... }:
|
|
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
|
|
let
|
2023-11-26 21:37:43 +03:00
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
2022-01-17 01:25:41 +03:00
|
|
|
|
2024-05-19 04:07:07 +03:00
|
|
|
craneLib = crane.mkLib pkgs;
|
2024-05-04 21:04:08 +03:00
|
|
|
|
|
|
|
# Common arguments can be set here to avoid repeating them later
|
|
|
|
# Note: changes here will rebuild all dependency crates
|
|
|
|
commonArgs = {
|
2024-06-11 06:53:46 +03:00
|
|
|
src = craneLib.cleanCargoSource ./.;
|
2023-10-16 01:25:34 +03:00
|
|
|
strictDeps = true;
|
2022-11-20 03:08:15 +03:00
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
# Add additional build inputs here
|
|
|
|
] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
|
|
|
|
# Additional darwin specific inputs can be set here
|
|
|
|
pkgs.libiconv
|
|
|
|
];
|
2024-05-04 21:04:08 +03:00
|
|
|
};
|
2023-02-09 03:27:05 +03:00
|
|
|
|
2024-05-04 21:04:08 +03:00
|
|
|
my-crate = craneLib.buildPackage (commonArgs // {
|
2024-05-04 22:56:48 +03:00
|
|
|
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
|
|
|
|
2024-05-04 21:04:08 +03:00
|
|
|
# Additional environment variables or build phases/hooks can be set
|
|
|
|
# here *without* rebuilding all dependency crates
|
2023-02-09 03:27:05 +03:00
|
|
|
# MY_CUSTOM_VAR = "some value";
|
2024-05-04 21:04:08 +03:00
|
|
|
});
|
2022-01-17 01:25:41 +03:00
|
|
|
in
|
|
|
|
{
|
|
|
|
checks = {
|
|
|
|
inherit my-crate;
|
|
|
|
};
|
|
|
|
|
2022-04-28 05:23:30 +03:00
|
|
|
packages.default = my-crate;
|
2022-01-17 01:25:41 +03:00
|
|
|
|
2022-04-28 05:23:30 +03:00
|
|
|
apps.default = flake-utils.lib.mkApp {
|
2022-01-17 01:25:41 +03:00
|
|
|
drv = my-crate;
|
|
|
|
};
|
|
|
|
|
2023-09-03 20:33:10 +03:00
|
|
|
devShells.default = craneLib.devShell {
|
|
|
|
# Inherit inputs from checks.
|
|
|
|
checks = self.checks.${system};
|
2022-01-17 01:25:41 +03:00
|
|
|
|
2023-02-23 07:47:24 +03:00
|
|
|
# Additional dev-shell environment variables can be set directly
|
|
|
|
# MY_CUSTOM_DEVELOPMENT_VAR = "something else";
|
|
|
|
|
2023-09-03 20:33:10 +03:00
|
|
|
# Extra inputs can be added here; cargo and rustc are provided by default.
|
|
|
|
packages = [
|
|
|
|
# pkgs.ripgrep
|
2022-01-17 01:25:41 +03:00
|
|
|
];
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|