merge lib/hosts.nix into lib/machines.nix
This commit is contained in:
parent
606de89b8c
commit
053ce2b76b
@ -1,4 +1,4 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
{ pkgs, lib, machines, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
@ -17,8 +17,13 @@
|
||||
networkmanager.enable = true;
|
||||
firewall.allowedTCPPorts = [ 24800 ];
|
||||
|
||||
hosts = {
|
||||
"127.0.0.1" = [ "news.ycombinator.com" ]; # i'm finally free
|
||||
hosts = lib.attrsets.mergeAttrsList [
|
||||
(machines.mkHosts machines "router" "localnet")
|
||||
(machines.mkHosts machines "copernicus" "localnet")
|
||||
(machines.mkHosts machines "phone" "localnet")
|
||||
(machines.mkHosts machines "netbox" "internet")
|
||||
] // {
|
||||
"127.0.0.1" = [ "news.ycombinator.com" ];
|
||||
};
|
||||
};
|
||||
hardware = {
|
||||
@ -35,7 +40,6 @@
|
||||
isNormalUser = true;
|
||||
description = "usr";
|
||||
extraGroups = [ "networkmanager" "wheel" "input" ];
|
||||
packages = with pkgs; [];
|
||||
};
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ lib, config, pkgs, ...}:
|
||||
{ pkgs, lib, machines, ...}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
@ -6,7 +6,6 @@
|
||||
./nvidia.nix
|
||||
./services
|
||||
../../config/copernicus.nix
|
||||
../../lib/hosts.nix
|
||||
../../lib/bootstrap.nix
|
||||
];
|
||||
|
||||
@ -130,6 +129,12 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
hosts = lib.attrsets.mergeAttrsList [
|
||||
(machines.mkHosts machines "aristotle" "localnet")
|
||||
(machines.mkHosts machines "router" "localnet")
|
||||
(machines.mkHosts machines "phone" "localnet")
|
||||
(machines.mkHosts machines "netbox" "internet")
|
||||
];
|
||||
};
|
||||
|
||||
services.getty.autologinUser = "usr";
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ pkgs, ... }:
|
||||
{ pkgs, lib, machines, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
@ -115,5 +115,9 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
hosts = lib.attrsets.mergeAttrsList [
|
||||
(machines.mkHosts machines "copernicus" "wgnet")
|
||||
(machines.mkHosts machines "aristotle" "wgnet")
|
||||
];
|
||||
};
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
{ lib, config, pkgs, inputs, ...}:
|
||||
|
||||
{
|
||||
networking.hosts = {
|
||||
"192.168.1.1" = [ "router" ];
|
||||
"192.168.1.200" = [ "mainsail" ];
|
||||
"192.168.1.201" = [ "x230t" ];
|
||||
"192.168.1.202" = [ "mlg" ];
|
||||
"192.168.1.203" = [ "phone" ];
|
||||
"149.28.63.115" = [ "netbox" ];
|
||||
};
|
||||
}
|
||||
|
@ -1,17 +1,49 @@
|
||||
{
|
||||
router = {
|
||||
ip-addrs = {
|
||||
localnet = "192.168.1.1";
|
||||
};
|
||||
};
|
||||
copernicus = {
|
||||
pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILBGh1FHPneg7PCDkhMs2BCJPTIRVJkRTKpOj1w02ydD usr";
|
||||
wg-pubkey = "JlH1X4KRT+B8Uau+qTLtBqyapkbGClIj1db7znU77kc=";
|
||||
ip-addrs = {
|
||||
localnet = "192.168.1.201";
|
||||
wgnet = "10.100.0.2";
|
||||
};
|
||||
};
|
||||
phone = {
|
||||
pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILuVT5W3kzjzsuMIWk1oeGtL8jZGtAhRSx8dK8oBJQcG u0_a291";
|
||||
ip-addrs = {
|
||||
localnet = "192.168.1.203";
|
||||
};
|
||||
};
|
||||
aristotle = {
|
||||
pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKTDyKneaM44I5to883ghEnnPonedCKDbCX+OnrQ9vO5 usr";
|
||||
wg-pubkey = "Sw2yyMhyS8GOCWm1VuGn3Y7cfx606dXOGK5mux8ckQU=";
|
||||
ip-addrs = {
|
||||
localnet = "192.168.1.202";
|
||||
wgnet = "10.100.0.3";
|
||||
};
|
||||
};
|
||||
netbox = {
|
||||
wg-privkey = ../secrets/netbox-wg-priv.age;
|
||||
wg-pubkey = "0fOqAfsYO4HvshMPnlkKL7Z1RChq98hjDr0Q8o7OJFE=";
|
||||
ip-addrs = {
|
||||
internet = "beepboop.systems";
|
||||
wgnet = "10.100.0.1";
|
||||
};
|
||||
};
|
||||
|
||||
mkHosts = machines: hostname: network:
|
||||
builtins.listToAttrs [
|
||||
{
|
||||
"name" = (
|
||||
builtins.getAttr network (
|
||||
builtins.getAttr hostname machines
|
||||
).ip-addrs
|
||||
);
|
||||
"value" = [ hostname ];
|
||||
}
|
||||
];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user