Skip to content

Commit

Permalink
Move variable definitions closer to their usage
Browse files Browse the repository at this point in the history
  • Loading branch information
evolutics committed Mar 23, 2024
1 parent 4b7dc56 commit 4b33d07
Showing 1 changed file with 48 additions and 32 deletions.
80 changes: 48 additions & 32 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,22 @@
flake-utils.lib.eachDefaultSystem (
system: let
cleaners = let
alejandra = [(pkgs.lib.makeBinPath [pkgs.alejandra]) "alejandra"];
black = [(pkgs.lib.makeBinPath [pkgs.black]) "black"];
git = [(pkgs.lib.makeBinPath [pkgs.git]) "git"];
gitlint = [(pkgs.lib.makeBinPath [pkgs.gitlint]) "gitlint"];
hadolint = [(pkgs.lib.makeBinPath [pkgs.hadolint]) "hadolint"];
html5validator = [(pkgs.lib.makeBinPath [pkgs.html5validator]) "html5validator"];
htmlhint = [(pkgs.lib.makeBinPath [pkgs.nodePackages.htmlhint]) "htmlhint"];
isort = [(pkgs.lib.makeBinPath [pkgs.isort]) "isort"];
jsonnetfmt = [(pkgs.lib.makeBinPath [pkgs.go-jsonnet]) "jsonnetfmt"];
jsonnetLint = [(pkgs.lib.makeBinPath [pkgs.go-jsonnet]) "jsonnet-lint"];
prettier = [(pkgs.lib.makeBinPath [pkgs.nodePackages.prettier]) "prettier"];
pylint = [(pkgs.lib.makeBinPath [pkgs.pylint]) "pylint"];
rufo = [(pkgs.lib.makeBinPath [pkgs.rufo]) "rufo"];
shellcheck = [(pkgs.lib.makeBinPath [pkgs.shellcheck]) "shellcheck"];
shfmt = [(pkgs.lib.makeBinPath [pkgs.shfmt]) "shfmt"];
stylelint = [(pkgs.lib.makeBinPath [pkgs.nodePackages.stylelint]) "stylelint"];
terraform = [(pkgs.lib.makeBinPath [pkgs.terraform]) "terraform"];
in
builtins.toJSON {
alejandra = {
alejandra = let
alejandra = [(pkgs.lib.makeBinPath [pkgs.alejandra]) "alejandra"];
in {
title = "Alejandra";
homepage = pkgs.alejandra.meta.homepage;
is_only_active_if_command = [];
file_pattern = "\\.nix$";
check = alejandra ++ ["--check" "--"];
fix = alejandra ++ ["--"];
};
black = {
black = let
black = [(pkgs.lib.makeBinPath [pkgs.black]) "black"];
in {
title = "Black";
homepage = pkgs.black.meta.homepage;
is_only_active_if_command = [];
Expand All @@ -58,23 +46,29 @@
check = git ++ ["diff" "--check" "HEAD^" "--"];
fix = [];
};
gitlint = {
gitlint = let
gitlint = [(pkgs.lib.makeBinPath [pkgs.gitlint]) "gitlint"];
in {
title = "Gitlint";
homepage = pkgs.gitlint.meta.homepage;
is_only_active_if_command = git ++ ["rev-parse"];
file_pattern = null;
check = gitlint ++ ["--ignore" "body-is-missing"];
fix = [];
};
hadolint = {
hadolint = let
hadolint = [(pkgs.lib.makeBinPath [pkgs.hadolint]) "hadolint"];
in {
title = "Haskell Dockerfile Linter";
homepage = pkgs.hadolint.meta.homepage;
is_only_active_if_command = [];
file_pattern = "(^|[./])Dockerfile$";
check = hadolint ++ ["--"];
fix = [];
};
html5validator = {
html5validator = let
html5validator = [(pkgs.lib.makeBinPath [pkgs.html5validator]) "html5validator"];
in {
title = "HTML5 Validator";
homepage = pkgs.html5validator.meta.homepage;
is_only_active_if_command = [];
Expand All @@ -89,15 +83,19 @@
];
fix = [];
};
htmlhint = {
htmlhint = let
htmlhint = [(pkgs.lib.makeBinPath [pkgs.nodePackages.htmlhint]) "htmlhint"];
in {
title = "HTMLHint";
homepage = pkgs.nodePackages.htmlhint.meta.homepage;
is_only_active_if_command = [];
file_pattern = "\\.(htm|html)$";
check = htmlhint ++ ["--"];
fix = [];
};
isort = {
isort = let
isort = [(pkgs.lib.makeBinPath [pkgs.isort]) "isort"];
in {
title = "isort";
homepage = pkgs.isort.meta.homepage;
is_only_active_if_command = [];
Expand All @@ -123,23 +121,29 @@
"--"
];
};
jsonnet-lint = {
jsonnet-lint = let
jsonnetLint = [(pkgs.lib.makeBinPath [pkgs.go-jsonnet]) "jsonnet-lint"];
in {
title = "Jsonnet linter";
homepage = "https://jsonnet.org/learning/tools.html";
is_only_active_if_command = [];
file_pattern = "\\.(jsonnet|libsonnet)$";
check = jsonnetLint ++ ["--"];
fix = [];
};
jsonnetfmt = {
jsonnetfmt = let
jsonnetfmt = [(pkgs.lib.makeBinPath [pkgs.go-jsonnet]) "jsonnetfmt"];
in {
title = "Jsonnet formatter";
homepage = "https://jsonnet.org/learning/tools.html";
is_only_active_if_command = [];
file_pattern = "\\.(jsonnet|libsonnet)$";
check = jsonnetfmt ++ ["--test" "--"];
fix = jsonnetfmt ++ ["--in-place" "--"];
};
prettier = {
prettier = let
prettier = [(pkgs.lib.makeBinPath [pkgs.nodePackages.prettier]) "prettier"];
in {
title = "Prettier";
homepage = pkgs.nodePackages.prettier.meta.homepage;
is_only_active_if_command = [];
Expand All @@ -161,31 +165,39 @@
"--"
];
};
pylint = {
pylint = let
pylint = [(pkgs.lib.makeBinPath [pkgs.pylint]) "pylint"];
in {
title = "Pylint";
homepage = pkgs.pylint.meta.homepage;
is_only_active_if_command = [];
file_pattern = "\\.py$";
check = pylint ++ ["--"];
fix = [];
};
rufo = {
rufo = let
rufo = [(pkgs.lib.makeBinPath [pkgs.rufo]) "rufo"];
in {
title = "Rufo";
homepage = pkgs.rufo.meta.homepage;
is_only_active_if_command = [];
file_pattern = "(\\.rb|(^|/)Vagrantfile)$";
check = rufo ++ ["--check" "--"];
fix = rufo ++ ["--"];
};
shellcheck = {
shellcheck = let
shellcheck = [(pkgs.lib.makeBinPath [pkgs.shellcheck]) "shellcheck"];
in {
title = "ShellCheck";
homepage = pkgs.shellcheck.meta.homepage;
is_only_active_if_command = [];
file_pattern = "\\.sh$";
check = shellcheck ++ ["--"];
fix = [];
};
shfmt = {
shfmt = let
shfmt = [(pkgs.lib.makeBinPath [pkgs.shfmt]) "shfmt"];
in {
title = "shfmt";
homepage = pkgs.shfmt.meta.homepage;
is_only_active_if_command = [];
Expand Down Expand Up @@ -213,15 +225,19 @@
"--"
];
};
stylelint = {
stylelint = let
stylelint = [(pkgs.lib.makeBinPath [pkgs.nodePackages.stylelint]) "stylelint"];
in {
title = "Stylelint";
homepage = pkgs.nodePackages.stylelint.meta.homepage;
is_only_active_if_command = [];
file_pattern = "\\.css$";
check = stylelint ++ ["--"];
fix = [];
};
terraform = {
terraform = let
terraform = [(pkgs.lib.makeBinPath [pkgs.terraform]) "terraform"];
in {
title = "Terraform fmt";
homepage = "https://developer.hashicorp.com/terraform/cli/commands/fmt";
is_only_active_if_command = [];
Expand Down

0 comments on commit 4b33d07

Please sign in to comment.