From 4cc65f837f1bfef0f7ec0e21379e3057bba03270 Mon Sep 17 00:00:00 2001 From: Greg Johnston Date: Fri, 7 Jul 2023 12:59:18 -0400 Subject: [PATCH] chore: add `mdbook` in flake (#1299) * nix-flake: use follows for `rust-overlay` (..) This removes the extra nixpkgs dependency by re-using the nixpkgs already defined. https://nixos.wiki/wiki/Flakes https://web.archive.org/web/20230621091703/https://nixos.wiki/wiki/Flakes > # The `follows` keyword in inputs is used for inheritance. > # Here, `inputs.nixpkgs` of sops-nix is kept consistent with the `inputs.nixpkgs` of > # the current flake, to avoid problems caused by different versions of nixpkgs. * nix-flake: use nix overlays for rustc/cargo (..) This allows the same nightly rust version to be used across the flake (vs. strictly in the `devShell`). * nix-flake: add `mdbook` to the development shell (..) bumped `nixpkgs` to the latest unstable to pull in mdbook version `0.4.30`. * nix-flake: expose all rust tools in dev environment (..) The `oxalica / rust-overlay` docs expose all tools in the development environment, so we should do the same: https://github.com/oxalica/rust-overlay#use-in-devshell-for-nix-develop --------- Co-authored-by: Jay Querie --- flake.lock | 26 ++++++-------------------- flake.nix | 4 +++- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/flake.lock b/flake.lock index 64078d4e6..579de5bf8 100644 --- a/flake.lock +++ b/flake.lock @@ -38,11 +38,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1681920287, - "narHash": "sha256-+/d6XQQfhhXVfqfLROJoqj3TuG38CAeoT6jO1g9r1k0=", + "lastModified": 1687898314, + "narHash": "sha256-B4BHon3uMXQw8ZdbwxRK1BmxVOGBV4viipKpGaIlGwk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "645bc49f34fa8eff95479f0345ff57e55b53437e", + "rev": "e18dc963075ed115afb3e312b64643bf8fd4b474", "type": "github" }, "original": { @@ -52,22 +52,6 @@ "type": "github" } }, - "nixpkgs_2": { - "locked": { - "lastModified": 1681358109, - "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "root": { "inputs": { "flake-utils": "flake-utils", @@ -78,7 +62,9 @@ "rust-overlay": { "inputs": { "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs_2" + "nixpkgs": [ + "nixpkgs" + ] }, "locked": { "lastModified": 1682043560, diff --git a/flake.nix b/flake.nix index 765f36d20..a9b0580e1 100644 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,7 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; rust-overlay.url = "github:oxalica/rust-overlay"; + rust-overlay.inputs.nixpkgs.follows = "nixpkgs"; flake-utils.url = "github:numtide/flake-utils"; }; @@ -22,7 +23,8 @@ openssl pkg-config cacert - (rust-bin.selectLatestNightlyWith( toolchain: toolchain.default.override { + mdbook + (rust-bin.selectLatestNightlyWith(toolchain: toolchain.default.override { extensions= [ "rust-src" "rust-analyzer" ]; targets = [ "wasm32-unknown-unknown" ]; }))