mkopt systemd vs grub

This commit is contained in:
Evan Reichard 2025-09-06 09:47:27 -04:00
parent 26f32d3225
commit f6dbe8ad1d
4 changed files with 29 additions and 11 deletions

View File

@ -9,7 +9,7 @@ in
options.${namespace}.services.rke2 = with types; { options.${namespace}.services.rke2 = with types; {
enable = lib.mkEnableOption "Enable RKE2"; enable = lib.mkEnableOption "Enable RKE2";
disable = mkOpt (listOf str) [ ] "Disable services"; disable = mkOpt (listOf str) [ ] "Disable services";
openFirewall = mkBoolOpt true "Open firewall"; openFirewall = mkBoolOpt false "Open firewall";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -32,8 +32,6 @@ in
7946 # memberlist 7946 # memberlist
]; ];
environment.systemPackages = with pkgs; [ nfs-utils ];
networking.firewall.allowedUDPPorts = mkIf cfg.openFirewall [ networking.firewall.allowedUDPPorts = mkIf cfg.openFirewall [
# RKE2 Ports - https://docs.rke2.io/install/requirements#networking # RKE2 Ports - https://docs.rke2.io/install/requirements#networking
8472 # Canal CNI with VXLAN 8472 # Canal CNI with VXLAN
@ -49,5 +47,7 @@ in
after = [ "cloud-final.service" ]; after = [ "cloud-final.service" ];
requires = [ "cloud-final.service" ]; requires = [ "cloud-final.service" ];
}; };
environment.systemPackages = with pkgs; [ nfs-utils k9s ];
}; };
} }

View File

@ -1,18 +1,29 @@
{ config, lib, namespace, ... }: { config, lib, namespace, ... }:
let let
inherit (lib) mkIf mkDefault; inherit (lib) mkIf mkDefault;
inherit (lib.${namespace}) mkBoolOpt;
cfg = config.${namespace}.system.boot; cfg = config.${namespace}.system.boot;
in in
{ {
options.${namespace}.system.boot = { options.${namespace}.system.boot = {
enable = lib.mkEnableOption "Enable Boot"; enable = lib.mkEnableOption "Enable Boot";
xenGuest = lib.mkEnableOption "Enable Xen Guest"; enableGrub = mkBoolOpt true "Enable GRUB";
enableSystemd = mkBoolOpt false "Enable systemd";
xenGuest = lib.mkEnableOption "Xen guest support";
showNotch = lib.mkEnableOption "Show macOS Notch"; showNotch = lib.mkEnableOption "Show macOS Notch";
silentBoot = lib.mkEnableOption "Silent Boot"; silentBoot = lib.mkEnableOption "Silent Boot";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
assertions = [
{
assertion = !(cfg.enableGrub && cfg.enableSystemd);
message = "Cannot enable both GRUB and systemd-boot";
}
];
services.xe-guest-utilities.enable = mkIf cfg.xenGuest true; services.xe-guest-utilities.enable = mkIf cfg.xenGuest true;
boot = { boot = {
@ -33,13 +44,13 @@ in
canTouchEfiVariables = false; canTouchEfiVariables = false;
}; };
# systemd-boot = { systemd-boot = mkIf cfg.enableSystemd {
# enable = true; enable = true;
# configurationLimit = 20; configurationLimit = 20;
# editor = false; editor = false;
# }; };
grub = { grub = mkIf cfg.enableGrub {
enable = true; enable = true;
efiSupport = true; efiSupport = true;
efiInstallAsRemovable = true; efiInstallAsRemovable = true;

View File

@ -1,4 +1,4 @@
{ namespace, config, lib, modulesPath, ... }: { namespace, config, pkgs, lib, modulesPath, ... }:
let let
inherit (lib.${namespace}) enabled; inherit (lib.${namespace}) enabled;
@ -58,4 +58,10 @@ in
]; ];
}; };
}; };
environment.systemPackages = with pkgs; [
btop
tmux
vim
];
} }

View File

@ -33,6 +33,7 @@ in
cloud-init = enabled; cloud-init = enabled;
rke2 = { rke2 = {
enable = true; enable = true;
openFirewall = true;
disable = [ "rke2-ingress-nginx" ]; disable = [ "rke2-ingress-nginx" ];
}; };
openiscsi = { openiscsi = {