oppiliappan/statix

False positive (or wrong fix ?) in flake.nix

maxice8 opened this issue · 1 comments

I have the following in my flake.nix

  outputs = {...} @ inputs: import ./desktop/outputs.nix inputs;

running statix check flake.nix shows this:

[W11] Warning: Found redundant pattern bind in function argument
    ╭─[flake.nix:42:13]42outputs = {...} @ inputs: import ./desktop/outputs.nix inputs;
    ·             ───────┬──────
    ·                    ╰──────── This pattern bind is redundant, use inputs instead

running flake.nix generates the following fix:

diff --git a/flake.nix b/flake.nix
index 525ee35..3727018 100644
--- a/flake.nix
+++ b/flake.nix
@@ -39,5 +39,5 @@
     neovim-nightly.inputs.nixpkgs.follows = "nixpkgs";
   };
 
-  outputs = {...} @ inputs: import ./desktop/outputs.nix inputs;
+  outputs = import ./desktop/outputs.nix;
 }

but that causes flake check to fail:

$ flake check
error: expected a function but got a thunk at /nix/store/xxkl5h6wdr7w54kps7fdk0m5didg9gyf-source/flake.nix:42:3

Ah, flake attributes such as inputsetc. are a little special cased. They are not allowed to perform any evaluations to produce the outputs attribute, for example. Currently statix does not understand flakes and their specs, we can probably fix this once it does.