diff --git a/flake.nix b/flake.nix index b56a7c4cb..0c77776b0 100644 --- a/flake.nix +++ b/flake.nix @@ -23,7 +23,7 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = { self, nixpkgs, pre-commit-hooks, nix, ... }: + outputs = { self, nixpkgs, pre-commit-hooks, nix, ... } @ inputs: let systems = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; forAllSystems = f: builtins.listToAttrs (map (name: { inherit name; value = f name; }) systems); @@ -37,7 +37,7 @@ ./src/modules/top-level.nix { devenv.warnOnNewVersion = false; } ]; - specialArgs = { inherit pre-commit-hooks pkgs; }; + specialArgs = { inherit inputs pkgs; }; }; options = pkgs.nixosOptionsDoc { options = builtins.removeAttrs eval.options [ "_module" ]; @@ -86,12 +86,8 @@ lib = { mkConfig = { pkgs, inputs, modules }: let - moduleInputs = { inherit pre-commit-hooks; } // inputs; project = inputs.nixpkgs.lib.evalModules { - specialArgs = moduleInputs // { - inherit pkgs; - inputs = moduleInputs; - }; + specialArgs = { inherit pkgs inputs; }; modules = [ (self.modules + /top-level.nix) ({ config, ... }: { diff --git a/src/flake.nix b/src/flake.nix index 45e7f02bd..2f5b3e8e0 100644 --- a/src/flake.nix +++ b/src/flake.nix @@ -31,7 +31,7 @@ then devenvpath else throw (devenvpath + " file does not exist for input ''${name}."); project = pkgs.lib.evalModules { - specialArgs = inputs // { inherit inputs pkgs; }; + specialArgs = { inherit inputs pkgs; }; modules = [ (inputs.devenv.modules + /top-level.nix) { devenv.cliVersion = "${version}"; } diff --git a/src/modules/integrations/pre-commit.nix b/src/modules/integrations/pre-commit.nix index c2b9bb8f5..aea2ded6c 100644 --- a/src/modules/integrations/pre-commit.nix +++ b/src/modules/integrations/pre-commit.nix @@ -1,5 +1,14 @@ -{ pkgs, self, lib, pre-commit-hooks, config, ... }: +{ pkgs, self, lib, inputs, config, ... }: +let + pre-commit-hooks = inputs.pre-commit-hooks + or (throw '' + To use integrations.pre-commit, you need to add the following to your flake inputs: + + inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; + ''); + +in { options.pre-commit = lib.mkOption { type = lib.types.submoduleWith {