Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(darwin): yubikey support #11

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
./modules/ghostty
./modules/tmux
./modules/neovim
./modules/yubikey.nix
./modules/gpg.nix
./modules/git.nix
./modules/gh
Expand All @@ -141,7 +142,6 @@
./modules/charm.nix
./modules/hammerspoon
inputs.caarlos0-nur.homeManagerModules.default
# ./modules/yubikey.nix
nix-index-database.hmModules.nix-index
];
};
Expand Down
34 changes: 25 additions & 9 deletions modules/yubikey.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
{ pkgs, ... }: {
# TODO: set things up
home.packages = with pkgs; [
yubikey-agent
yubikey-manager
# yubico-yubikey-manager
];
{ pkgs, ... }:
let
sockPath = "/tmp/yubikey-agent.sock";
in
{
home.packages = with pkgs; [ yubikey-manager ];
home.sessionVariables.SSH_AUTH_SOCK = sockPath;
home.activation.yubikey = ''
$DRY_RUN_CMD ln -sf ${sockPath} $HOME/.ssh/ssh_auth_sock
'';

# TODO: path?
home.sessionVariables = { SSH_AUTH_SOCK = "/tmp/yubikey-agent.sock"; };
launchd.agents = {
yubikey-agent = {
enable = true;
config = {
Label = "localhost.yubikey-agent";
ProgramArguments = [ "${pkgs.yubikey-agent}/bin/yubikey-agent" "-l" sockPath ];
RunAtLoad = true;
KeepAlive = {
Crashed = true;
SuccessfulExit = false;
};
ProcessType = "Background";
};
};
};
}