treewide: implement auto importing for modules
Reduce maintenance burden and increase efficiency by automatically importing modules following a specific convention. Co-authored-by: awwpotato <awwpotato@voidq.com> Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
fefeb0e928
commit
4fca600cb1
461 changed files with 72 additions and 474 deletions
46
modules/programs/ruff/default.nix
Normal file
46
modules/programs/ruff/default.nix
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
|
||||
cfg = config.programs.ruff;
|
||||
|
||||
settingsFormat = pkgs.formats.toml { };
|
||||
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ lib.hm.maintainers.GaetanLepage ];
|
||||
|
||||
options.programs.ruff = {
|
||||
enable = lib.mkEnableOption "ruff, an extremely fast Python linter and code formatter, written in Rust";
|
||||
|
||||
package = lib.mkPackageOption pkgs "ruff" { nullable = true; };
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = settingsFormat.type;
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
line-length = 100;
|
||||
per-file-ignores = { "__init__.py" = [ "F401" ]; };
|
||||
lint = {
|
||||
select = [ "E4" "E7" "E9" "F" ];
|
||||
ignore = [ ];
|
||||
};
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Ruff configuration.
|
||||
For available settings see <https://docs.astral.sh/ruff/settings>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
||||
|
||||
xdg.configFile."ruff/ruff.toml".source = settingsFormat.generate "ruff.toml" cfg.settings;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue