mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
ssh-tpm-agent: init module (#7495)
This commit is contained in:
parent
7c78e592a8
commit
dcfd70f80f
3 changed files with 144 additions and 0 deletions
5
tests/modules/services/ssh-tpm-agent/default.nix
Normal file
5
tests/modules/services/ssh-tpm-agent/default.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{ lib, pkgs, ... }:
|
||||
|
||||
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
|
||||
ssh-tpm-agent = ./service.nix;
|
||||
}
|
||||
48
tests/modules/services/ssh-tpm-agent/service.nix
Normal file
48
tests/modules/services/ssh-tpm-agent/service.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
services.ssh-tpm-agent = {
|
||||
enable = true;
|
||||
package = config.lib.test.mkStubPackage { outPath = "@ssh-tpm-agent@"; };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
serviceFile=home-files/.config/systemd/user/ssh-tpm-agent.service
|
||||
socketFile=home-files/.config/systemd/user/ssh-tpm-agent.socket
|
||||
|
||||
assertFileExists $serviceFile
|
||||
assertFileExists $socketFile
|
||||
|
||||
assertFileContent $serviceFile ${builtins.toFile "expected-service" ''
|
||||
[Service]
|
||||
Environment=SSH_TPM_AUTH_SOCK=%t/ssh-tpm-agent.sock
|
||||
ExecStart=@ssh-tpm-agent@/bin/dummy -l %t/ssh-tpm-agent.sock
|
||||
PassEnvironment=SSH_AGENT_PID
|
||||
SuccessExitStatus=2
|
||||
Type=simple
|
||||
|
||||
[Unit]
|
||||
After=ssh-tpm-agent.socket
|
||||
Description=ssh-tpm-agent service
|
||||
Documentation=https://github.com/Foxboron/ssh-tpm-agent
|
||||
RefuseManualStart=true
|
||||
Requires=ssh-tpm-agent.socket
|
||||
''}
|
||||
|
||||
assertFileContent $socketFile ${builtins.toFile "expected-socket" ''
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
||||
|
||||
[Socket]
|
||||
DirectoryMode=0700
|
||||
ListenStream=%t/ssh-tpm-agent.sock
|
||||
RuntimeDirectory=ssh-tpm-agent
|
||||
Service=ssh-tpm-agent.service
|
||||
SocketMode=0600
|
||||
|
||||
[Unit]
|
||||
Description=SSH TPM agent socket
|
||||
Documentation=https://github.com/Foxboron/ssh-tpm-agent
|
||||
''}
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue