make pre-commit-hooks-nix optional
This dependency brings in a lot of other dependencies including a nixpkgs copy. By making it optional in the flake users can disable it in their own flake. After removing the dependency, the following inputs are no longer needed: • Removed input 'pre-commit-hooks-nix' • Removed input 'pre-commit-hooks-nix/flake-compat' • Removed input 'pre-commit-hooks-nix/flake-utils' • Removed input 'pre-commit-hooks-nix/gitignore' • Removed input 'pre-commit-hooks-nix/gitignore/nixpkgs' • Removed input 'pre-commit-hooks-nix/nixpkgs' • Removed input 'pre-commit-hooks-nix/nixpkgs-stable'
This commit is contained in:
parent
11e293475d
commit
e6df60debb
25
flake.nix
25
flake.nix
|
@ -7,6 +7,8 @@
|
||||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
|
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
|
||||||
|
|
||||||
|
# Only used during development, can be disabled by flake users like this:
|
||||||
|
# lanzaboote.inputs.pre-commit-hooks-nix.follows = "";
|
||||||
pre-commit-hooks-nix = {
|
pre-commit-hooks-nix = {
|
||||||
url = "github:cachix/pre-commit-hooks.nix";
|
url = "github:cachix/pre-commit-hooks.nix";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
@ -55,9 +57,8 @@
|
||||||
# Derive the output overlay automatically from all packages that we define.
|
# Derive the output overlay automatically from all packages that we define.
|
||||||
inputs.flake-parts.flakeModules.easyOverlay
|
inputs.flake-parts.flakeModules.easyOverlay
|
||||||
|
|
||||||
# Formatting and quality checks.
|
# Formatting and quality checks.
|
||||||
inputs.pre-commit-hooks-nix.flakeModule
|
] ++ (if inputs.pre-commit-hooks-nix ? flakeModule then [ inputs.pre-commit-hooks-nix.flakeModule ] else [ ]);
|
||||||
];
|
|
||||||
|
|
||||||
flake.nixosModules.lanzaboote = moduleWithSystem (
|
flake.nixosModules.lanzaboote = moduleWithSystem (
|
||||||
perSystem@{ config }:
|
perSystem@{ config }:
|
||||||
|
@ -232,15 +233,6 @@
|
||||||
ukiModule = self.nixosModules.uki;
|
ukiModule = self.nixosModules.uki;
|
||||||
});
|
});
|
||||||
|
|
||||||
pre-commit = {
|
|
||||||
check.enable = true;
|
|
||||||
|
|
||||||
settings.hooks = {
|
|
||||||
nixpkgs-fmt.enable = true;
|
|
||||||
typos.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
${config.pre-commit.installationScript}
|
${config.pre-commit.installationScript}
|
||||||
|
@ -268,6 +260,15 @@
|
||||||
|
|
||||||
TEST_SYSTEMD = pkgs.systemd;
|
TEST_SYSTEMD = pkgs.systemd;
|
||||||
};
|
};
|
||||||
|
} // lib.optionalAttrs (inputs.pre-commit-hooks-nix ? flakeModule) {
|
||||||
|
pre-commit = {
|
||||||
|
check.enable = true;
|
||||||
|
|
||||||
|
settings.hooks = {
|
||||||
|
nixpkgs-fmt.enable = true;
|
||||||
|
typos.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue