Nixify shellcheck
Add shellcheck command to flake.nix and use it in the Gitlab
This commit is contained in:
+3
-3
@@ -51,9 +51,9 @@ validate:
|
|||||||
|
|
||||||
shellcheck:
|
shellcheck:
|
||||||
stage: lint
|
stage: lint
|
||||||
script: |-
|
tags:
|
||||||
shellcheck --version
|
- nix
|
||||||
shellcheck -e SC2239 $(find . -name '*.sh')
|
script: nix run ".#shellcheck"
|
||||||
|
|
||||||
# Downloads all the ISO files so that we have a single cache with all
|
# Downloads all the ISO files so that we have a single cache with all
|
||||||
# of them present. This prevents a race condition where some of the
|
# of them present. This prevents a race condition where some of the
|
||||||
|
|||||||
@@ -39,6 +39,10 @@
|
|||||||
package = self'.packages.cache;
|
package = self'.packages.cache;
|
||||||
category = "utils";
|
category = "utils";
|
||||||
help = "Downloads ISO files and adds them to the S3 bucket";
|
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;
|
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/
|
# https://numtide.github.io/treefmt/
|
||||||
|
|||||||
Reference in New Issue
Block a user