move home sops config to module
This commit is contained in:
parent
991a8b4bbc
commit
4087865b8f
3 changed files with 50 additions and 8 deletions
48
home/modules/sops.nix
Normal file
48
home/modules/sops.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
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;
|
||||
default = "${config.home.homeDirectory}/.config/sops/age/keys.txt";
|
||||
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";
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue