From 5d870740b6263e6170a706b617ec002715bbcd0a Mon Sep 17 00:00:00 2001 From: clerie Date: Sun, 22 Oct 2023 21:58:54 +0200 Subject: [PATCH 1/3] hosts/web-2: return known_hosts with proper mime type --- hosts/web-2/clerie.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hosts/web-2/clerie.nix b/hosts/web-2/clerie.nix index f145ae1..98f0d11 100644 --- a/hosts/web-2/clerie.nix +++ b/hosts/web-2/clerie.nix @@ -20,6 +20,9 @@ }; locations."= /ssh/known_hosts" = { alias = pkgs.writeText "known_hosts" (import ../../lib/ssh-known-hosts.nix); + extraConfig = '' + types { } default_type "text/plain; charset=utf-8"; + ''; }; locations."~ ^/.well-known/openpgpkey/hu/[a-z0-9]+/?$" = { extraConfig = '' From 4321b00c52ec3259d2413913c6f9a8d8d5db1363 Mon Sep 17 00:00:00 2001 From: clerie Date: Sun, 22 Oct 2023 22:35:36 +0200 Subject: [PATCH 2/3] pkgs/nixfiles: nixfiles-auto-install add entry for new host --- flake.nix | 1 + pkgs/nixfiles/nixfiles-auto-install.sh | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/flake.nix b/flake.nix index 91817dc..388cc00 100644 --- a/flake.nix +++ b/flake.nix @@ -70,6 +70,7 @@ storage-2 = { name = "storage-2"; }; web-2 = { name = "web-2"; }; zinc = { name = "zinc"; }; + # nixfiles-auto-install: add new host above _iso = { name = "_iso"; }; }; diff --git a/pkgs/nixfiles/nixfiles-auto-install.sh b/pkgs/nixfiles/nixfiles-auto-install.sh index 9f015cc..3d6ad50 100644 --- a/pkgs/nixfiles/nixfiles-auto-install.sh +++ b/pkgs/nixfiles/nixfiles-auto-install.sh @@ -105,6 +105,10 @@ 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" +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 +fi + echo "[I] Install NixOS" NIX_CONFIG=$(printf "extra-experimental-features = flakes nix-command\nextra-substituters = https://nix-cache.clerie.de\nextra-trusted-public-keys = nix-cache.clerie.de:bAt1GJTS9BOTcXFWj3nURrSlcjqikCev9yDvqArMP5g=\n") From 2150b4bfb083af339910f9a8bc30bb1a80a56ae8 Mon Sep 17 00:00:00 2001 From: clerie Date: Sun, 22 Oct 2023 23:01:02 +0200 Subject: [PATCH 3/3] pkgs/nixfiles: nixfiles-auto-install fix syntax of generated flake snipped --- pkgs/nixfiles/nixfiles-auto-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/nixfiles/nixfiles-auto-install.sh b/pkgs/nixfiles/nixfiles-auto-install.sh index 3d6ad50..5f6db7e 100644 --- a/pkgs/nixfiles/nixfiles-auto-install.sh +++ b/pkgs/nixfiles/nixfiles-auto-install.sh @@ -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" 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 echo "[I] Install NixOS"