mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
`literalExpression` is intended just to signify code that needs to stay a string that gets represented exactly as-is for docs. It has been misused heavily and people get confused repeatedly on when or not to use it because of the rampant misuse.
53 lines
1.1 KiB
Nix
53 lines
1.1 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
|
|
cfg = config.programs.ruff;
|
|
|
|
settingsFormat = pkgs.formats.toml { };
|
|
|
|
in
|
|
{
|
|
meta.maintainers = [ lib.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 {
|
|
inherit (settingsFormat) type;
|
|
default = { };
|
|
example = {
|
|
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;
|
|
};
|
|
}
|