Skip to content
Merged
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
10 changes: 9 additions & 1 deletion modules/misc/news.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,15 @@ in
time = "2023-06-17T22:18:22+00:00";
condition = config.programs.zsh.enable;
message = ''
A new modules is available: 'programs.zsh.antidote'
A new module is available: 'programs.zsh.antidote'
Comment thread
sumnerevans marked this conversation as resolved.
'';
}

{
time = "2023-06-30T14:46:22+00:00";
condition = config.services.ssh-agent.enable;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, this will now only render the news item for people that already have the service enabled.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I assume this is a mistake. My guess is that it should be condition = hostPlatform.isLinux; and the module itself should contain

assertions = [
  (lib.hm.assertions.assertPlatform "services.ssh-agent" pkgs lib.platforms.linux)
];

since it is Linux-only.

message = ''
A new module is available: 'services.ssh-agent'
'';
}
];
Expand Down
1 change: 1 addition & 0 deletions modules/modules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ let
./services/screen-locker.nix
./services/sctd.nix
./services/spotifyd.nix
./services/ssh-agent.nix
Comment thread
lheckemann marked this conversation as resolved.
./services/stalonetray.nix
./services/status-notifier-watcher.nix
./services/swayidle.nix
Expand Down
36 changes: 36 additions & 0 deletions modules/services/ssh-agent.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{ config, options, lib, pkgs, ... }:

let

cfg = config.services.ssh-agent;

in {
meta.maintainers = [ lib.maintainers.lheckemann ];

options = {
services.ssh-agent = {
enable = lib.mkEnableOption "OpenSSH private key agent";
};
};

config = lib.mkIf cfg.enable {
home.sessionVariablesExtra = ''
if [[ -z "$SSH_AUTH_SOCK" ]]; then
export SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/ssh-agent
fi
'';

systemd.user.services.ssh-agent = {
Install.WantedBy = [ "default.target" ];

Unit = {
Description = "SSH authentication agent";
Documentation = "man:ssh-agent(1)";
};

Service = {
ExecStart = "${pkgs.openssh}/bin/ssh-agent -D -a %t/ssh-agent";
};
};
};
}