home/config/ssh -> home/programs/ssh
also use inet for some pvv hosts
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
{ config, ... }:
|
||||
{
|
||||
imports = [
|
||||
./home.nix
|
||||
./other.nix
|
||||
./pvv.nix
|
||||
];
|
||||
|
||||
sops.secrets."ssh/secret-config" = {
|
||||
mode = "0444";
|
||||
};
|
||||
|
||||
programs.ssh.includes = [ config.sops.secrets."ssh/secret-config".path ];
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
{ ... }:
|
||||
{
|
||||
programs.ssh.matchBlocks = {
|
||||
suiseir = {
|
||||
user = "h7x4";
|
||||
hostname = "heimen.hopto.me";
|
||||
port = 23934;
|
||||
};
|
||||
pir = {
|
||||
user = "h7x4";
|
||||
hostname = "gingakei.loginto.me";
|
||||
port = 41348;
|
||||
};
|
||||
tsukir = {
|
||||
user = "h7x4";
|
||||
hostname = "gingakei.loginto.me";
|
||||
port = 45497;
|
||||
};
|
||||
"git.nani.wtf git.tsuki.local git.seiun.cloud" = {
|
||||
user = "git";
|
||||
hostname = "gingakei.loginto.me";
|
||||
port = 45497;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
programs.ssh.matchBlocks = {
|
||||
"ntnu" = {
|
||||
user = "oysteikt";
|
||||
hostname = "login.stud.ntnu.no";
|
||||
proxyJump = "pvv";
|
||||
};
|
||||
"github" = {
|
||||
user = "git";
|
||||
hostname = "github.com";
|
||||
identityFile = [ "~/.ssh/id_ed25519" ];
|
||||
};
|
||||
"github-nordicsemi" = {
|
||||
user = "git";
|
||||
hostname = "github.com";
|
||||
identityFile = [ "~/.ssh/id_ed25519_nordicsemi" ];
|
||||
};
|
||||
"bitbucket-nordicsemi" = {
|
||||
user = "git";
|
||||
hostname = "bitbucket.nordicsemi.no";
|
||||
port = 7999;
|
||||
identityFile = [ "~/.ssh/id_ed25519_nordicsemi" ];
|
||||
};
|
||||
"gitlab.stud.idi.ntnu.no" = {
|
||||
user = "git";
|
||||
proxyJump = "pvv";
|
||||
};
|
||||
"pascal wack" = {
|
||||
user = "h7x4";
|
||||
hostname = "wiki.wackattack.eu";
|
||||
port = 1337;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
{ pkgs, lib, extendedLib, ... }:
|
||||
let
|
||||
adminUser = "root";
|
||||
normalUser = "oysteikt";
|
||||
|
||||
# http://www.pvv.ntnu.no/pvv/Maskiner
|
||||
normalMachines = [
|
||||
{
|
||||
names = [ "hildring" "pvv-login" "pvv" ];
|
||||
proxyJump = lib.mkDefault null;
|
||||
}
|
||||
"dagali"
|
||||
"drolsum"
|
||||
"demiurgen"
|
||||
"eirin"
|
||||
[ "bekkalokk" "pvv-web" "pvv-wiki" "pvv-webmail" ]
|
||||
"ildkule"
|
||||
"shark"
|
||||
"buskerud"
|
||||
[ "bicep" "pvv-databases" ]
|
||||
"bob"
|
||||
"knutsen"
|
||||
"isvegg"
|
||||
"tom"
|
||||
[ "microbel" "pvv-users" "pvv-mail" ]
|
||||
];
|
||||
|
||||
rootMachines = [
|
||||
[ "sleipner" "pvv-salt" ]
|
||||
[ "balduzius" "pvv-krb" ]
|
||||
[ "innovation" "pvv-minecraft" ]
|
||||
];
|
||||
|
||||
# Either( String [String] AttrSet{String} ) -> AttrSet{String}
|
||||
coerceToSSHMatchBlock =
|
||||
machine:
|
||||
if builtins.isString machine then { names = [machine]; }
|
||||
else if builtins.isList machine then { names = machine; }
|
||||
else machine;
|
||||
|
||||
# ListOf(String) -> AttrSet
|
||||
machineWithNames = let
|
||||
inherit (lib.lists) head;
|
||||
inherit (lib.strings) split;
|
||||
in
|
||||
names: { hostname = "${head names}.pvv.ntnu.no"; };
|
||||
|
||||
# AttrSet -> AttrSet -> AttrSet
|
||||
convertMachineWithDefaults = defaults: normalizedMachine: let
|
||||
inherit (lib.attrsets) nameValuePair;
|
||||
inherit (lib.strings) concatStringsSep;
|
||||
inherit (normalizedMachine) names;
|
||||
|
||||
name = concatStringsSep " " names;
|
||||
value =
|
||||
(machineWithNames names)
|
||||
// defaults
|
||||
// removeAttrs normalizedMachine ["names"];
|
||||
in
|
||||
nameValuePair name value;
|
||||
|
||||
# AttrSet -> AttrSet
|
||||
convertNormalMachine = convertMachineWithDefaults { user = normalUser; proxyJump = "pvv"; };
|
||||
# AttrSet -> AttrSet
|
||||
convertAdminMachine =
|
||||
convertMachineWithDefaults { user = adminUser; proxyJump = "pvv"; };
|
||||
|
||||
# ListOf (Either(String ListOf(String) AttrsOf(String))) -> (AttrSet -> AttrSet) -> AttrSet
|
||||
convertMachinesWith = convertMachineFunction: let
|
||||
inherit (lib.attrsets) listToAttrs;
|
||||
inherit (lib.trivial) pipe;
|
||||
pipeline = [
|
||||
(map coerceToSSHMatchBlock)
|
||||
(map convertMachineFunction)
|
||||
listToAttrs
|
||||
];
|
||||
in
|
||||
machines: pipe machines pipeline;
|
||||
in
|
||||
{
|
||||
programs.ssh.matchBlocks = (extendedLib.attrsets.concatAttrs [
|
||||
(convertMachinesWith convertNormalMachine normalMachines)
|
||||
(convertMachinesWith convertAdminMachine rootMachines)
|
||||
]) // {
|
||||
"pvv-git git.pvv.ntnu.no" = {
|
||||
hostname = "git.pvv.ntnu.no";
|
||||
user = "gitea";
|
||||
port = 2222;
|
||||
proxyJump = "pvv";
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user