Skip to content

Commit 9166cc6

Browse files
author
Patrick Widmer
committed
feat(wrapperModules.openssh): init
1 parent 3d4986c commit 9166cc6

2 files changed

Lines changed: 67 additions & 0 deletions

File tree

wrapperModules/o/openssh/check.nix

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
pkgs,
3+
self,
4+
}:
5+
let
6+
opensshWrapped = self.wrappedModules.openssh.wrap {
7+
inherit pkgs;
8+
9+
settings = ''
10+
Host foo
11+
User bar
12+
HostName 192.168.0.2
13+
ProxyJump baz
14+
15+
Host baz
16+
HostName 192.168.0.1
17+
'';
18+
};
19+
20+
in
21+
if builtins.elem pkgs.stdenv.hostPlatform.system self.wrappedModules.openssh.meta.platforms then
22+
pkgs.runCommand "ssh-test" { } ''
23+
"${opensshWrapped}/bin/ssh" -G foo | grep -q 'HostName 192.168.0.2'
24+
touch $out
25+
''
26+
else
27+
null
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
config,
3+
wlib,
4+
lib,
5+
...
6+
}:
7+
{
8+
imports = [ wlib.modules.default ];
9+
10+
options = {
11+
settings = lib.mkOption {
12+
type = lib.types.string;
13+
default = "";
14+
description = ''
15+
OpenSSH client configuration settings.
16+
See `man 5 ssh_config`
17+
'';
18+
example = ''
19+
Host foo
20+
User bar
21+
HostName 192.168.0.2
22+
ProxyJump baz
23+
24+
Host baz
25+
HostName 192.168.0.1
26+
'';
27+
};
28+
};
29+
30+
config = {
31+
package = lib.mkDefault config.pkgs.openssh;
32+
flags = {
33+
"-F" = builtins.toString (config.pkgs.writeText "ssh-config" config.settings);
34+
};
35+
meta = {
36+
inherit (config.package) platforms;
37+
maintainers = [ wlib.maintainers.patwid ];
38+
};
39+
};
40+
}

0 commit comments

Comments
 (0)