2022-07-16 16:48:23 +02:00
|
|
|
{
|
|
|
|
description = "A Nix-flake-based Rust development environment";
|
|
|
|
|
|
|
|
inputs = {
|
2022-08-20 12:06:53 +02:00
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs";
|
2022-07-16 16:48:23 +02:00
|
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
|
|
};
|
|
|
|
|
2022-08-20 14:54:34 +02:00
|
|
|
outputs =
|
|
|
|
{ self
|
|
|
|
, flake-utils
|
|
|
|
, nixpkgs
|
|
|
|
, rust-overlay
|
|
|
|
}:
|
2022-07-16 16:48:23 +02:00
|
|
|
|
2022-08-20 14:54:34 +02:00
|
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
|
|
let
|
|
|
|
overlays = [
|
|
|
|
(import rust-overlay)
|
|
|
|
(self: super: {
|
|
|
|
rustToolchain =
|
|
|
|
let
|
|
|
|
rust = super.rust-bin;
|
|
|
|
in
|
|
|
|
if builtins.pathExists ./rust-toolchain.toml then
|
|
|
|
rust.fromRustupToolchainFile ./rust-toolchain.toml
|
|
|
|
else if builtins.pathExists ./rust-toolchain then
|
|
|
|
rust.fromRustupToolchainFile ./rust-toolchain
|
|
|
|
else
|
|
|
|
rust.stable.latest.default;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
pkgs = import nixpkgs { inherit system overlays; };
|
|
|
|
in
|
|
|
|
{
|
2022-10-12 23:42:34 +02:00
|
|
|
devShells.default = pkgs.mkShell {
|
2023-02-15 01:20:41 +01:00
|
|
|
packages = with pkgs; [
|
2022-08-20 14:54:34 +02:00
|
|
|
rustToolchain
|
|
|
|
openssl
|
|
|
|
pkg-config
|
|
|
|
cargo-deny
|
2022-08-28 15:26:43 +02:00
|
|
|
cargo-edit
|
2022-10-28 02:45:13 +02:00
|
|
|
cargo-watch
|
2022-08-20 14:54:34 +02:00
|
|
|
rust-analyzer
|
2022-10-28 02:45:13 +02:00
|
|
|
];
|
2022-08-20 14:54:34 +02:00
|
|
|
|
|
|
|
shellHook = ''
|
|
|
|
${pkgs.rustToolchain}/bin/cargo --version
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
});
|
2022-07-16 16:48:23 +02:00
|
|
|
}
|