about summary refs log tree commit diff stats
path: root/home-manager
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-05-17 21:38:28 +0200
committerSoispha <soispha@vhack.eu>2023-05-17 22:14:42 +0200
commit00afa4496a1dc0bdb1a2fa27dd3eb9bef4bfdbdc (patch)
tree5216473b89dedbfe0f8e0f78dab0d9edb833e8a6 /home-manager
parentFeat(hm/conf/gpg): Enforce key entry through nixos config (diff)
downloadnixos-config-00afa4496a1dc0bdb1a2fa27dd3eb9bef4bfdbdc.tar.gz
nixos-config-00afa4496a1dc0bdb1a2fa27dd3eb9bef4bfdbdc.zip
Fix(hm/conf/gpg): Use nixos to write the agent script
Diffstat (limited to '')
-rwxr-xr-xhome-manager/config/gpg/agent-program2
-rw-r--r--home-manager/config/gpg/default.nix15
2 files changed, 15 insertions, 2 deletions
diff --git a/home-manager/config/gpg/agent-program b/home-manager/config/gpg/agent-program
new file mode 100755
index 00000000..8817a1a2
--- /dev/null
+++ b/home-manager/config/gpg/agent-program
@@ -0,0 +1,2 @@
+#!/bin/sh
+onlykey-gpg-agent -vv --skey-slot=ECC32 --dkey-slot=ECC32 "$@"
diff --git a/home-manager/config/gpg/default.nix b/home-manager/config/gpg/default.nix
index ae5a36ad..748bd0d7 100644
--- a/home-manager/config/gpg/default.nix
+++ b/home-manager/config/gpg/default.nix
@@ -1,8 +1,18 @@
 {
   config,
+  sysLib,
   pkgs,
   ...
-}: {
+}: let
+  agent-program = sysLib.makeShellScriptWithLibrary {
+    name = "onlykey-gpg-agent";
+    script = ./agent-program;
+    dependencies = with pkgs; [
+      python3
+      onlykey-agent
+    ];
+  };
+in {
   programs.gpg = {
     enable = true;
     homedir = "${config.xdg.dataHome}/gnupg/onlykey";
@@ -10,7 +20,8 @@
     mutableTrust = false;
     settings = {
       # Hardware-based GPG configuration
-      agent-program = "/home/soispha/.local/share/gnupg/onlykey/run-agent.sh";
+      agent-program = "${agent-program}/bin/onlykey-gpg-agent";
+
       default-key = "Soispha <soispha@vhack.eu>";
       # TODO add more
     };