Create home-manager module for sops

This commit is contained in:
Pim Kunis 2024-11-11 21:57:58 +01:00
parent 8c35cb9f61
commit 9ccbf41324
4 changed files with 26 additions and 11 deletions

View file

@ -12,7 +12,7 @@
./gnome.nix ./gnome.nix
./syncthing.nix ./syncthing.nix
./vscode.nix ./vscode.nix
inputs.sops-nix.homeManagerModules.sops ./sops.nix
inputs.nix-index-database.hmModules.nix-index inputs.nix-index-database.hmModules.nix-index
]; ];
@ -245,13 +245,4 @@
}; };
}; };
}; };
sops = {
age.keyFile = "${config.xdg.configHome}/sops/age/keys.txt";
defaultSopsFile = "${self}/secrets/pim.yaml";
secrets = {
"keepassxc".path = "${config.xdg.configHome}/keepassxc/keepassxc.ini";
};
};
} }

23
home-manager/sops.nix Normal file
View file

@ -0,0 +1,23 @@
{
self,
config,
inputs,
lib,
...
}: let
cfg = config.pim.sops;
in {
imports = [inputs.sops-nix.homeManagerModules.sops];
options.pim.sops.enable = lib.mkEnableOption "sops";
config = lib.mkIf cfg.enable {
sops = {
age.keyFile = "${config.xdg.configHome}/sops/age/keys.txt";
defaultSopsFile = "${self}/secrets/pim.yaml";
secrets = {
"keepassxc".path = "${config.xdg.configHome}/keepassxc/keepassxc.ini";
};
};
};
}

View file

@ -7,6 +7,7 @@
syncthing.enable = true; syncthing.enable = true;
neovim.enable = true; neovim.enable = true;
firefox.enable = true; firefox.enable = true;
sops.enable = true;
}; };
home.packages = home.packages =

View file

@ -12,7 +12,7 @@ in {
options.pim.sops.enable = lib.mkEnableOption "sops"; options.pim.sops.enable = lib.mkEnableOption "sops";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [sops]; environment.systemPackages = [pkgs.sops];
sops = { sops = {
age.keyFile = "/home/pim/.config/sops/age/keys.txt"; age.keyFile = "/home/pim/.config/sops/age/keys.txt";