From b5ed7d822e71039608dae714bf76a05907bb04a3 Mon Sep 17 00:00:00 2001 From: unexplrd Date: Sun, 6 Apr 2025 13:49:15 +0300 Subject: [PATCH] hosts/dunamis/sops.nix: add hostname workaround hosts/eldrid/sops.nix: add hostname workaround hosts/sarien/sops.nix: add hostname workaround Signed-off-by: unexplrd --- hosts/dunamis/sops.nix | 6 ++++-- hosts/eldrid/sops.nix | 9 ++++++--- hosts/sarien/sops.nix | 18 ++++++++++++------ 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/hosts/dunamis/sops.nix b/hosts/dunamis/sops.nix index 71933be..68ca709 100644 --- a/hosts/dunamis/sops.nix +++ b/hosts/dunamis/sops.nix @@ -4,8 +4,10 @@ ... }: let inherit (inputs) mysecrets; - # TODO: stop relying on networking.hostName - inherit (config.networking) hostName; + hostName = + if (config.networking.hostName == "vylxae") + then "sarien" + else config.networking.hostName; sopsFile = mysecrets + "/hosts/${hostName}.yaml"; dotSsh = name: "/home/user/.ssh/" + name; sshKey = { diff --git a/hosts/eldrid/sops.nix b/hosts/eldrid/sops.nix index 19188e1..68ca709 100644 --- a/hosts/eldrid/sops.nix +++ b/hosts/eldrid/sops.nix @@ -4,8 +4,10 @@ ... }: let inherit (inputs) mysecrets; - # TODO: stop relying on networking.hostName - inherit (config.networking) hostName; + hostName = + if (config.networking.hostName == "vylxae") + then "sarien" + else config.networking.hostName; sopsFile = mysecrets + "/hosts/${hostName}.yaml"; dotSsh = name: "/home/user/.ssh/" + name; sshKey = { @@ -27,8 +29,9 @@ in { secrets = { "user-password-hashed".neededForUsers = true; "ssh-config" = { - inherit (sshKey) mode owner; path = dotSsh "config"; + mode = "0400"; + owner = "user"; }; "ssh-${hostName}-user" = { inherit sopsFile; diff --git a/hosts/sarien/sops.nix b/hosts/sarien/sops.nix index b72931d..68ca709 100644 --- a/hosts/sarien/sops.nix +++ b/hosts/sarien/sops.nix @@ -1,8 +1,14 @@ -{inputs, ...}: let +{ + config, + inputs, + ... +}: let inherit (inputs) mysecrets; - # TODO: stop relying on networking.hostName - hostname = "sarien"; - sopsFile = mysecrets + "/hosts/${hostname}.yaml"; + hostName = + if (config.networking.hostName == "vylxae") + then "sarien" + else config.networking.hostName; + sopsFile = mysecrets + "/hosts/${hostName}.yaml"; dotSsh = name: "/home/user/.ssh/" + name; sshKey = { mode = "0400"; @@ -27,12 +33,12 @@ in { mode = "0400"; owner = "user"; }; - "ssh-${hostname}-user" = { + "ssh-${hostName}-user" = { inherit sopsFile; inherit (sshKey) mode owner; path = dotSsh "id_ed25519"; }; - "ssh-${hostname}-user.pub" = { + "ssh-${hostName}-user.pub" = { inherit sopsFile; inherit (sshKey) mode owner; path = dotSsh "id_ed25519.pub";