refactor: Make more modular and do some refactoring

This commit is contained in:
UGA Innovation Factory
2025-12-15 17:07:31 -05:00
committed by Hunter Halloran
parent 205f03337a
commit 01af38a5b9
11 changed files with 393 additions and 337 deletions

View File

@@ -1,43 +1,41 @@
{ inputs, ... }:
[
(
{
config,
lib,
modulesPath,
...
}:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
{
config,
lib,
modulesPath,
...
}:
{
imports = [
(import ../common.nix { inherit inputs; })
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [
"xhci_pci"
"nvme"
"usb_storage"
"sd_mod"
"sdhci_pci"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot.kernelParams = [
"quiet"
"splash"
"boot.shell_on_fail"
"udev.log_priority=3"
"rd.systemd.show_status=auto"
];
boot.initrd.availableKernelModules = [
"xhci_pci"
"nvme"
"usb_storage"
"sd_mod"
"sdhci_pci"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot.kernelParams = [
"quiet"
"splash"
"boot.shell_on_fail"
"udev.log_priority=3"
"rd.systemd.show_status=auto"
];
ugaif.host.filesystem.swapSize = lib.mkDefault "16G";
ugaif.host.filesystem.device = lib.mkDefault "/dev/nvme0n1";
ugaif.host.buildMethods = lib.mkDefault [ "installer-iso" ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
ugaif.host.filesystem.swapSize = lib.mkDefault "16G";
ugaif.host.filesystem.device = lib.mkDefault "/dev/nvme0n1";
ugaif.host.buildMethods = lib.mkDefault [ "installer-iso" ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
)
{
ugaif.sw.enable = true;
ugaif.sw.type = "desktop";
}
]
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
ugaif.sw.enable = true;
ugaif.sw.type = lib.mkDefault "desktop";
}

View File

@@ -1,63 +1,61 @@
{ inputs, ... }:
[
(
{
config,
lib,
modulesPath,
...
}:
{
# This host type is for ephemeral, diskless systems (e.g. kiosks, netboot clients).
# It runs entirely from RAM and does not persist state across reboots.
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
{
config,
lib,
modulesPath,
...
}:
{
# This host type is for ephemeral, diskless systems (e.g. kiosks, netboot clients).
# It runs entirely from RAM and does not persist state across reboots.
imports = [
(import ../common.nix { inherit inputs; })
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [
"xhci_pci"
"nvme"
"usb_storage"
"sd_mod"
"sdhci_pci"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot.kernelParams = [
"quiet"
"splash"
"boot.shell_on_fail"
"udev.log_priority=3"
"rd.systemd.show_status=auto"
];
boot.initrd.availableKernelModules = [
"xhci_pci"
"nvme"
"usb_storage"
"sd_mod"
"sdhci_pci"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot.kernelParams = [
"quiet"
"splash"
"boot.shell_on_fail"
"udev.log_priority=3"
"rd.systemd.show_status=auto"
];
# Ephemeral setup: No swap, no disk
ugaif.host.filesystem.swapSize = lib.mkForce "0G";
ugaif.host.filesystem.device = lib.mkForce "/dev/null"; # Dummy device
ugaif.host.buildMethods = lib.mkDefault [
"iso"
"ipxe"
];
# Ephemeral setup: No swap, no disk
ugaif.host.filesystem.swapSize = lib.mkForce "0G";
ugaif.host.filesystem.device = lib.mkForce "/dev/null"; # Dummy device
ugaif.host.buildMethods = lib.mkDefault [
"iso"
"ipxe"
];
# Disable Disko config since we are running from RAM/ISO
disko.enableConfig = lib.mkForce false;
# Disable Disko config since we are running from RAM/ISO
disko.enableConfig = lib.mkForce false;
# Define a dummy root filesystem to satisfy assertions
fileSystems."/" = {
device = "none";
fsType = "tmpfs";
options = [
"defaults"
"size=50%"
"mode=755"
];
};
# Define a dummy root filesystem to satisfy assertions
fileSystems."/" = {
device = "none";
fsType = "tmpfs";
options = [
"defaults"
"size=50%"
"mode=755"
];
};
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
)
{
ugaif.sw.enable = true;
ugaif.sw.type = "stateless-kiosk";
}
]
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
ugaif.sw.enable = true;
ugaif.sw.type = lib.mkDefault "stateless-kiosk";
}

View File

@@ -1,57 +1,55 @@
{ inputs, ... }:
[
(
{
config,
lib,
modulesPath,
...
}:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
{
config,
lib,
modulesPath,
...
}:
{
imports = [
(import ../common.nix { inherit inputs; })
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [
"xhci_pci"
"thunderbolt"
"nvme"
"usb_storage"
"sd_mod"
"sdhci_pci"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot.kernelParams = [
"quiet"
"splash"
"boot.shell_on_fail"
"udev.log_priority=3"
"rd.systemd.show_status=auto"
"i915.enable_psr=0"
"i915.enable_dc=0"
"i915.enable_fbc=0"
];
boot.initrd.availableKernelModules = [
"xhci_pci"
"thunderbolt"
"nvme"
"usb_storage"
"sd_mod"
"sdhci_pci"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot.kernelParams = [
"quiet"
"splash"
"boot.shell_on_fail"
"udev.log_priority=3"
"rd.systemd.show_status=auto"
"i915.enable_psr=0"
"i915.enable_dc=0"
"i915.enable_fbc=0"
];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
ugaif.host.filesystem.device = lib.mkDefault "/dev/nvme0n1";
ugaif.host.filesystem.swapSize = lib.mkDefault "34G";
ugaif.host.buildMethods = lib.mkDefault [ "installer-iso" ];
ugaif.host.filesystem.device = lib.mkDefault "/dev/nvme0n1";
ugaif.host.filesystem.swapSize = lib.mkDefault "34G";
ugaif.host.buildMethods = lib.mkDefault [ "installer-iso" ];
# Suspend / logind behavior
services.upower.enable = lib.mkDefault true;
services.logind.settings = {
Login = {
HandleLidSwitch = "suspend";
HandleLidSwitchExternalPower = "suspend";
HandleLidSwitchDocked = "ignore";
};
};
}
)
{
ugaif.sw.enable = true;
ugaif.sw.type = "desktop";
}
]
# Suspend / logind behavior
services.upower.enable = lib.mkDefault true;
services.logind.settings = {
Login = {
HandleLidSwitch = "suspend";
HandleLidSwitchExternalPower = "suspend";
HandleLidSwitchDocked = "ignore";
};
};
ugaif.sw.enable = true;
ugaif.sw.type = lib.mkDefault "desktop";
}

View File

@@ -1,48 +1,46 @@
{ inputs, ... }:
[
inputs.vscode-server.nixosModules.default
(
{
config,
lib,
modulesPath,
...
}:
{
nix.settings.trusted-users = [
"root"
"engr-ugaif"
];
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
imports = [
"${modulesPath}/virtualisation/proxmox-lxc.nix"
];
boot.isContainer = true;
boot.loader.systemd-boot.enable = lib.mkForce false;
disko.enableConfig = lib.mkForce false;
console.enable = true;
systemd.services."getty@".unitConfig.ConditionPathExists = [
""
"/dev/%I"
];
systemd.suppressedSystemUnits = [
"dev-mqueue.mount"
"sys-kernel-debug.mount"
"sys-fs-fuse-connections.mount"
];
services.vscode-server.enable = true;
system.stateVersion = "25.11";
ugaif.host.buildMethods = lib.mkDefault [
"lxc"
"proxmox"
];
}
)
{
ugaif.sw.enable = true;
ugaif.sw.type = "headless";
}
]
{
config,
lib,
modulesPath,
...
}:
{
imports = [
(import ../common.nix { inherit inputs; })
inputs.vscode-server.nixosModules.default
"${modulesPath}/virtualisation/proxmox-lxc.nix"
];
nix.settings.trusted-users = [
"root"
"engr-ugaif"
];
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
boot.isContainer = true;
boot.loader.systemd-boot.enable = lib.mkForce false;
disko.enableConfig = lib.mkForce false;
console.enable = true;
systemd.services."getty@".unitConfig.ConditionPathExists = [
""
"/dev/%I"
];
systemd.suppressedSystemUnits = [
"dev-mqueue.mount"
"sys-kernel-debug.mount"
"sys-fs-fuse-connections.mount"
];
services.vscode-server.enable = true;
system.stateVersion = "25.11";
ugaif.host.buildMethods = lib.mkDefault [
"lxc"
"proxmox"
];
ugaif.sw.enable = true;
ugaif.sw.type = lib.mkDefault "headless";
}

View File

@@ -1,59 +1,57 @@
{ inputs, ... }:
[
(
{
config,
lib,
pkgs,
modulesPath,
...
}:
let
refSystem = inputs.nixpkgs-old-kernel.lib.nixosSystem {
system = pkgs.stdenv.hostPlatform.system;
modules = [ inputs.nixos-hardware.nixosModules.microsoft-surface-go ];
};
refKernelPackages = refSystem.config.boot.kernelPackages;
in
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
{
config,
lib,
pkgs,
modulesPath,
...
}:
let
refSystem = inputs.nixpkgs-old-kernel.lib.nixosSystem {
system = pkgs.stdenv.hostPlatform.system;
modules = [ inputs.nixos-hardware.nixosModules.microsoft-surface-go ];
};
refKernelPackages = refSystem.config.boot.kernelPackages;
in
{
imports = [
(import ../common.nix { inherit inputs; })
(modulesPath + "/installer/scan/not-detected.nix")
inputs.nixos-hardware.nixosModules.microsoft-surface-go
];
boot.initrd.availableKernelModules = [
"xhci_pci"
"nvme"
"usb_storage"
"sd_mod"
"sdhci_pci"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot.kernelParams = [
"quiet"
"splash"
"boot.shell_on_fail"
"udev.log_priority=3"
"rd.systemd.show_status=auto"
"intel_ipu3_imgu"
"intel_ipu3_isys"
"fbcon=map:1"
"i915.enable_psr=0" # Panel Self Refresh breaks resume on Surface
"i915.enable_dc=0"
];
boot.initrd.availableKernelModules = [
"xhci_pci"
"nvme"
"usb_storage"
"sd_mod"
"sdhci_pci"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot.kernelParams = [
"quiet"
"splash"
"boot.shell_on_fail"
"udev.log_priority=3"
"rd.systemd.show_status=auto"
"intel_ipu3_imgu"
"intel_ipu3_isys"
"fbcon=map:1"
"i915.enable_psr=0" # Panel Self Refresh breaks resume on Surface
"i915.enable_dc=0"
];
boot.kernelPackages = lib.mkForce refKernelPackages;
boot.kernelPackages = lib.mkForce refKernelPackages;
ugaif.host.filesystem.swapSize = lib.mkDefault "8G";
ugaif.host.filesystem.device = lib.mkDefault "/dev/mmcblk0";
ugaif.host.buildMethods = lib.mkDefault [ "installer-iso" ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
ugaif.host.filesystem.swapSize = lib.mkDefault "8G";
ugaif.host.filesystem.device = lib.mkDefault "/dev/mmcblk0";
ugaif.host.buildMethods = lib.mkDefault [ "installer-iso" ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
)
inputs.nixos-hardware.nixosModules.microsoft-surface-go
{
ugaif.sw.enable = true;
ugaif.sw.type = "tablet-kiosk";
}
]
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
ugaif.sw.enable = true;
ugaif.sw.type = lib.mkDefault "tablet-kiosk";
}

View File

@@ -1,39 +1,43 @@
{ inputs, ... }:
[
inputs.nixos-wsl.nixosModules.default
inputs.vscode-server.nixosModules.default
(
{ lib, config, ... }:
{
options.ugaif.host.wsl.user = lib.mkOption {
type = lib.types.str;
default = "engr-ugaif";
description = "The default user to log in as in WSL.";
};
{
lib,
config,
...
}:
{
imports = [
(import ../common.nix { inherit inputs; })
inputs.nixos-wsl.nixosModules.default
inputs.vscode-server.nixosModules.default
];
config = {
wsl.enable = true;
wsl.defaultUser = config.ugaif.host.wsl.user;
options.ugaif.host.wsl.user = lib.mkOption {
type = lib.types.str;
default = "engr-ugaif";
description = "The default user to log in as in WSL.";
};
# Enable the headless software profile
ugaif.sw.enable = true;
ugaif.sw.type = "headless";
config = {
wsl.enable = true;
wsl.defaultUser = config.ugaif.host.wsl.user;
# Fix for VS Code Server in WSL if needed, though vscode-server input exists
services.vscode-server.enable = true;
# Enable the headless software profile
ugaif.sw.enable = true;
ugaif.sw.type = lib.mkDefault "headless";
# Disable Disko and Bootloader for WSL
disko.enableConfig = lib.mkForce false;
boot.loader.systemd-boot.enable = lib.mkForce false;
boot.loader.grub.enable = lib.mkForce false;
# Fix for VS Code Server in WSL if needed, though vscode-server input exists
services.vscode-server.enable = true;
# Disable networking for wsl (it manages its own networking)
systemd.network.enable = lib.mkForce false;
# Disable Disko and Bootloader for WSL
disko.enableConfig = lib.mkForce false;
boot.loader.systemd-boot.enable = lib.mkForce false;
boot.loader.grub.enable = lib.mkForce false;
# Provide dummy values for required options from boot.nix
ugaif.host.filesystem.device = "/dev/null";
ugaif.host.filesystem.swapSize = "0G";
};
}
)
]
# Disable networking for wsl (it manages its own networking)
systemd.network.enable = lib.mkForce false;
# Provide dummy values for required options from boot.nix
ugaif.host.filesystem.device = "/dev/null";
ugaif.host.filesystem.swapSize = "0G";
};
}