update networking foo a bit
This commit is contained in:
parent
49b456a256
commit
b2f62f7208
3 changed files with 44 additions and 23 deletions
19
hive.nix
19
hive.nix
|
@ -30,29 +30,12 @@ in
|
||||||
inputs.home-manager.nixosModules.home-manager
|
inputs.home-manager.nixosModules.home-manager
|
||||||
] ++ builtins.attrValues self.nixosModules;
|
] ++ builtins.attrValues self.nixosModules;
|
||||||
|
|
||||||
options.cherrykitten = {
|
|
||||||
primaryIPv4 = lib.mkOption {
|
|
||||||
type = lib.types.nullOr lib.types.str;
|
|
||||||
default =
|
|
||||||
if (config.networking.interfaces ? eth0) then
|
|
||||||
(builtins.elemAt config.networking.interfaces.eth0.ipv4.addresses 0).address
|
|
||||||
else null;
|
|
||||||
};
|
|
||||||
primaryIPv6 = lib.mkOption {
|
|
||||||
type = lib.types.nullOr lib.types.str;
|
|
||||||
default =
|
|
||||||
if (config.networking.interfaces ? eth0) then
|
|
||||||
(builtins.elemAt config.networking.interfaces.eth0.ipv6.addresses 0).address
|
|
||||||
else null;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
networking.hostName = name;
|
networking.hostName = name;
|
||||||
networking.domain = "cherrykitten.xyz";
|
networking.domain = "cherrykitten.xyz";
|
||||||
|
|
||||||
deployment = {
|
deployment = {
|
||||||
allowLocalDeployment = true;
|
allowLocalDeployment = true;
|
||||||
targetUser = lib.mkDefault "sammy";
|
targetUser = lib.mkDefault "sammy";
|
||||||
tags = [ pkgs.stdenv.hostPlatform.system ];
|
tags = [ pkgs.stdenv.hostPlatform.system ];
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ lib, ... }: {
|
{ lib, config, ... }: {
|
||||||
imports = [
|
imports = [
|
||||||
./gotosocial.nix
|
./gotosocial.nix
|
||||||
../../profiles/hcloud
|
../../profiles/hcloud
|
||||||
|
@ -6,6 +6,12 @@
|
||||||
];
|
];
|
||||||
fileSystems."/" = { device = "/dev/sda1"; fsType = "ext4"; };
|
fileSystems."/" = { device = "/dev/sda1"; fsType = "ext4"; };
|
||||||
cherrykitten.backups.enable = true;
|
cherrykitten.backups.enable = true;
|
||||||
|
cherrykitten.network = {
|
||||||
|
public_IPv4 = "128.140.109.125";
|
||||||
|
public_IPv6 = "2a01:4f8:c2c:bd32::1";
|
||||||
|
internal_IPv4 = "10.69.0.5";
|
||||||
|
internal_IPv6 = "fe80::9400:3ff:fe24:677a";
|
||||||
|
};
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
nameservers = [
|
nameservers = [
|
||||||
|
@ -21,16 +27,22 @@
|
||||||
interfaces = {
|
interfaces = {
|
||||||
eth0 = {
|
eth0 = {
|
||||||
ipv4.addresses = [
|
ipv4.addresses = [
|
||||||
{ address = "128.140.109.125"; prefixLength = 32; }
|
{ address = config.cherrykitten.network.public_IPv4; prefixLength = 32; }
|
||||||
];
|
];
|
||||||
ipv6.addresses = [
|
ipv6.addresses = [
|
||||||
{ address = "2a01:4f8:c2c:bd32::1"; prefixLength = 64; }
|
{ address = config.cherrykitten.network.public_IPv6; prefixLength = 64; }
|
||||||
{ address = "fe80::9400:3ff:fe24:677a"; prefixLength = 64; }
|
|
||||||
];
|
];
|
||||||
ipv4.routes = [{ address = "172.31.1.1"; prefixLength = 32; }];
|
ipv4.routes = [{ address = "172.31.1.1"; prefixLength = 32; }];
|
||||||
ipv6.routes = [{ address = "fe80::1"; prefixLength = 128; }];
|
ipv6.routes = [{ address = "fe80::1"; prefixLength = 128; }];
|
||||||
};
|
};
|
||||||
|
eth1 = {
|
||||||
|
ipv4.addresses = [
|
||||||
|
{ address = config.cherrykitten.network.internal_IPv4; prefixLength = 32; }
|
||||||
|
];
|
||||||
|
ipv6.addresses = [
|
||||||
|
{ address = config.cherrykitten.network.internal_IPv6; prefixLength = 64; }
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
services.udev.extraRules = ''
|
services.udev.extraRules = ''
|
||||||
|
|
26
modules/nixos/cherrykitten/default.nix
Normal file
26
modules/nixos/cherrykitten/default.nix
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.cherrykitten;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.cherrykitten = {
|
||||||
|
network = {
|
||||||
|
public_IPv4 = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
public_IPv6 = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
internal_IPv4 = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
internal_IPv6 = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue