Merge pull request 'revert vars: use writeShellApplication to shellcheck generators' (#3331) from hsjobeki-patch-1 into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3331
This commit is contained in:
@@ -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 <<EOF
|
||||
root:x:0:
|
||||
nixbld:!:$(id -g):
|
||||
nogroup:x:65534:
|
||||
EOF
|
||||
cat > /etc/group <<EOF
|
||||
root:x:0:
|
||||
nixbld:!:$(id -g):
|
||||
nogroup:x:65534:
|
||||
EOF
|
||||
|
||||
cat > /etc/passwd <<EOF
|
||||
root:x:0:0:Nix build user:/build:/noshell
|
||||
nixbld:x:$(id -u):$(id -g):Nix build user:/build:/noshell
|
||||
nobody:x:65534:65534:Nobody:/:/noshell
|
||||
EOF
|
||||
cat > /etc/passwd <<EOF
|
||||
root:x:0:0:Nix build user:/build:/noshell
|
||||
nixbld:x:$(id -u):$(id -g):Nix build user:/build:/noshell
|
||||
nobody:x:65534:65534:Nobody:/:/noshell
|
||||
EOF
|
||||
|
||||
cat > /etc/hosts <<EOF
|
||||
127.0.0.1 localhost
|
||||
::1 localhost
|
||||
EOF
|
||||
''}
|
||||
${promptsToFilesScript filePromptNames}
|
||||
${config.script}
|
||||
'';
|
||||
}
|
||||
)
|
||||
cat > /etc/hosts <<EOF
|
||||
127.0.0.1 localhost
|
||||
::1 localhost
|
||||
EOF
|
||||
''}
|
||||
${promptsToFilesScript filePromptNames}
|
||||
${config.script}
|
||||
''
|
||||
);
|
||||
|
||||
files = genAttrs filePromptNames (_name: { });
|
||||
|
||||
Reference in New Issue
Block a user