From 21e0e90ff4d64f6aa47a8439d0b39e746fe2e7c3 Mon Sep 17 00:00:00 2001 From: Jan Schmitz <44864658+danjujan@users.noreply.github.com> Date: Thu, 13 Jun 2024 22:47:24 +0200 Subject: [PATCH 1/2] feat: add reuse --- modules/hooks.nix | 23 +++++++++++++++++++++++ nix/tools.nix | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/modules/hooks.nix b/modules/hooks.nix index 5590f3ab..d345568d 100644 --- a/modules/hooks.nix +++ b/modules/hooks.nix @@ -1294,6 +1294,20 @@ in }; }; }; + reuse = mkOption { + description = lib.mdDoc "reuse hook"; + type = types.submodule { + imports = [ hookModule ]; + options.settings = { + flags = mkOption { + type = types.str; + description = lib.mdDoc "Flags passed to reuse. For available options run 'reuse lint --help'"; + default = ""; + example = "--json"; + }; + }; + }; + }; revive = mkOption { description = lib.mdDoc "revive hook"; type = types.submodule { @@ -3088,6 +3102,15 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol entry = migrateBinPathToPackage hooks.pyupgrade "/bin/pyupgrade"; types = [ "python" ]; }; + reuse = + { + name = "reuse"; + description = "reuse is a tool for compliance with the REUSE recommendations."; + package = tools.reuse; + entry = "${hooks.reuse.package}/bin/reuse lint ${hooks.reuse.settings.flags}"; + types = [ "file" ]; + pass_filenames = false; + }; revive = { name = "revive"; diff --git a/nix/tools.nix b/nix/tools.nix index a04dc1bf..d8e0b091 100644 --- a/nix/tools.nix +++ b/nix/tools.nix @@ -157,7 +157,7 @@ in inherit (luaPackages) luacheck; inherit (nodePackages) eslint markdownlint-cli prettier pyright cspell; inherit (ocamlPackages) ocp-indent; - inherit (python3Packages) autoflake black flake8 flynt isort mkdocs-linkcheck mypy pre-commit-hooks pylint pyupgrade; + inherit (python3Packages) autoflake black flake8 flynt isort mkdocs-linkcheck mypy pre-commit-hooks pylint pyupgrade reuse; inherit (php82Packages) php-cs-fixer psalm; # FIXME: workaround build failure phpstan = php82Packages.phpstan.overrideAttrs (old: { From 7d16e39360278891ba80ce1660f2963972298250 Mon Sep 17 00:00:00 2001 From: Jan Schmitz <44864658+danjujan@users.noreply.github.com> Date: Wed, 19 Jun 2024 18:42:56 +0200 Subject: [PATCH 2/2] feat: fix reuse not found in flake check --- nix/tools.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nix/tools.nix b/nix/tools.nix index d8e0b091..d359d78f 100644 --- a/nix/tools.nix +++ b/nix/tools.nix @@ -55,6 +55,7 @@ , python3Packages , php82Packages , ripsecrets ? null +, reuse , ruff ? null , rustfmt , shellcheck @@ -131,6 +132,7 @@ in ormolu pre-commit-hook-ensure-sops poetry + reuse revive ripsecrets ruff @@ -157,7 +159,7 @@ in inherit (luaPackages) luacheck; inherit (nodePackages) eslint markdownlint-cli prettier pyright cspell; inherit (ocamlPackages) ocp-indent; - inherit (python3Packages) autoflake black flake8 flynt isort mkdocs-linkcheck mypy pre-commit-hooks pylint pyupgrade reuse; + inherit (python3Packages) autoflake black flake8 flynt isort mkdocs-linkcheck mypy pre-commit-hooks pylint pyupgrade; inherit (php82Packages) php-cs-fixer psalm; # FIXME: workaround build failure phpstan = php82Packages.phpstan.overrideAttrs (old: {