From e39a9d0103e3b2e42059c986a8c633824b96c193 Mon Sep 17 00:00:00 2001 From: florpe <53856373+florpe@users.noreply.github.com> Date: Mon, 11 Apr 2022 03:54:04 +0200 Subject: [PATCH] pylint: add module (#2729) --- .github/CODEOWNERS | 2 ++ modules/lib/maintainers.nix | 6 ++++++ modules/modules.nix | 1 + modules/programs/pylint.nix | 31 +++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 modules/programs/pylint.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d298d034c..7a2660945 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -210,6 +210,8 @@ /modules/programs/pubs.nix @loicreynier /tests/modules/programs/pubs @loicreynier +/modules/programs/pylint.nix @florpe + /modules/programs/rbw.nix @ambroisie /tests/modules/programs/rbw @ambroisie diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index 7743b3426..4b1f87d2a 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -123,6 +123,12 @@ githubId = 46252070; name = "Sara Johnsson"; }; + florpe = { + email = "jens.krewald@gmail.com"; + github = "florpe"; + githubId = 53856373; + name = "Jens Krewald"; + }; maximsmol = { email = "maximsmol@gmail.com"; github = "maximsmol"; diff --git a/modules/modules.nix b/modules/modules.nix index 5bd77c929..cb2e30b5b 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -131,6 +131,7 @@ let ./programs/piston-cli.nix ./programs/powerline-go.nix ./programs/pubs.nix + ./programs/pylint.nix ./programs/qutebrowser.nix ./programs/rbw.nix ./programs/readline.nix diff --git a/modules/programs/pylint.nix b/modules/programs/pylint.nix new file mode 100644 index 000000000..e6679b985 --- /dev/null +++ b/modules/programs/pylint.nix @@ -0,0 +1,31 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.pylint; + listToValue = concatMapStringsSep ", " (generators.mkValueStringDefault { }); + iniFormat = pkgs.formats.ini { inherit listToValue; }; +in { + meta.maintainers = [ hm.maintainers.florpe ]; + options.programs.pylint = { + enable = mkEnableOption "the pylint Python linter"; + package = mkOption { + type = types.package; + default = pkgs.python3Packages.pylint; + defaultText = literalExpression "pkgs.python3Packages.pylint"; + description = "The pylint package to use."; + }; + settings = mkOption { + type = iniFormat.type; + default = { }; + defaultText = literalExpression "{}"; + description = "The pylint configuration."; + }; + }; + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + home.file.".pylintrc".source = iniFormat.generate "pylintrc" cfg.settings; + }; +}