Skip to content

Commit

Permalink
chore: Setup nix devShell
Browse files Browse the repository at this point in the history
  • Loading branch information
bcyran committed Jul 7, 2024
1 parent 7b789bc commit 8535618
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 0 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
82 changes: 82 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
description = "A Nix-flake-based Rust development environment";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = {
self,
nixpkgs,
rust-overlay,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (system: let
overlays = [
rust-overlay.overlays.default
(final: prev: {
rustToolchain = let
rust = prev.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.override {
extensions = ["rust-src" "rustfmt"];
};
})
];
pkgs = import nixpkgs {
inherit overlays system;
};
in
with pkgs; {
devShells.default = mkShell {
packages = [
(rustToolchain.override {extensions = ["llvm-tools-preview"];})
cargo-edit
cargo-watch
cargo-llvm-cov
rust-analyzer
just
];
buildInputs = [
libheif
];
};
});
}

0 comments on commit 8535618

Please sign in to comment.