feat: Encryption
This commit is contained in:
30
modules/home/gpg.nix
Executable file
30
modules/home/gpg.nix
Executable file
@@ -0,0 +1,30 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let cfg = config.sydnix.gpg;
|
||||
mutableSymlink = config.lib.file.mkOutOfStoreSymlink;
|
||||
in {
|
||||
options = {
|
||||
sydnix.gpg = {
|
||||
enable = lib.mkEnableOption "GnuPG";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.gpg = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
services.gpg-agent = {
|
||||
enable = true;
|
||||
enableSshSupport = true;
|
||||
enableBashIntegration = config.programs.bash.enable;
|
||||
extraConfig =
|
||||
"allow-loopback-pinentry"
|
||||
+ lib.optionalString
|
||||
config.programs.emacs.enable "\nallow-emacs-pinentry";
|
||||
};
|
||||
|
||||
home.file."private-keys/gpg/crumb".source =
|
||||
mutableSymlink "/persist/private-keys/gpg/${config.home.username}";
|
||||
};
|
||||
}
|
||||
@@ -19,6 +19,10 @@ in {
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [
|
||||
pkgs.sops
|
||||
];
|
||||
|
||||
sops = {
|
||||
age.keyFile = cfg.keyFile;
|
||||
defaultSopsFile = ../../users/${config.home.username}/secrets.yaml;
|
||||
|
||||
Reference in New Issue
Block a user