From 2b6ec1955e52a105789c2234768e56aba8cf7a43 Mon Sep 17 00:00:00 2001 From: willemml Date: Thu, 29 Dec 2022 19:57:58 -0800 Subject: [PATCH] launchd for gpg and emacs --- home.nix | 3 ++- launchd.nix | 28 ++++++++++++++++++++++++++++ programs.nix | 8 +++++--- 3 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 launchd.nix diff --git a/home.nix b/home.nix index f4cadce..c498d57 100644 --- a/home.nix +++ b/home.nix @@ -4,6 +4,7 @@ let homeDirectory = config.home.homeDirectory; in { imports = [ ./emacs.nix + ./launchd.nix ./packages.nix ./programs.nix ]; @@ -31,5 +32,5 @@ in { variant = "colemak"; }; - home.sessionVariables = { EDITOR = "emacs"; }; + home.sessionVariables = { EDITOR = "emacsclient -c -nw"; }; } diff --git a/launchd.nix b/launchd.nix new file mode 100644 index 0000000..1f69912 --- /dev/null +++ b/launchd.nix @@ -0,0 +1,28 @@ +{ lib, config, pkgs, ... }: + +{ + launchd = { + enable = true; + + agents.emacs = { + enable = true; + config = { + ProgramArguments = [ "${pkgs.emacs}/bin/emacs" "--fg-daemon" ]; + KeepAlive.SuccessfulExit = true; + }; + }; + + agents.gpg-daemon = { + enable = true; + config = { + ProgramArguments = [ + "${pkgs.gnupg}/bin/gpg-agent" + '' + --pinentry-program="${pkgs.pinentry_mac}/Applications/pinentry-mac.app/Contents/MacOS/pinentry-mac"'' + "--daemon" + ]; + KeepAlive = true; + }; + }; + }; +} diff --git a/programs.nix b/programs.nix index 460a462..8a3ec23 100644 --- a/programs.nix +++ b/programs.nix @@ -11,6 +11,7 @@ gpg = { enable = true; + package = pkgs.gnupg; settings = { use-agent = true; default-key = "860B5C62BF1FCE4272D26BF8C3DE5DF6198DACBD"; @@ -68,12 +69,13 @@ ignoreDups = true; }; shellAliases = { - em = "emacsclient -c"; - emw = "emacsclient -c -nw"; - ew = "emacs -nw"; + em = "emacs"; + emw = "emacs -nw"; + ew = "emacsclient -c"; e = "$EDITOR"; np = "nix-shell -p"; hms = "home-manager switch"; + cd = "z"; }; plugins = with pkgs; [ {