diff --git a/README.md b/README.md index 4d34b93..6a9b266 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,13 @@ See [Nix-ifying Rust projects](https://notes.srid.ca/rust-nix) for details. ## Adapting this template - Change `name` in Cargo.toml and flake.nix. Also change `description` in flake.nix. -- There are two CI workflows, and one of them uses Nix which is slower than the other based on rustup. Pick one or the other depending on your trade-offs. +- There are two CI workflows, and one of them uses Nix which is slower (unless you configure a cache) than the other that is based on rustup. Pick one or the other depending on your trade-offs. ## Development (Flakes) This repo uses [Flakes](https://nixos.wiki/wiki/Flakes) from the get-go, but compat is provided for traditional nix-shell/nix-build as well (see the section below). -``` +```bash # Dev shell nix develop @@ -27,7 +27,7 @@ nix build ## Development (Legacy Nix) -``` +```bash # Dev shell nix-shell diff --git a/flake.nix b/flake.nix index 2419528..16e29e3 100644 --- a/flake.nix +++ b/flake.nix @@ -63,7 +63,7 @@ # Configuration for the non-Rust dependencies buildInputs = with pkgs; [ openssl.dev ]; - nativeBuildInputs = with pkgs; [ rustc cargo pkgconfig nixpkgs-fmt ]; + nativeBuildInputs = with pkgs; [ rustc cargo pkgconfig ]; in rec { packages.${name} = project.rootCrate.build; @@ -81,7 +81,14 @@ # `nix develop` devShell = pkgs.mkShell { - inherit buildInputs nativeBuildInputs; + inputsFrom = builtins.attrValues self.packages.${system}; + buildInputs = buildInputs ++ (with pkgs; + # Tools you need for development go here. + [ + nixpkgs-fmt + cargo-watch + ]); + # FIXME: Is this correct? Should it use rust-overlay instead? RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; }; }