sops updates

This commit is contained in:
John Lancaster
2026-03-24 22:51:59 -05:00
parent 33ccad5bf6
commit eac053ca07
3 changed files with 12 additions and 17 deletions
+6 -7
View File
@@ -12,7 +12,6 @@ in
flake.modules.nixos.mysops = {
imports = [ inputs.sops-nix.nixosModules.sops ];
# sops.defaultSopsFile = ../../keys/secrets.yaml;
};
# Define the homeModules that are used by flake-parts
@@ -23,6 +22,10 @@ in
sopsBin = lib.getExe pkgs.sops;
sopsConfigPath = ../../.sops.yaml;
sopsSecretsPath = ../../keys/secrets.yaml;
editScript = lib.optional (cfg.hostSecretFile != null) (pkgs.writeShellScriptBin "edit-secrets" ''
${sopsBin} --config ${sopsConfigPath} ${cfg.hostSecretFile}
'');
in
{
imports = [
@@ -31,7 +34,6 @@ in
];
options.mysops = {
enable = lib.mkEnableOption "Customized SOPS tools";
ageKeyFile = lib.mkOption {
description = "Default location for the age key";
type = lib.types.str;
@@ -70,17 +72,14 @@ in
'')
(writeShellScriptBin "show-age-key" "${lib.getExe' pkgs.age "age-keygen"} -y ${cfg.ageKeyFile}")
(writeShellScriptBin "ls-secrets" "${lib.getExe pkgs.eza} -alT --follow-symlinks ~/.config/sops-nix/secrets")
] ++ lib.optional (cfg.hostSecretFile != null) (writeShellScriptBin "edit-secrets" ''
set -e
${sopsBin} --config ${sopsConfigPath} ${cfg.hostSecretFile}
'');
] ++ editScript;
home.shellAliases.sops = "${sopsBin} --config ${sopsConfigPath}";
# Option definitions for the sops home-manager module:
# https://github.com/Mic92/sops-nix/blob/master/modules/home-manager/sops.nix
sops = {
# defaultSopsFile = sopsSecretsPath;
defaultSopsFile = sopsSecretsPath;
defaultSopsFormat = "yaml";
age.sshKeyPaths = [ "${config.ssh.IdentityFile}" ];
};