diff --git a/hosts/common/home.nix b/hosts/common/home.nix index 960292c..0545e87 100644 --- a/hosts/common/home.nix +++ b/hosts/common/home.nix @@ -5,9 +5,11 @@ imports = [ inputs.spicetify-nix.homeManagerModules.spicetify ../../modules/home-manager/spicetify.nix + ../../modules/home-manager/secrets.nix ../../modules/common/zed.nix ]; + programs = { # Git config git = { diff --git a/hosts/nixos/modules.nix b/hosts/nixos/modules.nix index 734ade6..83cf4b8 100644 --- a/hosts/nixos/modules.nix +++ b/hosts/nixos/modules.nix @@ -5,7 +5,6 @@ imports = [ inputs.sops-nix.nixosModules.sops - inputs.sops-nix.homeManagerModules.sops ../../modules/nixos/secrets.nix # Sops ../../modules/nixos/wireless.nix # For the wifi ../../modules/nixos/locale.nix # For localisation options diff --git a/modules/common/zed.nix b/modules/common/zed.nix index 4bee2e4..3f0d6a0 100644 --- a/modules/common/zed.nix +++ b/modules/common/zed.nix @@ -377,15 +377,16 @@ in }; config = lib.mkIf cfg.enable { - # Secrets management with Sops-nix - sops.secrets = lib.mkIf (cfg.githubToken != null || cfg.braveSearchApiKey != null) { - "zed/github_token" = lib.mkIf (cfg.githubToken != null) { - sopsFile = ../../secrets/secrets.yaml; - owner = config.home.username or "alex"; - }; - "zed/brave_api_key" = lib.mkIf (cfg.braveSearchApiKey != null) { - sopsFile = ../../secrets/secrets.yaml; - owner = config.home.username or "alex"; + + sops = lib.mkIf (cfg.githubToken != null || cfg.braveSearchApiKey != null) { + secrets = { + "zed/github_token" = lib.mkIf (cfg.githubToken != null) { + sopsFile = ../../secrets/secrets.yaml; + }; + + "zed/brave_api_key" = lib.mkIf (cfg.braveSearchApiKey != null) { + sopsFile = ../../secrets/secrets.yaml; + }; }; }; diff --git a/modules/nixos/secrets.nix b/modules/home-manager/secrets.nix similarity index 52% rename from modules/nixos/secrets.nix rename to modules/home-manager/secrets.nix index 4a37f7e..430cfca 100644 --- a/modules/nixos/secrets.nix +++ b/modules/home-manager/secrets.nix @@ -1,8 +1,10 @@ +{ config, ... }: + { sops = { defaultSopsFile = ../../secrets/secrets.yaml; defaultSopsFormat = "yaml"; - age.keyFile = "/home/alex/.config/sops/age/keys.txt"; + age.keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt"; }; }