init minipc

This commit is contained in:
Kopatz
2024-04-29 21:41:20 +02:00
parent f1ca177e3d
commit 9c1d4fc667
13 changed files with 297 additions and 33 deletions

View File

@@ -6,5 +6,6 @@
./nftables.nix
./cli-tools.nix
./tmpfs.nix
./static-ip.nix
];
}

View File

@@ -0,0 +1,41 @@
{config, lib, ...}:
with lib;
let
cfg = config.custom.static-ip;
in
{
options.custom.static-ip = {
enable = mkEnableOption "Enables static-ip";
ip = lib.mkOption {
type = types.str;
description = "ipv4 address";
};
dns = lib.mkOption {
default = types.str;
description = "ip of the dns server";
};
interface = lib.mkOption {
default = types.str;
description = "interface to apply the change to";
};
};
config = mkIf cfg.enable {
networking = {
defaultGateway = "192.168.0.1";
useDHCP = false;
nameservers = [
cfg.dns
"1.1.1.1"
];
interfaces = {
${cfg.interface} = {
name = "eth0";
ipv4.addresses = [{
address = cfg.ip;
prefixLength = 24;
}];
};
};
};
};
}