Skip to content

Commit

Permalink
Use for loop instead of formatlist()
Browse files Browse the repository at this point in the history
  • Loading branch information
amezin committed Feb 4, 2025
1 parent aaf1e44 commit bee69f7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion fedora.ks
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ bootloader --location=mbr
firstboot --disable
autopart
user --name=vagrant --groups=wheel --password=vagrant --plaintext
${join("\n", formatlist("sshkey --username=vagrant \"%s\"", compact(split("\n", file("${path.root}/keys/vagrant.pub")))))}
%{ for key in compact(split("\n", file("${path.root}/keys/vagrant.pub"))) ~}
sshkey --username=vagrant ${jsonencode(key)}
%{ endfor ~}
reboot

repo --name=fedora --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch
Expand Down
4 changes: 3 additions & 1 deletion nix/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
packages = with pkgs; [
];
openssh.authorizedKeys.keys = [
${join("\n", formatlist("\"%s\"", compact(split("\n", file("${path.root}/keys/vagrant.pub")))))}
%{ for key in compact(split("\n", file("${path.root}/keys/vagrant.pub"))) ~}
${jsonencode(key)}
%{ endfor ~}
];
};

Expand Down
4 changes: 3 additions & 1 deletion silverblue.ks
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ bootloader --location=mbr
firstboot --disable
autopart
user --name=vagrant --groups=wheel --password=vagrant --plaintext
${join("\n", formatlist("sshkey --username=vagrant \"%s\"", compact(split("\n", file("${path.root}/keys/vagrant.pub")))))}
%{ for key in compact(split("\n", file("${path.root}/keys/vagrant.pub"))) ~}
sshkey --username=vagrant ${jsonencode(key)}
%{ endfor ~}
ostreesetup --osname="fedora-silverblue" --remote="fedora" --url="file:///ostree/repo" --ref="fedora/${version}/x86_64/silverblue" --nogpg
reboot

Expand Down

0 comments on commit bee69f7

Please sign in to comment.