home-manager/configs: Add macsimum and use SSH extraConfig

This commit is contained in:
Jack O'Sullivan 2022-02-21 13:19:21 +00:00
parent 953770f339
commit 7180d265c4
5 changed files with 64 additions and 43 deletions

6
flake.lock generated
View File

@ -210,11 +210,11 @@
}, },
"nixpkgs-unstable": { "nixpkgs-unstable": {
"locked": { "locked": {
"lastModified": 1644613700, "lastModified": 1645334861,
"narHash": "sha256-wLRPJclMH8vsHuFtyI78aF09lw5mbi3lMB6uiK5S2wE=", "narHash": "sha256-We9ECiMglthzbZ5S6Myqqf+RHzBFZPoM2qL5/jDkUjs=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "23d785aa6f853e6cf3430119811c334025bbef55", "rev": "d5f237872975e6fb6f76eef1368b5634ffcd266f",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -97,6 +97,7 @@
# Homes # Homes
home-manager/configs/castle.nix home-manager/configs/castle.nix
home-manager/configs/macsimum.nix
]; ];
nixfiles = evalModules { nixfiles = evalModules {

View File

@ -15,6 +15,9 @@
hostname = "h.nul.ie"; hostname = "h.nul.ie";
sshOpts = [ "-4" "-p" "8022" ]; sshOpts = [ "-4" "-p" "8022" ];
}; };
};
programs = {
ssh.matchBlocks = { ssh.matchBlocks = {
home = { home = {
host = host =
@ -23,9 +26,7 @@
user = "root"; user = "root";
}; };
}; };
};
programs = {
kakoune.enable = true; kakoune.enable = true;
}; };
}; };

View File

@ -0,0 +1,19 @@
{
home-manager.homes."jack@macsimum" = {
system = "x86_64-darwin";
nixpkgs = "unstable";
homeDirectory = "/Users/jack";
username = "jack";
configuration = { pkgs, ... }:
{
my = {
deploy.enable = false;
};
programs = {
ssh.enable = false;
};
};
};
}

View File

@ -24,7 +24,6 @@ in
literal = mkOpt' (listOf singleLineStr) [ ] "List of OpenSSH keys to allow"; literal = mkOpt' (listOf singleLineStr) [ ] "List of OpenSSH keys to allow";
files = mkOpt' (listOf str) [ ] "List of OpenSSH key files to allow"; files = mkOpt' (listOf str) [ ] "List of OpenSSH key files to allow";
}; };
matchBlocks = mkOpt' (attrsOf anything) { } "SSH match blocks";
}; };
}; };
@ -48,35 +47,6 @@ in
isStandalone = !(args ? osConfig); isStandalone = !(args ? osConfig);
shell = mkDefault "${config.programs.fish.package}/bin/fish"; shell = mkDefault "${config.programs.fish.package}/bin/fish";
ssh = {
matchBlocks = {
nix-dev-vm = {
user = "dev";
hostname = "localhost";
port = 2222;
extraOptions = {
StrictHostKeyChecking = "no";
UserKnownHostsFile = "/dev/null";
};
};
"rsync.net" = {
host = "rsyncnet";
user = "16413";
hostname = "ch-s010.rsync";
};
shoe = {
host = "shoe.netsoc.tcd.ie shoe";
user = "netsoc";
};
netsocBoxes = {
host = "cube spoon napalm gandalf saruman";
user = "root";
};
};
};
}; };
home.file.".ssh/authorized_keys" = with config.my.ssh.authKeys; home.file.".ssh/authorized_keys" = with config.my.ssh.authKeys;
@ -152,16 +122,38 @@ in
ssh = { ssh = {
enable = mkDefault true; enable = mkDefault true;
matchBlocks = (mapAttrs (_: b: dag.entryBefore [ "all" ] b) config.my.ssh.matchBlocks) // { matchBlocks = {
all = { nix-dev-vm = {
host = "*"; user = "dev";
identityFile = [ hostname = "localhost";
"~/.ssh/id_rsa" port = 2222;
"~/.ssh/netsoc" extraOptions = {
"~/.ssh/borg" StrictHostKeyChecking = "no";
]; UserKnownHostsFile = "/dev/null";
};
};
"rsync.net" = {
host = "rsyncnet";
user = "16413";
hostname = "ch-s010.rsync";
};
shoe = {
host = "shoe.netsoc.tcd.ie shoe";
user = "netsoc";
};
netsocBoxes = {
host = "cube spoon napalm gandalf saruman";
user = "root";
}; };
}; };
extraConfig =
''
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/netsoc
IdentityFile ~/.ssh/borg
'';
}; };
direnv = { direnv = {
@ -197,6 +189,7 @@ in
file file
tree tree
iperf3 iperf3
mosh
]; ];
sessionVariables = { sessionVariables = {
@ -256,5 +249,12 @@ in
}; };
}) })
])) ]))
(mkIf (pkgs.stdenv.isDarwin && config.my.isStandalone) {
home = {
packages = with pkgs; [
cacert
];
};
})
]; ];
} }