From b48b30de0e4bee9c83728ecf990c4f1ec8ad0a5d Mon Sep 17 00:00:00 2001 From: hsjobeki Date: Wed, 16 Apr 2025 07:14:25 +0000 Subject: [PATCH] revert db50ffc4b7ad711182345d170ee5791f595f6a1e 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. --- nixosModules/clanCore/vars/generator.nix | 57 +++++++++++------------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/nixosModules/clanCore/vars/generator.nix b/nixosModules/clanCore/vars/generator.nix index 677295f30..aae8dc22f 100644 --- a/nixosModules/clanCore/vars/generator.nix +++ b/nixosModules/clanCore/vars/generator.nix @@ -16,7 +16,7 @@ let ; promptToFile = name: '' - cat "$prompts"/${name} > "$out"/${name} + cat "$prompts/${name}" > "$out/${name}" ''; promptsToFilesScript = concatMapStrings promptToFile; @@ -25,42 +25,35 @@ let in { finalScript = mkOptionDefault ( - lib.getExe ( - pkgs.writeShellApplication { - name = "generator-${config.name}"; - text = '' - in="''${in:?}" - out="''${out:?}" - ${if config.prompts == { } then "" else ''prompts="''${prompts:?}"''} + pkgs.writeScript "generator-${config.name}" '' + set -eu -o pipefail - export PATH="${makeBinPath config.runtimeInputs}:${pkgs.coreutils}/bin" + export PATH="${makeBinPath config.runtimeInputs}:${pkgs.coreutils}/bin" - ${optionalString (pkgs.stdenv.hostPlatform.isLinux) '' - # prepare sandbox user on platforms where this is supported - mkdir -p /etc + ${optionalString (pkgs.stdenv.hostPlatform.isLinux) '' + # prepare sandbox user on platforms where this is supported + mkdir -p /etc - cat > /etc/group < /etc/group < /etc/passwd < /etc/passwd < /etc/hosts < /etc/hosts <