mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2025-01-08 22:57:42 +03:00
nixos/gnupg: add systemd configuration
This depended on the systemd user configuration provided upstream in
doc/examples. However, this was all removed in:
eae28f1bd4
This commit is contained in:
parent
ffb5d3d105
commit
960a5142aa
@ -95,36 +95,107 @@ in
|
|||||||
config = mkIf cfg.agent.enable {
|
config = mkIf cfg.agent.enable {
|
||||||
# This overrides the systemd user unit shipped with the gnupg package
|
# This overrides the systemd user unit shipped with the gnupg package
|
||||||
systemd.user.services.gpg-agent = mkIf (cfg.agent.pinentryFlavor != null) {
|
systemd.user.services.gpg-agent = mkIf (cfg.agent.pinentryFlavor != null) {
|
||||||
serviceConfig.ExecStart = [ "" ''
|
unitConfig = {
|
||||||
${cfg.package}/bin/gpg-agent --supervised \
|
Description = "GnuPG cryptographic agent and passphrase cache";
|
||||||
--pinentry-program ${pkgs.pinentry.${cfg.agent.pinentryFlavor}}/bin/pinentry
|
Documentation = "man:gpg-agent(1)";
|
||||||
'' ];
|
Requires = [ "gpg-agent.socket" ];
|
||||||
|
};
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStart = ''
|
||||||
|
${cfg.package}/bin/gpg-agent --supervised \
|
||||||
|
--pinentry-program ${pkgs.pinentry.${cfg.agent.pinentryFlavor}}/bin/pinentry
|
||||||
|
'';
|
||||||
|
ExecReload = "${cfg.package}/bin/gpgconf --reload gpg-agent";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.user.sockets.gpg-agent = {
|
systemd.user.sockets.gpg-agent = {
|
||||||
|
unitConfig = {
|
||||||
|
Description = "GnuPG cryptographic agent and passphrase cache";
|
||||||
|
Documentation = "man:gpg-agent(1)";
|
||||||
|
};
|
||||||
|
socketConfig = {
|
||||||
|
ListenStream = "%t/gnupg/S.gpg-agent";
|
||||||
|
FileDescriptorName = "std";
|
||||||
|
SocketMode = "0600";
|
||||||
|
DirectoryMode = "0700";
|
||||||
|
};
|
||||||
wantedBy = [ "sockets.target" ];
|
wantedBy = [ "sockets.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.user.sockets.gpg-agent-ssh = mkIf cfg.agent.enableSSHSupport {
|
systemd.user.sockets.gpg-agent-ssh = mkIf cfg.agent.enableSSHSupport {
|
||||||
|
unitConfig = {
|
||||||
|
Description = "GnuPG cryptographic agent (ssh-agent emulation)";
|
||||||
|
Documentation = "man:gpg-agent(1) man:ssh-add(1) man:ssh-agent(1) man:ssh(1)";
|
||||||
|
};
|
||||||
|
socketConfig = {
|
||||||
|
ListenStream = "%t/gnupg/S.gpg-agent.ssh";
|
||||||
|
FileDescriptorName = "ssh";
|
||||||
|
Service = "gpg-agent.service";
|
||||||
|
SocketMode = "0600";
|
||||||
|
DirectoryMode = "0700";
|
||||||
|
};
|
||||||
wantedBy = [ "sockets.target" ];
|
wantedBy = [ "sockets.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.user.sockets.gpg-agent-extra = mkIf cfg.agent.enableExtraSocket {
|
systemd.user.sockets.gpg-agent-extra = mkIf cfg.agent.enableExtraSocket {
|
||||||
|
unitConfig = {
|
||||||
|
Description = "GnuPG cryptographic agent and passphrase cache (restricted)";
|
||||||
|
Documentation = "man:gpg-agent(1)";
|
||||||
|
};
|
||||||
|
socketConfig = {
|
||||||
|
ListenStream = "%t/gnupg/S.gpg-agent.extra";
|
||||||
|
FileDescriptorName = "extra";
|
||||||
|
Service = "gpg-agent.service";
|
||||||
|
SocketMode = "0600";
|
||||||
|
DirectoryMode = "0700";
|
||||||
|
};
|
||||||
wantedBy = [ "sockets.target" ];
|
wantedBy = [ "sockets.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.user.sockets.gpg-agent-browser = mkIf cfg.agent.enableBrowserSocket {
|
systemd.user.sockets.gpg-agent-browser = mkIf cfg.agent.enableBrowserSocket {
|
||||||
|
unitConfig = {
|
||||||
|
Description = "GnuPG cryptographic agent and passphrase cache (access for web browsers)";
|
||||||
|
Documentation = "man:gpg-agent(1)";
|
||||||
|
};
|
||||||
|
socketConfig = {
|
||||||
|
ListenStream = "%t/gnupg/S.gpg-agent.browser";
|
||||||
|
FileDescriptorName = "browser";
|
||||||
|
Service = "gpg-agent.service";
|
||||||
|
SocketMode = "0600";
|
||||||
|
DirectoryMode = "0700";
|
||||||
|
};
|
||||||
wantedBy = [ "sockets.target" ];
|
wantedBy = [ "sockets.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd.user.services.dirmngr = mkIf cfg.dirmngr.enable {
|
||||||
|
unitConfig = {
|
||||||
|
Description = "GnuPG network certificate management daemon";
|
||||||
|
Documentation = "man:dirmngr(8)";
|
||||||
|
Requires = "dirmngr.socket";
|
||||||
|
};
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStart = "${cfg.package}/bin/dirmngr --supervised";
|
||||||
|
ExecReload = "${cfg.package}/bin/gpgconf --reload dirmngr";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
systemd.user.sockets.dirmngr = mkIf cfg.dirmngr.enable {
|
systemd.user.sockets.dirmngr = mkIf cfg.dirmngr.enable {
|
||||||
|
unitConfig = {
|
||||||
|
Description = "GnuPG network certificate management daemon";
|
||||||
|
Documentation = "man:dirmngr(8)";
|
||||||
|
};
|
||||||
|
socketConfig = {
|
||||||
|
ListenStream = "%t/gnupg/S.dirmngr";
|
||||||
|
SocketMode = "0600";
|
||||||
|
DirectoryMode = "0700";
|
||||||
|
};
|
||||||
wantedBy = [ "sockets.target" ];
|
wantedBy = [ "sockets.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
services.dbus.packages = mkIf (cfg.agent.pinentryFlavor == "gnome3") [ pkgs.gcr ];
|
services.dbus.packages = mkIf (cfg.agent.pinentryFlavor == "gnome3") [ pkgs.gcr ];
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [ cfg.package ];
|
environment.systemPackages = with pkgs; [ cfg.package ];
|
||||||
systemd.packages = [ cfg.package ];
|
|
||||||
|
|
||||||
environment.interactiveShellInit = ''
|
environment.interactiveShellInit = ''
|
||||||
# Bind gpg-agent to this TTY if gpg commands are used.
|
# Bind gpg-agent to this TTY if gpg commands are used.
|
||||||
|
Loading…
Reference in New Issue
Block a user