sops updates
This commit is contained in:
@@ -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}" ];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user