1
0

pkgs/nixfiles: nixfiles-auto-install fix syntax of generated flake snipped

This commit is contained in:
clerie 2023-10-22 23:01:02 +02:00
parent 4321b00c52
commit 2150b4bfb0

View File

@ -106,7 +106,7 @@ nixfiles-generate-config --root /mnt --hostname "${hostname}"
sed -i "s~# boot\.loader\.grub\.device = \"/dev/sda\";~boot\.loader\.grub\.device = \"${device}\";~g" "/mnt/etc/nixos/hosts/${hostname}/configuration.nix" sed -i "s~# boot\.loader\.grub\.device = \"/dev/sda\";~boot\.loader\.grub\.device = \"${device}\";~g" "/mnt/etc/nixos/hosts/${hostname}/configuration.nix"
if ! grep -w "${hostname}" <(nix eval "/mnt/etc/nixos#clerie.hosts" --apply 'hosts: builtins.concatStringsSep "\n" (builtins.attrNames hosts)' --raw 2> /dev/null) > /dev/null; then if ! grep -w "${hostname}" <(nix eval "/mnt/etc/nixos#clerie.hosts" --apply 'hosts: builtins.concatStringsSep "\n" (builtins.attrNames hosts)' --raw 2> /dev/null) > /dev/null; then
sed -i "s/\(\s*\)# nixfiles-auto-install: add new host above/\1${hostname} = { name = \"${hostname}\"};\n&/g" /mnt/etc/nixos/flake.nix sed -i "s/\(\s*\)# nixfiles-auto-install: add new host above/\1${hostname} = { name = \"${hostname}\"; };\n&/g" /mnt/etc/nixos/flake.nix
fi fi
echo "[I] Install NixOS" echo "[I] Install NixOS"