From be1d854f85eb2c5b5a1ea078c5354ce5cdc0cb43 Mon Sep 17 00:00:00 2001 From: Tristan de Cacqueray Date: Thu, 12 May 2022 09:42:14 +0000 Subject: [PATCH] nix: move ci dependencies to the devShell (#161) Fixes #160 --- default.nix | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/default.nix b/default.nix index 3667487..982bd5b 100644 --- a/default.nix +++ b/default.nix @@ -17,8 +17,23 @@ let src = nixpkgs.lib.cleanSource ./.; - # Those are being used in tests - nativeBuildInputs = with nixpkgs; [ + buildInputs = with nixpkgs; lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security libiconv ]; + + doCheck = true; + + cargoLock.lockFile = ./Cargo.lock; + + meta.description = "one CLI to format the code tree"; + }; + + # Add all the dependencies of treefmt, plus more build tools + devShell = treefmt.overrideAttrs (prev: { + shellHook = '' + # Put the treefmt binary on the PATH when it's built + export PATH=$PWD/target/debug:$PATH + ''; + + nativeBuildInputs = prev.nativeBuildInputs ++ (with nixpkgs; [ # Build tools rustPackages.clippy rust-analyzer @@ -39,29 +54,15 @@ let terraform mdbook - ]; - - shellHook = '' - # Put the treefmt binary on the PATH when it's built - export PATH=$PWD/target/debug:$PATH - ''; - - buildInputs = with nixpkgs; lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security libiconv ]; - - doCheck = true; - - cargoLock.lockFile = ./Cargo.lock; - - meta.description = "one CLI to format the code tree"; - }; + ]); + }); in { - inherit treefmt; + inherit treefmt devShell; # A collection of packages for the project docs = nixpkgs.callPackage ./docs { }; # Flake attributes defaultPackage = treefmt; - devShell = treefmt; }