Begin getting base setup implemented
This commit is contained in:
parent
453099b068
commit
84f6e1a93f
11 changed files with 425 additions and 0 deletions
57
nix/modules/nixos/hetzner/default.nix
Normal file
57
nix/modules/nixos/hetzner/default.nix
Normal file
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
system,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.khscodes.hetzner;
|
||||
in
|
||||
{
|
||||
options.khscodes.hetzner = {
|
||||
enable = lib.mkEnableOption "Enables the machine as a hetzner machine";
|
||||
ipv6-addr = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "IPv6 address of the server, for now detecting this from the server itself is not supported";
|
||||
default = null;
|
||||
};
|
||||
diskName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "nixos";
|
||||
description = "Name of the root disk device";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
disko = lib.khscodes.disko-root-lvm {
|
||||
device = "/dev/sda";
|
||||
diskName = cfg.diskName;
|
||||
};
|
||||
|
||||
boot.tmp.cleanOnBoot = lib.mkDefault true;
|
||||
boot.initrd.kernelModules = lib.mkIf (system == "aarch64-linux") [ "virtio_gpu" ];
|
||||
boot.kernelParams = lib.mkIf (system == "aarch64-linux") [ "console=tty" ];
|
||||
zramSwap.enable = lib.mkDefault true;
|
||||
khscodes.systemd-boot.enable = lib.mkDefault true;
|
||||
khscodes.qemu-guest.enable = true;
|
||||
networking = {
|
||||
useDHCP = false;
|
||||
useNetworkd = false;
|
||||
};
|
||||
systemd.network = {
|
||||
enable = true;
|
||||
networks."10-enp1s0" = {
|
||||
matchConfig.Name = [
|
||||
"eth0"
|
||||
"enp1s0"
|
||||
];
|
||||
networkConfig = {
|
||||
DHCP = "ipv4";
|
||||
};
|
||||
routes = [ { Gateway = "fe80::1"; } ];
|
||||
linkConfig.RequiredForOnline = "routable";
|
||||
address = lib.mkIf (cfg.ipv6-addr != null) [ cfg.ipv6-addr ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue