revert vars: use writeShellApplication to shellcheck generators

Cannot re-generate the vars for data-mesher or any of our tests anymore

cc @DavHau @Qubasa Can we work together to fix this.
I like shellchecking but if we loose the ability to add tests thats unfortunate
This is blocking: the new 'restic' and 'zerotier' migrations because we need to write integration tests from the beginning.
This commit is contained in:
hsjobeki
2025-04-16 07:14:25 +00:00
parent 3ef83deeeb
commit b48b30de0e

View File

@@ -16,7 +16,7 @@ let
; ;
promptToFile = name: '' promptToFile = name: ''
cat "$prompts"/${name} > "$out"/${name} cat "$prompts/${name}" > "$out/${name}"
''; '';
promptsToFilesScript = concatMapStrings promptToFile; promptsToFilesScript = concatMapStrings promptToFile;
@@ -25,42 +25,35 @@ let
in in
{ {
finalScript = mkOptionDefault ( finalScript = mkOptionDefault (
lib.getExe ( pkgs.writeScript "generator-${config.name}" ''
pkgs.writeShellApplication { set -eu -o pipefail
name = "generator-${config.name}";
text = ''
in="''${in:?}"
out="''${out:?}"
${if config.prompts == { } then "" else ''prompts="''${prompts:?}"''}
export PATH="${makeBinPath config.runtimeInputs}:${pkgs.coreutils}/bin" export PATH="${makeBinPath config.runtimeInputs}:${pkgs.coreutils}/bin"
${optionalString (pkgs.stdenv.hostPlatform.isLinux) '' ${optionalString (pkgs.stdenv.hostPlatform.isLinux) ''
# prepare sandbox user on platforms where this is supported # prepare sandbox user on platforms where this is supported
mkdir -p /etc mkdir -p /etc
cat > /etc/group <<EOF cat > /etc/group <<EOF
root:x:0: root:x:0:
nixbld:!:$(id -g): nixbld:!:$(id -g):
nogroup:x:65534: nogroup:x:65534:
EOF EOF
cat > /etc/passwd <<EOF cat > /etc/passwd <<EOF
root:x:0:0:Nix build user:/build:/noshell root:x:0:0:Nix build user:/build:/noshell
nixbld:x:$(id -u):$(id -g):Nix build user:/build:/noshell nixbld:x:$(id -u):$(id -g):Nix build user:/build:/noshell
nobody:x:65534:65534:Nobody:/:/noshell nobody:x:65534:65534:Nobody:/:/noshell
EOF EOF
cat > /etc/hosts <<EOF cat > /etc/hosts <<EOF
127.0.0.1 localhost 127.0.0.1 localhost
::1 localhost ::1 localhost
EOF EOF
''} ''}
${promptsToFilesScript filePromptNames} ${promptsToFilesScript filePromptNames}
${config.script} ${config.script}
''; ''
}
)
); );
files = genAttrs filePromptNames (_name: { }); files = genAttrs filePromptNames (_name: { });