Skip to content

Redesign module options #196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
domenkozar opened this issue Nov 24, 2022 · 4 comments
Closed

Redesign module options #196

domenkozar opened this issue Nov 24, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@domenkozar
Copy link
Member

domenkozar commented Nov 24, 2022

Something like:

{
  git.hooks.pre-commit.shellcheck.enable = true;
  git.hooks.push.shellcheck.enable = true;
}

cc @roberth

@domenkozar domenkozar changed the title Redesign api Redesign module options Nov 24, 2022
@roberth
Copy link
Contributor

roberth commented Nov 24, 2022

-  git.hooks.pre-commit.shellcheck.enable = true;
+  hooks.pre-commit.shellcheck.enable = true;

This way devenv can import it using git = mkOption { type = submodule pre-commit-hooks-module; } and the flake parts module can import it in its own way. The latter needs to be explicit about the implementation in the prefix and pre-commit.settings.git.hooks would kinda suck.
Isn't this the status quo actually?

Anyway, another nice thing would be to do

{
options.hooks = mkOption {
  type = submodule {
    freeformType = types.attrsOf hookModule;
  };
};
}

and then declare built in hooks as something like

{
options.hooks.nixpkgs-fmt = mkOption {
  type = submodule {
    imports = [ hookModule ];
    options.some-setting = mkOption ...;
  };
};
}

thereby adding the individual hooks in the option docs, and removing the need for a separate settings namespace.

@roberth
Copy link
Contributor

roberth commented Dec 2, 2022

The redesigned pattern should have a package option, so the tools indirection becomes unnecessary, and overlays can be avoided. Refs #204 (comment)

@domenkozar domenkozar added the enhancement New feature or request label Dec 14, 2022
@domenkozar domenkozar self-assigned this Feb 13, 2023
@domenkozar
Copy link
Member Author

Eventually I'd like the interface to be:

  hooks.ormolu.enable = true;
  hooks.ormolu.package = pkgs.ormolu;
  hooks.ormolu.settings.defaultExtensions = [ "lhs" "hs" ];

@domenkozar
Copy link
Member Author

Merged to master!

totoroot pushed a commit to totoroot/git-hooks.nix that referenced this issue Mar 27, 2024
@sandydoo sandydoo unpinned this issue Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants