{
inputs = {
rust-overlay.url = "github:oxalica/rust-overlay/stable";
nixpkgs.follows = "rust-overlay/nixpkgs";
};
outputs = {
nixpkgs,
rust-overlay,
...
}: let
forAllSystems = f:
nixpkgs.lib.genAttrs [
"aarch64-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
] (
system:
f {
pkgs = import nixpkgs {
inherit system;
overlays = [(import rust-overlay)];
};
}
);
in {
devShells = forAllSystems ({pkgs}: {
default = with pkgs;
mkShell {
packages = [
just
coreutils
diffutils
openssl
pkg-config
cargo-msrv
cargo-readme
(rust-bin.fromRustupToolchainFile ./rust-toolchain.toml)
];
shellHook = ''
# Avoid polluting home dir with local project stuff.
if command -v git &> /dev/null; then
CARGO_HOME="$(git rev-parse --show-toplevel)/.cargo"
export CARGO_HOME
export PATH=$PATH:$CARGO_HOME/bin
fi
'';
};
});
};
}