cloud init migration

This commit is contained in:
Evan Reichard 2025-04-08 19:21:03 -04:00
parent b5d767ccee
commit c2ea64512c
4 changed files with 35 additions and 51 deletions

View File

@ -162,10 +162,10 @@ input {
follow_mouse = 1
sensitivity = 0 # -1.0 - 1.0, 0 means no modification.
sensitivity = 0.0 # -1.0 - 1.0, 0 means no modification.
touchpad {
scroll_factor = 0.2
scroll_factor = 0.5
disable_while_typing = true
natural_scroll = true
clickfinger_behavior = true

View File

@ -4,6 +4,7 @@ let
inherit (lib.${namespace}) mkOpt mkBoolOpt;
cfg = config.${namespace}.services.openiscsi;
cloudInitEnabled = config.${namespace}.services.cloud-init.enable;
in
{
options.${namespace}.services.openiscsi = {
@ -30,5 +31,27 @@ in
ln -sf ${pkgs.openiscsi}/bin/iscsiadm /usr/bin/iscsiadm
ln -sf ${pkgs.openiscsi}/bin/iscsid /usr/bin/iscsid
'';
# Cloud Init Compatibility
environment.etc."iscsi/initiatorname.iscsi".enable = mkIf cloudInitEnabled false;
systemd.services.iscsi-initiator-setup = mkIf cloudInitEnabled {
description = "Setup iSCSI Initiator Name";
requires = [ "cloud-final.service" ];
before = [ "iscsid.service" ];
after = [ "cloud-final.service" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
path = [ pkgs.hostname pkgs.util-linux ];
script = ''
mkdir -p /run/iscsi
echo "InitiatorName=iqn.2025.org.nixos:$(hostname)" > /run/iscsi/initiatorname.iscsi
mount --bind /run/iscsi/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
'';
};
};
}

View File

@ -1,4 +1,4 @@
{ config, lib, namespace, ... }:
{ config, pkgs, lib, namespace, ... }:
let
inherit (lib) types mkIf;
inherit (lib.${namespace}) mkOpt mkBoolOpt;
@ -32,6 +32,8 @@ in
7946 # memberlist
];
environment.systemPackages = with pkgs; [ nfs-utils ];
networking.firewall.allowedUDPPorts = mkIf cfg.openFirewall [
# RKE2 Ports - https://docs.rke2.io/install/requirements#networking
8472 # Canal CNI with VXLAN
@ -41,5 +43,11 @@ in
# MetalLB
7946 # memberlist
];
# Cloud Init
systemd.services.rke2-server = mkIf config.${namespace}.services.cloud-init.enable {
after = [ "cloud-final.service" ];
requires = [ "cloud-final.service" ];
};
};
}

View File

@ -1,4 +1,4 @@
{ pkgs, namespace, lib, modulesPath, ... }:
{ namespace, lib, modulesPath, ... }:
let
inherit (lib.${namespace}) enabled;
in
@ -12,12 +12,6 @@ in
system.stateVersion = "24.11";
time.timeZone = "UTC";
fileSystems."/" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
autoResize = true;
};
reichard = {
nix = enabled;
@ -54,46 +48,5 @@ in
};
};
};
systemd.services = {
# RKE2 - Wait Cloud Init
rke2-server = {
after = [ "cloud-final.service" ];
requires = [ "cloud-final.service" ];
};
# Runtime iSCSI Initiator Setup
iscsi-initiator-setup = {
description = "Setup iSCSI Initiator Name";
requires = [ "cloud-final.service" ];
before = [ "iscsid.service" ];
after = [ "cloud-final.service" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
path = [ pkgs.hostname pkgs.util-linux ];
script = ''
mkdir -p /run/iscsi
echo "InitiatorName=iqn.2025.org.nixos:$(hostname)" > /run/iscsi/initiatorname.iscsi
mount --bind /run/iscsi/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
'';
};
};
environment = {
systemPackages = with pkgs; [
htop
nfs-utils
tmux
vim
];
# Don't Manage - Runtime Generation
etc."iscsi/initiatorname.iscsi".enable = false;
};
};
}