From ae1c3322d53e4aebe82e056df38597a62e48a332 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 25 Jul 2022 16:40:56 +0200 Subject: [PATCH] Remove 'pre-commit' check from flake Since trying to run it results into a failure due to 'clippy' trying to fetch the network inside the build sandbox, remove it from the 'checks' for now, but do keep it around for its 'shellHook'. --- flake.nix | 66 +++++++++++++++++++++++++++---------------------------- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/flake.nix b/flake.nix index 22a05e4..c8e7566 100644 --- a/flake.nix +++ b/flake.nix @@ -80,44 +80,42 @@ rustc = my-rust; }; inherit (pkgs) lib; - in - rec { - checks = { - pre-commit = - let - # See https://github.com/cachix/pre-commit-hooks.nix/issues/126 - rust-env = pkgs.buildEnv { - name = "rust-env"; - buildInputs = [ pkgs.makeWrapper ]; - paths = [ my-rust ]; - pathsToLink = [ "/" "/bin" ]; - postBuild = '' - for i in $out/bin/*; do - wrapProgram "$i" --prefix PATH : "$out/bin" - done - ''; + pre-commit = + let + # See https://github.com/cachix/pre-commit-hooks.nix/issues/126 + rust-env = pkgs.buildEnv { + name = "rust-env"; + buildInputs = [ pkgs.makeWrapper ]; + paths = [ my-rust ]; + pathsToLink = [ "/" "/bin" ]; + postBuild = '' + for i in $out/bin/*; do + wrapProgram "$i" --prefix PATH : "$out/bin" + done + ''; + }; + in + pre-commit-hooks.lib.${system}.run { + src = self; + + hooks = { + clippy = { + enable = true; + entry = lib.mkForce "${rust-env}/bin/cargo-clippy clippy"; }; - in - pre-commit-hooks.lib.${system}.run { - src = self; - hooks = { - clippy = { - enable = true; - entry = lib.mkForce "${rust-env}/bin/cargo-clippy clippy"; - }; + nixpkgs-fmt = { + enable = true; + }; - nixpkgs-fmt = { - enable = true; - }; - - rustfmt = { - enable = true; - entry = lib.mkForce "${rust-env}/bin/cargo-fmt fmt -- --check --color always"; - }; + rustfmt = { + enable = true; + entry = lib.mkForce "${rust-env}/bin/cargo-fmt fmt -- --check --color always"; }; }; - }; + }; + in + rec { devShells = { default = pkgs.mkShell { @@ -131,7 +129,7 @@ my-rust ]; - inherit (checks.pre-commit) shellHook; + inherit (pre-commit) shellHook; RUST_SRC_PATH = "${my-rust}/lib/rustlib/src/rust/library"; };