about summary refs log tree commit diff
path: root/modules/workstation/gnupg
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-01-13 08:36:07 +0000
committerAlyssa Ross <hi@alyssa.is>2021-01-13 08:52:28 +0000
commit9f55e8bc0fb7cf1b0204652871808130a45e8eee (patch)
tree94ee10ed32721a43261d3b696d5597b4457b5028 /modules/workstation/gnupg
parent1fb3ddfe362432c508409a81060dfd4bbb2ce31f (diff)
downloadnixlib-9f55e8bc0fb7cf1b0204652871808130a45e8eee.tar
nixlib-9f55e8bc0fb7cf1b0204652871808130a45e8eee.tar.gz
nixlib-9f55e8bc0fb7cf1b0204652871808130a45e8eee.tar.bz2
nixlib-9f55e8bc0fb7cf1b0204652871808130a45e8eee.tar.lz
nixlib-9f55e8bc0fb7cf1b0204652871808130a45e8eee.tar.xz
nixlib-9f55e8bc0fb7cf1b0204652871808130a45e8eee.tar.zst
nixlib-9f55e8bc0fb7cf1b0204652871808130a45e8eee.zip
modules/home: remove
I think when I implemented this I didn't know about tmpfiles.d(5).
Now I do, so let's use that instead.

I don't think the imperativeNix option is necessary any more since the
home directory is created read-only, but if it turns out that
.nix-defexpr and .nix-profile are coming back, I can look into the
best way to solve that then.
Diffstat (limited to 'modules/workstation/gnupg')
-rw-r--r--modules/workstation/gnupg/default.nix37
1 files changed, 21 insertions, 16 deletions
diff --git a/modules/workstation/gnupg/default.nix b/modules/workstation/gnupg/default.nix
index 2f47ddf77b29..eda898314258 100644
--- a/modules/workstation/gnupg/default.nix
+++ b/modules/workstation/gnupg/default.nix
@@ -1,21 +1,26 @@
-{ pkgs, ... }:
+{ config, pkgs, ... }:
+
+let
+  gnupgHome = "${config.users.users.qyliss.home}/state/gnupg";
+
+  pinentryProgram =
+    if pkgs.stdenv.isDarwin then
+      "/Applications/pinentry-mac.app/Contents/MacOS/pinentry-mac"
+    else
+      "${pkgs.pinentry.qt}/bin/pinentry";
+
+  gpg-agent-conf = pkgs.writeText "gpg-agent.conf" ''
+    pinentry-program ${pinentryProgram}
+  '';
+in
 
 {
-  home.qyliss.dirs."state/gnupg".activationScripts.config =
-    let
-      pinentry = if pkgs.stdenv.isDarwin then
-        "/Applications/pinentry-mac.app/Contents/MacOS/pinentry-mac"
-      else
-        "${pkgs.pinentry.qt}/bin/pinentry";          
-      
-      gpg-agent-conf = pkgs.writeText "gpg-agent.conf" ''
-        pinentry-program ${pinentry}
-      '';
-    in ''
-      ln -sf ${./dirmngr.conf} dirmngr.conf
-      ln -sf ${./gpg.conf} gpg.conf
-      ln -sf ${gpg-agent-conf} gpg-agent.conf
-    '';
+  systemd.tmpfiles.rules = [
+    "d ${gnupgHome} 0700 qyliss qyliss"
+    "L+ ${gnupgHome}/dirmngr.conf   - - - - ${./dirmngr.conf}"
+    "L+ ${gnupgHome}/gpg.conf       - - - - ${./gpg.conf}"
+    "L+ ${gnupgHome}/gpg-agent.conf - - - - ${gpg-agent-conf}"
+  ];
 
   environment.systemPackages = with pkgs; [ gnupg pinentry ];