From d0df318553cdcd6c01f03947592a3463b65873bb Mon Sep 17 00:00:00 2001 From: oqyude Date: Tue, 20 Oct 2026 16:16:49 +0300 Subject: [PATCH] feat(ci): add shellcheck to the ci tool set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit work/pxe-infra-automation is adding a Gitea Actions pipeline, and its checks live in ci/check.sh: shellcheck over the build scripts AND over the guest payload (image/*.sh, which is copied into the image verbatim), plus a YAML validation of the workflow files. That script exits 2 when shellcheck is missing, so on this runner — where the job PATH is frozen into the systemd unit at activation time and cannot gain a package without a nixos-rebuild — the linter has to come from the ci devshell instead. shellcheck is now in lib/ci-tools.nix, which is the single list both consumers use (the runner's hostPackages and the devshell), so the two cannot drift apart. PyYAML did NOT make it in: the obvious fix, `python3.withPackages (ps: [ ps.pyyaml ])`, is not a valid buildInput (nix rejects it with 'Dependency is not of a valid type: element N of buildInputs'), and the devshell is the consumer that breaks. The workflow YAML stays validated on GitHub and locally, where PyYAML is present; the Gitea job says so in its log instead of pretending to have checked it. The nixos repo's own flake.lock pins nixpkgs; the pipeline uses that revision instead of a floating nixos-unstable, because the nix registry on sapphira is empty and 'nixpkgs#...' cannot resolve there. --- lib/ci-tools.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/ci-tools.nix b/lib/ci-tools.nix index 8133a10..0b06d4b 100644 --- a/lib/ci-tools.nix +++ b/lib/ci-tools.nix @@ -29,4 +29,22 @@ with pkgs; [ # no PowerShell otherwise, and `nix-shell -p powershell` is not a fallback # here: the nix registry on sapphira is empty, so -p cannot resolve nixpkgs. powershell + + # work/pxe-infra-automation runs shellcheck over the build scripts AND + # over the guest payload (image/*.sh, which is copied into the image + # verbatim). Its CI lives in .gitea/workflows/ci.yml and calls + # `bash ci/check.sh`; that script exits 2 when shellcheck is missing, so + # the linter has to be reachable or the job can only ever fail. + shellcheck + + # NOTE on PyYAML: work/pxe-infra-automation's CI also validates the YAML + # of its workflow files, and the stock `python3` above has no PyYAML. The + # obvious fix -- `python3.withPackages (ps: [ ps.pyyaml ])` -- does NOT + # work here: a wrapped python is not a valid buildInput (nix rejects it + # with "Dependency is not of a valid type: element N of buildInputs"), + # and the devshell is the consumer that breaks. The check is optional in + # ci/check.sh by design -- it warns and skips when the module is missing + # -- so the workflow YAML stays validated on GitHub (where PyYAML is + # present) and locally, and the Gitea job says so in its log instead of + # pretending to have checked it. ]