Files
notfiles/scripts/tests/shims/nixos-generate-config
T

20 lines
712 B
Bash
Executable File

#!/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