mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-12-27 04:53:50 +03:00
improve nix flake
Also fix the comment in `Cargo.toml` about the rust-version stuff.
This commit is contained in:
parent
e8ac881b2f
commit
6f052fff98
2 changed files with 43 additions and 32 deletions
|
@ -9,10 +9,10 @@ readme = "README.md"
|
||||||
version = "0.7.0-alpha"
|
version = "0.7.0-alpha"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# When changing this, make sure to update the `flake.lock` file by running
|
# When changing this, make sure to update the hash near the text "THE
|
||||||
# `nix flake update`. If you don't have Nix installed or otherwise don't know
|
# rust-version HASH" in `flake.nix`. If you don't have Nix installed or
|
||||||
# how to do this, ping `@charles:computer.surgery` or `@dusk:gaze.systems` in
|
# otherwise don't know how to do this, ping `@charles:computer.surgery` or
|
||||||
# the matrix room.
|
# `@dusk:gaze.systems` in the matrix room.
|
||||||
rust-version = "1.70.0"
|
rust-version = "1.70.0"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
67
flake.nix
67
flake.nix
|
@ -43,53 +43,64 @@
|
||||||
sha256 = "sha256-gdYqng0y9iHYzYPAdkC/ka3DRny3La/S5G8ASj0Ayyc=";
|
sha256 = "sha256-gdYqng0y9iHYzYPAdkC/ka3DRny3La/S5G8ASj0Ayyc=";
|
||||||
};
|
};
|
||||||
|
|
||||||
# The system's RocksDB
|
mkToolchain = fenix.packages.${system}.combine;
|
||||||
ROCKSDB_INCLUDE_DIR = "${pkgs.rocksdb}/include";
|
|
||||||
ROCKSDB_LIB_DIR = "${pkgs.rocksdb}/lib";
|
buildToolchain = mkToolchain (with toolchain; [
|
||||||
|
cargo
|
||||||
|
rustc
|
||||||
|
]);
|
||||||
|
|
||||||
|
devToolchain = mkToolchain (with toolchain; [
|
||||||
|
cargo
|
||||||
|
clippy
|
||||||
|
rust-src
|
||||||
|
rustc
|
||||||
|
|
||||||
|
# Always use nightly rustfmt because most of its options are unstable
|
||||||
|
fenix.packages.${system}.latest.rustfmt
|
||||||
|
]);
|
||||||
|
|
||||||
|
builder =
|
||||||
|
((crane.mkLib pkgs).overrideToolchain buildToolchain).buildPackage;
|
||||||
|
|
||||||
# Shared between the package and the devShell
|
|
||||||
nativeBuildInputs = (with pkgs.rustPlatform; [
|
nativeBuildInputs = (with pkgs.rustPlatform; [
|
||||||
bindgenHook
|
bindgenHook
|
||||||
]);
|
]);
|
||||||
|
|
||||||
builder =
|
env = {
|
||||||
((crane.mkLib pkgs).overrideToolchain toolchain.toolchain).buildPackage;
|
ROCKSDB_INCLUDE_DIR = "${pkgs.rocksdb}/include";
|
||||||
|
ROCKSDB_LIB_DIR = "${pkgs.rocksdb}/lib";
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
packages.default = builder {
|
packages.default = builder {
|
||||||
src = ./.;
|
src = ./.;
|
||||||
|
|
||||||
|
# This is redundant with CI
|
||||||
|
doCheck = false;
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
stdenv
|
env
|
||||||
nativeBuildInputs
|
nativeBuildInputs
|
||||||
ROCKSDB_INCLUDE_DIR
|
stdenv;
|
||||||
ROCKSDB_LIB_DIR;
|
|
||||||
|
meta.mainProgram = cargoToml.package.name;
|
||||||
};
|
};
|
||||||
|
|
||||||
devShells.default = (pkgs.mkShell.override { inherit stdenv; }) {
|
devShells.default = (pkgs.mkShell.override { inherit stdenv; }) {
|
||||||
# Rust Analyzer needs to be able to find the path to default crate
|
env = env // {
|
||||||
# sources, and it can read this environment variable to do so
|
# Rust Analyzer needs to be able to find the path to default crate
|
||||||
RUST_SRC_PATH = "${toolchain.rust-src}/lib/rustlib/src/rust/library";
|
# sources, and it can read this environment variable to do so. The
|
||||||
|
# `rust-src` component is required in order for this to work.
|
||||||
inherit
|
RUST_SRC_PATH = "${devToolchain}/lib/rustlib/src/rust/library";
|
||||||
ROCKSDB_INCLUDE_DIR
|
};
|
||||||
ROCKSDB_LIB_DIR;
|
|
||||||
|
|
||||||
# Development tools
|
# Development tools
|
||||||
nativeBuildInputs = nativeBuildInputs ++ (with toolchain; [
|
nativeBuildInputs = nativeBuildInputs ++ [
|
||||||
cargo
|
devToolchain
|
||||||
clippy
|
] ++ (with pkgs; [
|
||||||
rust-src
|
|
||||||
rustc
|
|
||||||
rustfmt
|
|
||||||
]) ++ (with pkgs; [
|
|
||||||
engage
|
engage
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
checks = {
|
|
||||||
packagesDefault = self.packages.${system}.default;
|
|
||||||
devShellsDefault = self.devShells.${system}.default;
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue