WiP
This commit is contained in:
parent
24eb83266a
commit
6d9a15d2f2
4 changed files with 62 additions and 3 deletions
11
flake.nix
11
flake.nix
|
@ -20,8 +20,15 @@
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
tailscale-proxy = kclib.mkHost "tailscale-proxy" "x86_64-linux";
|
tailscale-proxy = kclib.mkHost {
|
||||||
entrypoint = kclib.mkHost "entrypoint" "x86_64-linux";
|
name = "tailscale-proxy";
|
||||||
|
};
|
||||||
|
entrypoint = kclib.mkHost {
|
||||||
|
name = "entrypoint";
|
||||||
|
};
|
||||||
|
hydra = kclib.mkHost {
|
||||||
|
name = "hydra";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;
|
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;
|
||||||
};
|
};
|
||||||
|
|
12
hosts/hydra.nix
Normal file
12
hosts/hydra.nix
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
kropcloud = {
|
||||||
|
networking = {
|
||||||
|
ipv4 = {
|
||||||
|
enable = true;
|
||||||
|
address = "192.168.1.160";
|
||||||
|
prefixLength = 24;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
5
lib.nix
5
lib.nix
|
@ -4,7 +4,10 @@
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
mkHost =
|
mkHost =
|
||||||
name: arch:
|
{
|
||||||
|
name,
|
||||||
|
arch ? "x86_64-linux",
|
||||||
|
}:
|
||||||
nixpkgs.lib.nixosSystem {
|
nixpkgs.lib.nixosSystem {
|
||||||
system = arch;
|
system = arch;
|
||||||
modules = [
|
modules = [
|
||||||
|
|
|
@ -14,13 +14,50 @@ in
|
||||||
default = true;
|
default = true;
|
||||||
example = false;
|
example = false;
|
||||||
};
|
};
|
||||||
|
# TODO: fix this madness
|
||||||
|
ipv4 = {
|
||||||
|
enable = lib.mkEnableOption "Whence to enable IPv4 configuration";
|
||||||
|
address = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
description = "The server IPv4 address";
|
||||||
|
example = "192.168.1.155";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
prefixLength = lib.mkOption {
|
||||||
|
type = lib.types.int;
|
||||||
|
description = "The server IPv4 address prefix length";
|
||||||
|
default = 24;
|
||||||
|
example = 24;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = !(cfg.ipv4.enable && (cfg.ipv4.address == null || cfg.ipv4.address == "" || cfg.ipv4.prefixLength == null));
|
||||||
|
message = ''
|
||||||
|
You need to provide valid values for both `address` and `prefixLength` in `kropcloud.networking.ipv4`
|
||||||
|
when `kropcloud.networking.ipv4.enable` is true.
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
nftables.enable = true;
|
nftables.enable = true;
|
||||||
firewall = {
|
firewall = {
|
||||||
checkReversePath = "loose";
|
checkReversePath = "loose";
|
||||||
};
|
};
|
||||||
|
interfaces = {
|
||||||
|
ens18 = {
|
||||||
|
ipv4.addresses = lib.mkIf cfg.ipv4.enable [
|
||||||
|
{
|
||||||
|
address = cfg.ipv4.address;
|
||||||
|
prefixLength = cfg.ipv4.prefixLength;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue