clear (refactor options): refactor options
This commit is contained in:
parent
00ea2b0c36
commit
bfce36ce73
22 changed files with 340 additions and 463 deletions
|
|
@ -5,45 +5,34 @@
|
|||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkIf mkOption mkEnableOption;
|
||||
inherit (lib.types) str;
|
||||
|
||||
cfg = config.home.security;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
home.security = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Security stuff.";
|
||||
options.home.security = {
|
||||
enable = mkEnableOption "Security stuff.";
|
||||
gpg = {
|
||||
enable = mkEnableOption "GPG configurations.";
|
||||
homeDir = mkOption {
|
||||
type = str;
|
||||
default = "${config.home.homeDirectory}/.gpg";
|
||||
description = "GPG config directory.";
|
||||
};
|
||||
gpg = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "GPG configurations.";
|
||||
};
|
||||
homeDir = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "${config.home.homeDirectory}/.gpg";
|
||||
description = "GPG config directory.";
|
||||
};
|
||||
};
|
||||
ssh = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "SSH base configurations.";
|
||||
};
|
||||
homeDir = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "${config.home.homeDirectory}/.ssh";
|
||||
description = "SSH config directory.";
|
||||
};
|
||||
};
|
||||
ssh = {
|
||||
enable = mkEnableOption "SSH base configurations.";
|
||||
homeDir = mkOption {
|
||||
type = str;
|
||||
default = "${config.home.homeDirectory}/.ssh";
|
||||
description = "SSH config directory.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.gpg = lib.mkIf cfg.gpg.enable {
|
||||
config = mkIf cfg.enable {
|
||||
programs.gpg = mkIf cfg.gpg.enable {
|
||||
enable = true;
|
||||
package = pkgs.gnupg;
|
||||
mutableKeys = true;
|
||||
|
|
@ -56,12 +45,12 @@ in
|
|||
keyid-format = "0xlong";
|
||||
};
|
||||
};
|
||||
services.gpg-agent = lib.mkIf cfg.gpg.enable {
|
||||
services.gpg-agent = mkIf cfg.gpg.enable {
|
||||
enable = true;
|
||||
pinentry.package = pkgs.pinentry-qt;
|
||||
};
|
||||
|
||||
programs.ssh = lib.mkIf cfg.ssh.enable {
|
||||
programs.ssh = mkIf cfg.ssh.enable {
|
||||
enable = true;
|
||||
enableDefaultConfig = false;
|
||||
package = pkgs.openssh;
|
||||
|
|
|
|||
Reference in a new issue