Skip to content

Commit

Permalink
fix: avoid eval error by discouraging overzealus module signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
blaggacao committed Feb 18, 2023
1 parent 532f581 commit 7de4420
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
10 changes: 3 additions & 7 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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" ];
Expand Down Expand Up @@ -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, ... }: {
Expand Down
2 changes: 1 addition & 1 deletion src/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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}"; }
Expand Down
11 changes: 10 additions & 1 deletion src/modules/integrations/pre-commit.nix
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down

0 comments on commit 7de4420

Please sign in to comment.