Changed the location of secrets.nix and adapted it

This commit is contained in:
Alexandre 2025-12-28 01:04:14 +01:00
parent 1f9a3f6869
commit 4818ff82af
4 changed files with 15 additions and 11 deletions

View File

@ -5,9 +5,11 @@
imports = [ imports = [
inputs.spicetify-nix.homeManagerModules.spicetify inputs.spicetify-nix.homeManagerModules.spicetify
../../modules/home-manager/spicetify.nix ../../modules/home-manager/spicetify.nix
../../modules/home-manager/secrets.nix
../../modules/common/zed.nix ../../modules/common/zed.nix
]; ];
programs = { programs = {
# Git config # Git config
git = { git = {

View File

@ -5,7 +5,6 @@
imports = imports =
[ [
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
inputs.sops-nix.homeManagerModules.sops
../../modules/nixos/secrets.nix # Sops ../../modules/nixos/secrets.nix # Sops
../../modules/nixos/wireless.nix # For the wifi ../../modules/nixos/wireless.nix # For the wifi
../../modules/nixos/locale.nix # For localisation options ../../modules/nixos/locale.nix # For localisation options

View File

@ -377,15 +377,16 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
# Secrets management with Sops-nix
sops.secrets = lib.mkIf (cfg.githubToken != null || cfg.braveSearchApiKey != null) { sops = lib.mkIf (cfg.githubToken != null || cfg.braveSearchApiKey != null) {
secrets = {
"zed/github_token" = lib.mkIf (cfg.githubToken != null) { "zed/github_token" = lib.mkIf (cfg.githubToken != null) {
sopsFile = ../../secrets/secrets.yaml; sopsFile = ../../secrets/secrets.yaml;
owner = config.home.username or "alex";
}; };
"zed/brave_api_key" = lib.mkIf (cfg.braveSearchApiKey != null) { "zed/brave_api_key" = lib.mkIf (cfg.braveSearchApiKey != null) {
sopsFile = ../../secrets/secrets.yaml; sopsFile = ../../secrets/secrets.yaml;
owner = config.home.username or "alex"; };
}; };
}; };

View File

@ -1,8 +1,10 @@
{ config, ... }:
{ {
sops = { sops = {
defaultSopsFile = ../../secrets/secrets.yaml; defaultSopsFile = ../../secrets/secrets.yaml;
defaultSopsFormat = "yaml"; defaultSopsFormat = "yaml";
age.keyFile = "/home/alex/.config/sops/age/keys.txt"; age.keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt";
}; };
} }