diff --git a/home/david/configurations/Tytonidae/default.nix b/home/david/configurations/Tytonidae/default.nix index b1dd794..69ea362 100644 --- a/home/david/configurations/Tytonidae/default.nix +++ b/home/david/configurations/Tytonidae/default.nix @@ -25,6 +25,7 @@ ghostty.enable = true; foot.enable = false; starship.enable = true; + sops.enable = true; }; xdg.userDirs = { @@ -61,13 +62,11 @@ gawk zstd tree - nerd-fonts.victor-mono ouch dust qq telegram-desktop ghostty - sops scrcpy ast-grep lazygit @@ -123,10 +122,4 @@ format = "yaml"; sopsFile = rootPath + "/secrets/ssh-config.yaml"; }; - - sops.age = { - keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt"; - generateKey = false; - }; - sops.defaultSopsFile = rootPath + "/secrets/general.yaml"; } diff --git a/home/modules/default.nix b/home/modules/default.nix index a824df9..af9e2c7 100644 --- a/home/modules/default.nix +++ b/home/modules/default.nix @@ -13,6 +13,7 @@ ./ghostty.nix ./foot ./starship + ./sops.nix ]; options = { diff --git a/home/modules/sops.nix b/home/modules/sops.nix new file mode 100644 index 0000000..90f84d4 --- /dev/null +++ b/home/modules/sops.nix @@ -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"; + }; + }; +}