nixos/home/modules/sops.nix

49 lines
871 B
Nix
Raw Normal View History

2025-01-12 20:19:42 +08:00
{
lib,
config,
pkgs,
rootPath,
...
}:
{
options = {
youthlic.programs.sops = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = ''
whether enable sops-nix or not
'';
};
keyFile = lib.mkOption {
type = lib.types.nonEmptyStr;
2025-01-19 23:59:14 +08:00
default = "/var/sops/key.txt";
2025-01-12 20:19:42 +08:00
description = ''
path to age key file
'';
};
};
};
config =
let
cfg = config.youthlic.programs.sops;
in
lib.mkIf cfg.enable {
home.packages = (
with pkgs;
[
sops
age
]
);
sops = {
age = {
keyFile = cfg.keyFile;
generateKey = false;
};
defaultSopsFile = rootPath + "/secrets/general.yaml";
};
};
}