Nixify shellcheck

Add shellcheck command to flake.nix and use it in the Gitlab
This commit is contained in:
Greg Hellings
2024-06-24 23:04:16 -05:00
parent c5875f9943
commit f138e5af3e
2 changed files with 21 additions and 3 deletions
+18
View File
@@ -39,6 +39,10 @@
package = self'.packages.cache;
category = "utils";
help = "Downloads ISO files and adds them to the S3 bucket";
} {
package = self'.packages.shellcheck;
category = "utils";
help = "Run shellchecks";
} ];
};
@@ -62,6 +66,20 @@
];
text = builtins.readFile ./cache-restore.sh;
};
shellcheck = pkgs.writeShellApplication {
name = "shellcheck";
runtimeInputs = with pkgs; [
shellcheck
];
text = ''
scripts=()
shopt -s globstar
for f in **/*.sh; do
scripts+=("$f")
done
shellcheck -e SC2239 "''${scripts[@]}"
'';
};
};
# https://numtide.github.io/treefmt/