refactor flake
This commit is contained in:
parent
b8877f33a3
commit
fc304df35e
1 changed files with 28 additions and 24 deletions
52
flake.nix
52
flake.nix
|
@ -23,41 +23,45 @@
|
||||||
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||||
craneLib = (crane.mkLib pkgs).overrideToolchain(_: toolchain);
|
craneLib = (crane.mkLib pkgs).overrideToolchain(_: toolchain);
|
||||||
lib = pkgs.lib;
|
lib = pkgs.lib;
|
||||||
nativeBuildInputs = with pkgs; [
|
src = craneLib.cleanCargoSource ./.;
|
||||||
pkg-config
|
|
||||||
];
|
commonArgs = {
|
||||||
buildInputs = with pkgs; [
|
inherit src;
|
||||||
toolchain
|
strictDeps = true;
|
||||||
openssl
|
nativeBuildInputs = with pkgs; [
|
||||||
nix
|
pkg-config
|
||||||
boost
|
];
|
||||||
];
|
buildInputs = with pkgs; [
|
||||||
env = {
|
toolchain
|
||||||
|
openssl
|
||||||
|
nix
|
||||||
|
boost
|
||||||
|
];
|
||||||
# for cpp bindings to work
|
# for cpp bindings to work
|
||||||
NIX_INCLUDE_PATH = "${lib.getDev pkgs.nix}/include";
|
NIX_INCLUDE_PATH = "${lib.getDev pkgs.nix}/include";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
||||||
|
nixcp = craneLib.buildPackage (commonArgs // {
|
||||||
|
inherit cargoArtifacts;
|
||||||
|
});
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = craneLib.devShell {
|
||||||
inherit buildInputs;
|
inputsFrom = [ nixcp ];
|
||||||
inherit nativeBuildInputs;
|
|
||||||
|
RUST_LOG = "nixcp=debug";
|
||||||
|
RUST_BACKGRACE = 1;
|
||||||
|
# for cpp bindings to work
|
||||||
|
NIX_INCLUDE_PATH = "${lib.getDev pkgs.nix}/include";
|
||||||
|
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
tokio-console
|
tokio-console
|
||||||
cargo-udeps
|
cargo-udeps
|
||||||
];
|
];
|
||||||
env = env // {
|
|
||||||
RUST_LOG = "nixcp=debug";
|
|
||||||
RUST_BACKGRACE = 1;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
packages.default = craneLib.buildPackage {
|
packages.default = nixcp;
|
||||||
inherit nativeBuildInputs;
|
|
||||||
inherit buildInputs;
|
|
||||||
inherit env;
|
|
||||||
src = craneLib.cleanCargoSource ./.;
|
|
||||||
strictDeps = true;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue