feat: improve scripts and write tests

This commit is contained in:
alexm committed 2026-10-11 07:22:13 -04:00
1 parent bc3091647e
commit cf4bd07a8e
32 files changed
+3817 -723

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Fake nixos-generate-config. Env: FAKE_NGC_MODE = ok (default) | fail | empty | partial-then-fail | garbage
echo "$*" > "${FAKE_NGC_ARGS:-/dev/null}"
case "${FAKE_NGC_MODE:-ok}" in
ok)
cat <<'EOF'
# Do not modify this file! It was generated by nixos-generate-config
{ config, lib, pkgs, modulesPath, ... }:
{
fileSystems."/" = { device = "/dev/disk/by-uuid/1234"; fsType = "ext4"; };
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}
EOF
;;
fail) echo "boom" >&2; exit 1 ;;
empty) exit 0 ;;
partial-then-fail) echo "{ half = of a file"; exit 1 ;;
garbage) echo "error: something went wrong but exit 0" ;;
esac