Skip to content

Commit bba8d18

Browse files
committed
Back out "home: restructure ssh"
This backs out commit 9a4369a.
1 parent 816f6b1 commit bba8d18

2 files changed

Lines changed: 50 additions & 58 deletions

File tree

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,58 @@
11
{ config, lib, pkgs, ... }:
2-
let
3-
inherit (lib)
4-
mkEnableOption
5-
mkOption
6-
types;
7-
inherit (config.uwumarie.profiles.ssh)
8-
defaultIdentityFile
9-
hosts;
10-
in
112
{
123
options.uwumarie.profiles.ssh = {
13-
enable = mkEnableOption "ssh config";
14-
defaultIdentityFile = mkOption {
15-
type = types.str;
4+
enable = lib.mkEnableOption (lib.mdDoc "ssh config");
5+
githubKeyFile = lib.mkOption {
6+
type = lib.types.str;
7+
default = "~/.ssh/github.ed25519";
168
};
17-
hosts = mkOption {
18-
type = with types; attrsOf (submodule ({ config, name, ... }: {
19-
options = {
20-
match = mkOption {
21-
type = types.str;
22-
default = name;
23-
};
24-
hostname = mkOption {
25-
type = types.str;
26-
default = config.match;
27-
};
28-
user = mkOption {
29-
type = with types; nullOr str;
30-
};
31-
identitiesOnly = mkOption {
32-
type = types.bool;
33-
default = true;
34-
};
35-
identityFile = mkOption {
36-
type = types.str;
37-
default = defaultIdentityFile;
38-
};
39-
};
40-
}));
9+
defaultKeyFile = lib.mkOption {
10+
type = lib.types.str;
11+
default = "~/.ssh/default.ed25519";
4112
};
4213
};
4314
config = lib.mkIf config.uwumarie.profiles.ssh.enable {
44-
services.ssh-agent.enable = lib.mkDefault true;
4515
programs.ssh = {
4616
enable = true;
4717
package = pkgs.openssh;
48-
matchBlocks = lib.mapAttrs' (_: value: lib.nameValuePair value.match value) hosts;
18+
matchBlocks = {
19+
"github.com" = {
20+
user = "git";
21+
identitiesOnly = true;
22+
identityFile = config.uwumarie.profiles.ssh.githubKeyFile;
23+
};
24+
artemis = {
25+
hostname = "nue01.marie.cologne";
26+
identitiesOnly = true;
27+
identityFile = config.uwumarie.profiles.ssh.defaultKeyFile;
28+
};
29+
delphi = {
30+
hostname = "oci-fra01.marie.cologne";
31+
identitiesOnly = true;
32+
identityFile = config.uwumarie.profiles.ssh.defaultKeyFile;
33+
};
34+
raspberrypi = {
35+
user = "pi";
36+
identityFile = config.uwumarie.profiles.ssh.defaultKeyFile;
37+
identitiesOnly = true;
38+
};
39+
wg-nas = {
40+
hostname = "10.69.0.8";
41+
identityFile = config.uwumarie.profiles.ssh.defaultKeyFile;
42+
identitiesOnly = true;
43+
};
44+
gitlabber = {
45+
hostname = "warpgate.jemand771.net";
46+
user = "marie:gitlabber";
47+
identitiesOnly = true;
48+
};
49+
"*" = {
50+
extraOptions = {
51+
AddKeysToAgent = "yes";
52+
};
53+
};
54+
};
4955
};
56+
services.ssh-agent.enable = lib.mkDefault true;
5057
};
5158
}

hosts/marie-desktop/home.nix

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
enableGitEmail = true;
1515
};
1616
jujutsu = true;
17+
ssh = {
18+
enable = true;
19+
githubKeyFile = "~/.ssh/id_ed25519";
20+
defaultKeyFile = "~/.ssh/id_ed25519";
21+
};
1722
fish = true;
1823
tmux = true;
1924
};
@@ -31,24 +36,4 @@
3136
};
3237
};
3338
programs.zoxide.enable = true;
34-
35-
uwumarie.profiles.ssh = {
36-
enable = true;
37-
defaultIdentityFile = "~/.ssh/id_ed25519";
38-
hosts = {
39-
"github.com".user = "git";
40-
artemis.hostname = "artemis.marie.cologne";
41-
delphi.hostname = "delphi.marie.cologne";
42-
raspi = {
43-
user = "pi";
44-
hostname = "raspberrypi.fritz.box";
45-
};
46-
wg-nas.hostname = "192.168.178.30";
47-
gitlabber-public = {
48-
hostname = "warpgate.jemand771.net";
49-
user = "marie:gitlabber";
50-
};
51-
gitlabber.hostname = "gitlabber.weasel-gentoo.ts.net";
52-
};
53-
};
5439
}

0 commit comments

Comments
 (0)