all repos — nixfiles @ aec14387c6651a4a067ef2ece4105210feeb4bc9

System and user configuration, managed by nix and home-manager

Use Strongbox as an SSH agent instead of Secretive
Alan Pearce alan@alanpearce.eu
Fri, 16 Jun 2023 17:00:05 +0200
commit

aec14387c6651a4a067ef2ece4105210feeb4bc9

parent

baef3925a7a9efecd1c666c0cbb8b3a9b7e19d34

3 files changed, 18 insertions(+), 6 deletions(-)

jump to
M flake.lockflake.lock
@@ -141,11 +141,11 @@ },     "secrets": {
       "flake": false,
       "locked": {
-        "lastModified": 1686549813,
-        "narHash": "sha256-PUlxkCDkEHFEI1kKoL3Hqyt0uGJAn02SfZ0d3iVXpMw=",
+        "lastModified": 1686927539,
+        "narHash": "sha256-NYua7jXxZapXU742HTKbrJc5UT+Z56EVDPKZ1y6xRro=",
         "ref": "refs/heads/main",
-        "rev": "c12bb9e097a58e53f0b7bb517e0973a34dce0ac6",
-        "revCount": 47,
+        "rev": "b98f4200cbe76a0f4809b5c5b0e9f3d11845db28",
+        "revCount": 48,
         "type": "git",
         "url": "file:///home/alan/projects/alanpearce.eu/nixfiles/private"
       },
M system/settings/configuration/user.nixsystem/settings/configuration/user.nix
@@ -11,7 +11,7 @@ initialPassword = "password";     home = "/home/alan";
     uid = 1000;
     openssh.authorizedKeys.keys = [
-      "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGzM6PoCJxMZk2qbBznZG2V+/yC+8MlF7SAc5LCp5fVeWnAMa1C1ZJ+l8EYnCPLjAq6SaM1Qxw6fTyurajdtnPM= lan@secretive.mba.local"
+      "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMvcW4Z9VxOQgEJjsRC1uSMwEJ4vru9BwjT+Z50nawp4 alan"
     ];
   };
 }
M user/settings/darwin.nixuser/settings/darwin.nix
@@ -1,5 +1,6 @@ { config
 , pkgs
+, lib
 , ...
 }: {
   nixpkgs.overlays = [
@@ -141,7 +142,18 @@ SHELL_SESSIONS_DISABLE=1     path+=($HOME/Library/Python/3.9/bin)
   '';
   programs.ssh.extraConfig = ''
-    IdentityAgent /Users/alan/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/socket.ssh
+    IdentityAgent ~/.strongbox/agent.sock
+  '';
+  home.activation.linkStrongboxSSHAgentSocket = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
+    if [[ ! -d ~/.strongbox ]]
+    then
+      $DRY_RUN_CMD mkdir ~/.strongbox
+    fi
+    if [[ ! -S ~/.strongbox/agent.sock ]]
+    then
+      $DRY_RUN_CMD ln -s $VERBOSE_ARG \
+        ~/Library/Group\ Containers/group.strongbox.mac.mcguill/agent.sock ~/.strongbox/agent.sock
+    fi
   '';
 
   # Use GPG from  GPGTools