From 58446db110655336f67fadfafc3a23b6688357a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 12 Apr 2024 12:39:09 +0200 Subject: [PATCH] sops: fix secret path generation --- nixosModules/clanCore/facts/secret/sops.nix | 4 +++- nixosModules/clanCore/metadata.nix | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/nixosModules/clanCore/facts/secret/sops.nix b/nixosModules/clanCore/facts/secret/sops.nix index 86ce1ead..5e533ba8 100644 --- a/nixosModules/clanCore/facts/secret/sops.nix +++ b/nixosModules/clanCore/facts/secret/sops.nix @@ -45,7 +45,9 @@ in config = lib.mkIf (config.clanCore.facts.secretStore == "sops") { # Before we generate a secret we cannot know the path yet, so we need to set it to an empty string clanCore.facts.secretPathFunction = - secret: config.sops.secrets.${secret.config.name}.path or "/no-such-path"; + secret: + config.sops.secrets.${"${config.clanCore.machineName}-${secret.config.name}"}.path + or "/no-such-path"; clanCore.facts.secretModule = "clan_cli.facts.secret_modules.sops"; clanCore.facts.secretUploadDirectory = lib.mkDefault "/var/lib/sops-nix"; sops.secrets = builtins.mapAttrs (name: _: { diff --git a/nixosModules/clanCore/metadata.nix b/nixosModules/clanCore/metadata.nix index ad58ce08..d92e5791 100644 --- a/nixosModules/clanCore/metadata.nix +++ b/nixosModules/clanCore/metadata.nix @@ -36,6 +36,7 @@ }; machineName = lib.mkOption { type = lib.types.str; + default = "nixos"; description = '' the name of the machine '';