Compare commits

2 Commits

Author SHA1 Message Date
UGA Innovation Factory
d8cee7e79b refactor: Make hw definitions modules with mkIf guards
Some checks failed
CI / Flake Check (push) Has been cancelled
CI / Evaluate Key Configurations (nix-builder) (push) Has been cancelled
CI / Evaluate Key Configurations (nix-desktop1) (push) Has been cancelled
CI / Evaluate Key Configurations (nix-laptop1) (push) Has been cancelled
CI / Evaluate Artifacts (installer-iso-nix-laptop1) (push) Has been cancelled
CI / Evaluate Artifacts (lxc-nix-builder) (push) Has been cancelled
CI / Build and Publish Documentation (push) Has been cancelled
CI / Format Check (push) Has been cancelled
2026-01-27 16:30:54 -05:00
UGA Innovation Factory
063336f736 refactor: Fleet and sw behind mkIf guards 2026-01-27 16:11:36 -05:00
14 changed files with 539 additions and 324 deletions

View File

@@ -5,44 +5,60 @@
# - Bootloader configuration (systemd-boot with Plymouth) # - Bootloader configuration (systemd-boot with Plymouth)
# - Timezone and locale settings # - Timezone and locale settings
# - Systemd sleep configuration # - Systemd sleep configuration
#
# Only applies to:
# - Linux systems (not Darwin/macOS)
# - Systems with actual boot hardware (not containers/WSL)
{ lib, ... }:
{ {
boot = { config,
loader.systemd-boot.enable = lib.mkDefault true; lib,
loader.efi.canTouchEfiVariables = lib.mkDefault true; pkgs,
plymouth.enable = lib.mkDefault true; ...
}:
# Enable "Silent boot" let
consoleLogLevel = 3; # Check if this is a bootable system (not container, not WSL)
initrd.verbose = false; isBootable = !(config.boot.isContainer or false) && (pkgs.stdenv.isLinux);
in
{
config = lib.mkIf isBootable {
boot = {
loader.systemd-boot.enable = lib.mkDefault true;
loader.efi.canTouchEfiVariables = lib.mkDefault true;
plymouth.enable = lib.mkDefault true;
# Hide the OS choice for bootloaders. # Enable "Silent boot"
# It's still possible to open the bootloader list by pressing any key consoleLogLevel = 3;
# It will just not appear on screen unless a key is pressed initrd.verbose = false;
loader.timeout = lib.mkDefault 0;
# Hide the OS choice for bootloaders.
# It's still possible to open the bootloader list by pressing any key
# It will just not appear on screen unless a key is pressed
loader.timeout = lib.mkDefault 0;
};
# Set your time zone.
time.timeZone = "America/New_York";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
systemd.sleep.extraConfig = ''
SuspendState=freeze
HibernateDelaySec=2h
'';
}; };
# Set your time zone.
time.timeZone = "America/New_York";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
systemd.sleep.extraConfig = ''
SuspendState=freeze
HibernateDelaySec=2h
'';
} }

View File

@@ -7,8 +7,14 @@
{ {
config, config,
lib, lib,
inputs,
... ...
}: }:
let
# Import all hardware modules so they're available for enabling
hwTypes = import ../hw { inherit inputs; };
hwModules = lib.attrValues hwTypes;
in
{ {
imports = [ imports = [
./fs.nix ./fs.nix
@@ -16,7 +22,9 @@
./user-config.nix ./user-config.nix
./fleet-option.nix ./fleet-option.nix
../sw ../sw
]; inputs.vscode-server.nixosModules.default
inputs.nixos-wsl.nixosModules.default
] ++ hwModules;
options.athenix = { options.athenix = {
forUser = lib.mkOption { forUser = lib.mkOption {

View File

@@ -20,8 +20,6 @@ let
# Import fleet-option.nix (defines athenix.fleet) and inventory.nix (sets values) # Import fleet-option.nix (defines athenix.fleet) and inventory.nix (sets values)
# We use a minimal module here to avoid circular dependencies from common.nix's imports # We use a minimal module here to avoid circular dependencies from common.nix's imports
hostTypes = config.athenix.hwTypes;
# Helper to create a single NixOS system configuration # Helper to create a single NixOS system configuration
mkHost = mkHost =
{ {
@@ -123,11 +121,6 @@ let
} }
) userNixosModulePaths; ) userNixosModulePaths;
# Get the host type module from the hostTypes attribute set
typeModule =
hostTypes.${hostType}
or (throw "Host type '${hostType}' not found. Available types: ${lib.concatStringsSep ", " (lib.attrNames hostTypes)}");
# External module from fetchGit/fetchurl # External module from fetchGit/fetchurl
externalPathModule = externalPathModule =
if externalModulePath != null then import externalModulePath { inherit inputs; } else { }; if externalModulePath != null then import externalModulePath { inherit inputs; } else { };
@@ -155,18 +148,24 @@ let
]; ];
}; };
# Hardware-specific external modules
hwSpecificModules =
lib.optional (hostType == "nix-lxc") "${inputs.nixpkgs.legacyPackages.${system}.path}/nixos/modules/virtualisation/proxmox-lxc.nix";
allModules = allModules =
userNixosModules userNixosModules
++ [ ++ [
./common.nix ./common.nix
typeModule
overrideModule overrideModule
{ networking.hostName = hostName; } { networking.hostName = hostName; }
{ {
# Inject user definitions from flake-parts level # Inject user definitions from flake-parts level
config.athenix.users = lib.mapAttrs (_: user: lib.mapAttrs (_: lib.mkDefault) user) users; config.athenix.users = lib.mapAttrs (_: user: lib.mapAttrs (_: lib.mkDefault) user) users;
} }
# Enable the appropriate hardware module based on hostType
{ config.athenix.hw.${hostType}.enable = lib.mkDefault true; }
] ]
++ hwSpecificModules
++ lib.optional (externalModulePath != null) externalPathModule; ++ lib.optional (externalModulePath != null) externalPathModule;
in in
{ {

View File

@@ -4,9 +4,17 @@
# This module defines: # This module defines:
# - Disko partition layout (EFI, swap, root) # - Disko partition layout (EFI, swap, root)
# - Filesystem options (device, swap size) # - Filesystem options (device, swap size)
#
# Only applies to systems with physical disk management needs
# (not containers, not WSL, not systems without a configured device)
{ config, lib, ... }: { config, lib, ... }:
let
cfg = config.athenix.host.filesystem;
# Only enable disk config if device is set and disko is enabled
hasDiskConfig = cfg.device != null && config.disko.enableConfig;
in
{ {
options.athenix = { options.athenix = {
host.filesystem = { host.filesystem = {
@@ -49,63 +57,67 @@
}; };
}; };
config = { config = lib.mkMerge [
# ========== Disk Partitioning (Disko) ========== {
disko.enableConfig = lib.mkDefault (config.athenix.host.filesystem.device != null); # ========== Disk Partitioning (Disko) ==========
disko.enableConfig = lib.mkDefault (cfg.device != null);
}
disko.devices = { (lib.mkIf hasDiskConfig {
disk.main = { disko.devices = {
type = "disk"; disk.main = {
device = config.athenix.host.filesystem.device; type = "disk";
content = { device = cfg.device;
type = "gpt"; content = {
partitions = { type = "gpt";
# EFI System Partition partitions = {
ESP = { # EFI System Partition
name = "ESP"; ESP = {
label = "BOOT"; name = "ESP";
size = "1G"; label = "BOOT";
type = "EF00"; size = "1G";
content = { type = "EF00";
type = "filesystem"; content = {
format = "vfat"; type = "filesystem";
mountpoint = "/boot"; format = "vfat";
mountOptions = [ "umask=0077" ]; mountpoint = "/boot";
extraArgs = [ mountOptions = [ "umask=0077" ];
"-n" extraArgs = [
"BOOT" "-n"
]; "BOOT"
];
};
}; };
};
# Swap Partition (size configurable per host) # Swap Partition (size configurable per host)
swap = lib.mkIf config.athenix.host.filesystem.useSwap { swap = lib.mkIf cfg.useSwap {
name = "swap"; name = "swap";
label = "swap"; label = "swap";
size = config.athenix.host.filesystem.swapSize; size = cfg.swapSize;
content = { content = {
type = "swap"; type = "swap";
};
}; };
};
# Root Partition (takes remaining space) # Root Partition (takes remaining space)
root = { root = {
name = "root"; name = "root";
label = "root"; label = "root";
size = "100%"; size = "100%";
content = { content = {
type = "filesystem"; type = "filesystem";
format = "ext4"; format = "ext4";
mountpoint = "/"; mountpoint = "/";
extraArgs = [ extraArgs = [
"-L" "-L"
"ROOT" "ROOT"
]; ];
};
}; };
}; };
}; };
}; };
}; };
}; })
}; ];
} }

View File

@@ -10,41 +10,64 @@
modulesPath, modulesPath,
... ...
}: }:
with lib;
let
cfg = config.athenix.hw.nix-desktop;
in
{ {
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
# ========== Boot Configuration ========== options.athenix.hw.nix-desktop = mkOption {
type = types.submodule {
options = {
enable = mkOption {
type = types.bool;
default = false;
description = "Enable desktop workstation hardware configuration.";
};
};
};
default = { };
description = "Desktop workstation hardware type configuration.";
};
boot.initrd.availableKernelModules = [ config = mkIf cfg.enable {
"xhci_pci" # USB 3.0 support
"nvme" # NVMe SSD support
"usb_storage" # USB storage devices
"sd_mod" # SD card support
"sdhci_pci" # SD card host controller
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ]; # Intel virtualization support
boot.extraModulePackages = [ ];
boot.kernelParams = [
"quiet" # Minimal boot messages
"splash" # Show Plymouth boot splash
"boot.shell_on_fail" # Emergency shell on boot failure
"udev.log_priority=3" # Reduce udev logging
"rd.systemd.show_status=auto" # Show systemd status during boot
];
# ========== Filesystem Configuration ========== # ========== Boot Configuration ==========
athenix.host.filesystem.swapSize = lib.mkDefault "16G";
athenix.host.filesystem.device = lib.mkDefault "/dev/nvme0n1";
athenix.host.buildMethods = lib.mkDefault [ "installer-iso" ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
# ========== Hardware Configuration ========== boot.initrd.availableKernelModules = [
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; "xhci_pci" # USB 3.0 support
"nvme" # NVMe SSD support
"usb_storage" # USB storage devices
"sd_mod" # SD card support
"sdhci_pci" # SD card host controller
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ]; # Intel virtualization support
boot.extraModulePackages = [ ];
boot.kernelParams = [
"quiet" # Minimal boot messages
"splash" # Show Plymouth boot splash
"boot.shell_on_fail" # Emergency shell on boot failure
"udev.log_priority=3" # Reduce udev logging
"rd.systemd.show_status=auto" # Show systemd status during boot
];
# ========== Software Profile ========== # ========== Filesystem Configuration ==========
athenix.sw.enable = lib.mkDefault true; athenix.host.filesystem.swapSize = lib.mkDefault "16G";
athenix.sw.desktop.enable = lib.mkDefault true; athenix.host.filesystem.device = lib.mkDefault "/dev/nvme0n1";
athenix.host.buildMethods = lib.mkDefault [ "installer-iso" ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
# ========== Hardware Configuration ==========
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
# ========== Software Profile ==========
athenix.sw.enable = lib.mkDefault true;
athenix.sw.desktop.enable = lib.mkDefault true;
};
} }

View File

@@ -11,56 +11,78 @@
modulesPath, modulesPath,
... ...
}: }:
with lib;
let
cfg = config.athenix.hw.nix-ephemeral;
in
{ {
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
# ========== Boot Configuration ========== options.athenix.hw.nix-ephemeral = mkOption {
boot.initrd.availableKernelModules = [ type = types.submodule {
"xhci_pci" # USB 3.0 support options = {
"nvme" # NVMe support enable = mkOption {
"usb_storage" # USB storage devices type = types.bool;
"sd_mod" # SD card support default = false;
"sdhci_pci" # SD card host controller description = "Enable ephemeral/diskless system hardware configuration.";
]; };
boot.initrd.kernelModules = [ ]; };
boot.kernelModules = [ "kvm-intel" ]; # Intel virtualization support };
boot.extraModulePackages = [ ]; default = { };
boot.kernelParams = [ description = "Ephemeral hardware type configuration.";
"quiet" # Minimal boot messages
"splash" # Show Plymouth boot splash
"boot.shell_on_fail" # Emergency shell on boot failure
"udev.log_priority=3" # Reduce udev logging
"rd.systemd.show_status=auto" # Show systemd status during boot
];
# ========== Ephemeral Configuration ==========
# No persistent storage - everything runs from RAM
athenix.host.filesystem.swapSize = lib.mkForce "0G";
athenix.host.filesystem.device = lib.mkForce "/dev/null"; # Dummy device
athenix.host.buildMethods = lib.mkDefault [
"iso" # Live ISO image
"ipxe" # Network boot
];
# Disable disk management for RAM-only systems
disko.enableConfig = lib.mkForce false;
# Define tmpfs root filesystem
fileSystems."/" = {
device = "none";
fsType = "tmpfs";
options = [
"defaults"
"size=50%"
"mode=755"
];
}; };
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; config = mkIf cfg.enable {
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; # ========== Boot Configuration ==========
boot.initrd.availableKernelModules = [
"xhci_pci" # USB 3.0 support
"nvme" # NVMe support
"usb_storage" # USB storage devices
"sd_mod" # SD card support
"sdhci_pci" # SD card host controller
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ]; # Intel virtualization support
boot.extraModulePackages = [ ];
boot.kernelParams = [
"quiet" # Minimal boot messages
"splash" # Show Plymouth boot splash
"boot.shell_on_fail" # Emergency shell on boot failure
"udev.log_priority=3" # Reduce udev logging
"rd.systemd.show_status=auto" # Show systemd status during boot
];
athenix.sw.enable = lib.mkDefault true; # ========== Ephemeral Configuration ==========
athenix.sw.stateless-kiosk.enable = lib.mkDefault true; # No persistent storage - everything runs from RAM
athenix.host.filesystem.swapSize = lib.mkForce "0G";
athenix.host.filesystem.device = lib.mkForce "/dev/null"; # Dummy device
athenix.host.buildMethods = lib.mkDefault [
"iso" # Live ISO image
"ipxe" # Network boot
];
# Disable disk management for RAM-only systems
disko.enableConfig = lib.mkForce false;
# Define tmpfs root filesystem
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;
athenix.sw.enable = lib.mkDefault true;
athenix.sw.stateless-kiosk.enable = lib.mkDefault true;
};
} }

View File

@@ -10,54 +10,76 @@
modulesPath, modulesPath,
... ...
}: }:
with lib;
let
cfg = config.athenix.hw.nix-laptop;
in
{ {
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
# ========== Boot Configuration ========== options.athenix.hw.nix-laptop = mkOption {
type = types.submodule {
boot.initrd.availableKernelModules = [ options = {
"xhci_pci" # USB 3.0 support enable = mkOption {
"thunderbolt" # Thunderbolt support type = types.bool;
"nvme" # NVMe SSD support default = false;
"usb_storage" # USB storage devices description = "Enable laptop hardware configuration with power management.";
"sd_mod" # SD card support };
"sdhci_pci" # SD card host controller };
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ]; # Intel virtualization support
boot.extraModulePackages = [ ];
boot.kernelParams = [
"quiet" # Minimal boot messages
"splash" # Show Plymouth boot splash
"boot.shell_on_fail" # Emergency shell on boot failure
"udev.log_priority=3" # Reduce udev logging
"rd.systemd.show_status=auto" # Show systemd status during boot
"i915.enable_psr=0" # Disable Panel Self Refresh (stability)
"i915.enable_dc=0" # Disable display power saving
"i915.enable_fbc=0" # Disable framebuffer compression
];
# ========== Hardware Configuration ==========
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
# ========== Filesystem Configuration ==========
athenix.host.filesystem.device = lib.mkDefault "/dev/nvme0n1";
athenix.host.filesystem.swapSize = lib.mkDefault "34G"; # Larger swap for hibernation
athenix.host.buildMethods = lib.mkDefault [ "installer-iso" ];
# ========== Power Management ==========
services.upower.enable = lib.mkDefault true;
services.logind.settings = {
Login = {
HandleLidSwitch = "suspend";
HandleLidSwitchExternalPower = "suspend";
HandleLidSwitchDocked = "ignore";
}; };
default = { };
description = "Laptop hardware type configuration.";
}; };
athenix.sw.enable = lib.mkDefault true; config = mkIf cfg.enable {
athenix.sw.desktop.enable = lib.mkDefault true; # ========== Boot Configuration ==========
boot.initrd.availableKernelModules = [
"xhci_pci" # USB 3.0 support
"thunderbolt" # Thunderbolt support
"nvme" # NVMe SSD support
"usb_storage" # USB storage devices
"sd_mod" # SD card support
"sdhci_pci" # SD card host controller
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ]; # Intel virtualization support
boot.extraModulePackages = [ ];
boot.kernelParams = [
"quiet" # Minimal boot messages
"splash" # Show Plymouth boot splash
"boot.shell_on_fail" # Emergency shell on boot failure
"udev.log_priority=3" # Reduce udev logging
"rd.systemd.show_status=auto" # Show systemd status during boot
"i915.enable_psr=0" # Disable Panel Self Refresh (stability)
"i915.enable_dc=0" # Disable display power saving
"i915.enable_fbc=0" # Disable framebuffer compression
];
# ========== Hardware Configuration ==========
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
# ========== Filesystem Configuration ==========
athenix.host.filesystem.device = lib.mkDefault "/dev/nvme0n1";
athenix.host.filesystem.swapSize = lib.mkDefault "34G"; # Larger swap for hibernation
athenix.host.buildMethods = lib.mkDefault [ "installer-iso" ];
# ========== Power Management ==========
services.upower.enable = lib.mkDefault true;
services.logind.settings = {
Login = {
HandleLidSwitch = "suspend";
HandleLidSwitchExternalPower = "suspend";
HandleLidSwitchDocked = "ignore";
};
};
athenix.sw.enable = lib.mkDefault true;
athenix.sw.desktop.enable = lib.mkDefault true;
};
} }

View File

@@ -5,56 +5,72 @@
# Disables boot/disk management and enables remote development support. # Disables boot/disk management and enables remote development support.
{ {
config,
lib, lib,
modulesPath,
inputs,
... ...
}: }:
with lib;
let
cfg = config.athenix.hw.nix-lxc;
in
{ {
imports = [ options.athenix.hw.nix-lxc = mkOption {
inputs.vscode-server.nixosModules.default type = types.submodule {
"${modulesPath}/virtualisation/proxmox-lxc.nix" options = {
]; enable = mkOption {
type = types.bool;
default = false;
description = "Enable Proxmox LXC container hardware configuration.";
};
};
};
default = { };
description = "Proxmox LXC hardware type configuration.";
};
# ========== Nix Configuration ========== config = mkIf cfg.enable {
nix.settings.trusted-users = [ # ========== Nix Configuration ==========
"root" nix.settings.trusted-users = [
"engr-ugaif" "root"
]; "engr-ugaif"
nix.settings.experimental-features = [ ];
"nix-command" nix.settings.experimental-features = [
"flakes" "nix-command"
]; "flakes"
];
# ========== Container-Specific Configuration ========== # ========== Container-Specific Configuration ==========
boot.isContainer = true; boot.isContainer = true;
boot.loader.systemd-boot.enable = lib.mkForce false; # No bootloader in container boot.loader.systemd-boot.enable = lib.mkForce false; # No bootloader in container
disko.enableConfig = lib.mkForce false; # No disk management in container disko.enableConfig = lib.mkForce false; # No disk management in container
console.enable = true; console.enable = true;
# Allow getty to work in containers # Allow getty to work in containers
systemd.services."getty@".unitConfig.ConditionPathExists = [ systemd.services."getty@".unitConfig.ConditionPathExists = [
"" ""
"/dev/%I" "/dev/%I"
]; ];
# Suppress unnecessary systemd units for containers # Suppress unnecessary systemd units for containers
systemd.suppressedSystemUnits = [ systemd.suppressedSystemUnits = [
"dev-mqueue.mount" "dev-mqueue.mount"
"sys-kernel-debug.mount" "sys-kernel-debug.mount"
"sys-fs-fuse-connections.mount" "sys-fs-fuse-connections.mount"
]; ];
# ========== Remote Development ========== # ========== Remote Development ==========
services.vscode-server.enable = true; services.vscode-server.enable = true;
# ========== System Configuration ========== # ========== System Configuration ==========
system.stateVersion = "25.11"; system.stateVersion = "25.11";
athenix.host.buildMethods = lib.mkDefault [ athenix.host.buildMethods = lib.mkDefault [
"lxc" # LXC container tarball "lxc" # LXC container tarball
"proxmox" # Proxmox VMA archive "proxmox" # Proxmox VMA archive
]; ];
athenix.sw.enable = lib.mkDefault true; athenix.sw.enable = lib.mkDefault true;
athenix.sw.headless.enable = lib.mkDefault true; athenix.sw.headless.enable = lib.mkDefault true;
};
} }

View File

@@ -12,7 +12,11 @@
inputs, inputs,
... ...
}: }:
with lib;
let let
cfg = config.athenix.hw.nix-surface;
# Use older kernel version for better Surface Go compatibility # Use older kernel version for better Surface Go compatibility
refSystem = inputs.nixpkgs-old-kernel.lib.nixosSystem { refSystem = inputs.nixpkgs-old-kernel.lib.nixosSystem {
system = pkgs.stdenv.hostPlatform.system; system = pkgs.stdenv.hostPlatform.system;
@@ -26,44 +30,60 @@ in
inputs.nixos-hardware.nixosModules.microsoft-surface-go inputs.nixos-hardware.nixosModules.microsoft-surface-go
]; ];
# ========== Boot Configuration ========== options.athenix.hw.nix-surface = mkOption {
type = types.submodule {
options = {
enable = mkOption {
type = types.bool;
default = false;
description = "Enable Microsoft Surface tablet hardware configuration.";
};
};
};
default = { };
description = "Microsoft Surface hardware type configuration.";
};
boot.initrd.availableKernelModules = [ config = mkIf cfg.enable {
"xhci_pci" # USB 3.0 support # ========== Boot Configuration ==========
"nvme" # NVMe support (though Surface uses eMMC)
"usb_storage" # USB storage devices
"sd_mod" # SD card support
"sdhci_pci" # SD card host controller
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ]; # Intel virtualization support
boot.extraModulePackages = [ ];
boot.kernelParams = [
"quiet" # Minimal boot messages
"splash" # Show Plymouth boot splash
"boot.shell_on_fail" # Emergency shell on boot failure
"udev.log_priority=3" # Reduce udev logging
"rd.systemd.show_status=auto" # Show systemd status during boot
"intel_ipu3_imgu" # Intel camera image processing
"intel_ipu3_isys" # Intel camera sensor interface
"fbcon=map:1" # Framebuffer console mapping
"i915.enable_psr=0" # Disable Panel Self Refresh (breaks resume)
"i915.enable_dc=0" # Disable display power saving
];
# Use older kernel for better Surface hardware support boot.initrd.availableKernelModules = [
boot.kernelPackages = lib.mkForce refKernelPackages; "xhci_pci" # USB 3.0 support
"nvme" # NVMe support (though Surface uses eMMC)
"usb_storage" # USB storage devices
"sd_mod" # SD card support
"sdhci_pci" # SD card host controller
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ]; # Intel virtualization support
boot.extraModulePackages = [ ];
boot.kernelParams = [
"quiet" # Minimal boot messages
"splash" # Show Plymouth boot splash
"boot.shell_on_fail" # Emergency shell on boot failure
"udev.log_priority=3" # Reduce udev logging
"rd.systemd.show_status=auto" # Show systemd status during boot
"intel_ipu3_imgu" # Intel camera image processing
"intel_ipu3_isys" # Intel camera sensor interface
"fbcon=map:1" # Framebuffer console mapping
"i915.enable_psr=0" # Disable Panel Self Refresh (breaks resume)
"i915.enable_dc=0" # Disable display power saving
];
# ========== Filesystem Configuration ========== # Use older kernel for better Surface hardware support
athenix.host.filesystem.swapSize = lib.mkDefault "8G"; boot.kernelPackages = lib.mkForce refKernelPackages;
athenix.host.filesystem.device = lib.mkDefault "/dev/mmcblk0"; # eMMC storage # eMMC storage
athenix.host.buildMethods = lib.mkDefault [ "installer-iso" ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
# ========== Hardware Configuration ========== # ========== Filesystem Configuration ==========
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; athenix.host.filesystem.swapSize = lib.mkDefault "8G";
athenix.host.filesystem.device = lib.mkDefault "/dev/mmcblk0"; # eMMC storage # eMMC storage
athenix.host.buildMethods = lib.mkDefault [ "installer-iso" ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
# ========== Software Profile ========== # ========== Hardware Configuration ==========
athenix.sw.enable = lib.mkDefault true; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
athenix.sw.tablet-kiosk.enable = lib.mkDefault true; # Touch-optimized kiosk mode
# ========== Software Profile ==========
athenix.sw.enable = lib.mkDefault true;
athenix.sw.tablet-kiosk.enable = lib.mkDefault true; # Touch-optimized kiosk mode
};
} }

View File

@@ -7,16 +7,30 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
{
imports = [
inputs.nixos-wsl.nixosModules.default
inputs.vscode-server.nixosModules.default
];
# ========== Options ========== with lib;
let
cfg = config.athenix.hw.nix-wsl;
in
{
options.athenix.hw.nix-wsl = mkOption {
type = types.submodule {
options = {
enable = mkOption {
type = types.bool;
default = false;
description = "Enable Windows Subsystem for Linux hardware configuration.";
};
};
};
default = { };
description = "WSL hardware type configuration.";
};
# WSL user option (at module level, not inside config)
options.athenix.host.wsl.user = lib.mkOption { options.athenix.host.wsl.user = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "engr-ugaif"; default = "engr-ugaif";
@@ -29,7 +43,7 @@
example = "alice"; example = "alice";
}; };
config = { config = mkIf cfg.enable {
# ========== WSL Configuration ========== # ========== WSL Configuration ==========
wsl.enable = true; wsl.enable = true;
# Use forUser if set, otherwise fall back to wsl.user option # Use forUser if set, otherwise fall back to wsl.user option
@@ -55,5 +69,8 @@
# Provide dummy values for required options from boot.nix # Provide dummy values for required options from boot.nix
athenix.host.filesystem.device = "/dev/null"; athenix.host.filesystem.device = "/dev/null";
athenix.host.filesystem.swapSize = "0G"; athenix.host.filesystem.swapSize = "0G";
# WSL doesn't use installer ISOs
athenix.host.buildMethods = lib.mkDefault [ ];
}; };
} }

View File

@@ -10,40 +10,62 @@
modulesPath, modulesPath,
... ...
}: }:
with lib;
let
cfg = config.athenix.hw.nix-zima;
in
{ {
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
# ========== Boot Configuration ========== options.athenix.hw.nix-zima = mkOption {
type = types.submodule {
options = {
enable = mkOption {
type = types.bool;
default = false;
description = "Enable Zima-specific hardware configuration.";
};
};
};
default = { };
description = "Zima hardware type configuration.";
};
boot.initrd.availableKernelModules = [ config = mkIf cfg.enable {
"xhci_pci" # USB 3.0 support # ========== Boot Configuration ==========
"usb_storage" # USB storage devices
"sd_mod" # SD card support
"sdhci_pci" # SD card host controller
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ]; # Intel virtualization support
boot.extraModulePackages = [ ];
boot.kernelParams = [
"quiet" # Minimal boot messages
"splash" # Show Plymouth boot splash
"boot.shell_on_fail" # Emergency shell on boot failure
"udev.log_priority=3" # Reduce udev logging
"rd.systemd.show_status=auto" # Show systemd status during boot
];
# ========== Filesystem Configuration ========== boot.initrd.availableKernelModules = [
athenix.host.filesystem.useSwap = lib.mkDefault false; "xhci_pci" # USB 3.0 support
athenix.host.filesystem.device = lib.mkDefault "/dev/mmcblk0"; "usb_storage" # USB storage devices
athenix.host.buildMethods = lib.mkDefault [ "installer-iso" ]; "sd_mod" # SD card support
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; "sdhci_pci" # SD card host controller
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ]; # Intel virtualization support
boot.extraModulePackages = [ ];
boot.kernelParams = [
"quiet" # Minimal boot messages
"splash" # Show Plymouth boot splash
"boot.shell_on_fail" # Emergency shell on boot failure
"udev.log_priority=3" # Reduce udev logging
"rd.systemd.show_status=auto" # Show systemd status during boot
];
# ========== Hardware Configuration ========== # ========== Filesystem Configuration ==========
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; athenix.host.filesystem.useSwap = lib.mkDefault false;
athenix.host.filesystem.device = lib.mkDefault "/dev/mmcblk0";
athenix.host.buildMethods = lib.mkDefault [ "installer-iso" ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
# ========== Software Profile ========== # ========== Hardware Configuration ==========
athenix.sw.enable = lib.mkDefault true; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
athenix.sw.desktop.enable = lib.mkDefault true;
# ========== Software Profile ==========
athenix.sw.enable = lib.mkDefault true;
athenix.sw.desktop.enable = lib.mkDefault true;
};
} }

View File

@@ -1,4 +1,6 @@
{ {
config,
lib,
pkgs, pkgs,
... ...
}: }:
@@ -10,7 +12,11 @@
# It reconstructs the terminfo database from the provided definition and # It reconstructs the terminfo database from the provided definition and
# adds it to the system packages. # adds it to the system packages.
with lib;
let let
cfg = config.athenix.sw;
ghostty-terminfo = pkgs.runCommand "ghostty-terminfo" { } '' ghostty-terminfo = pkgs.runCommand "ghostty-terminfo" { } ''
mkdir -p $out/share/terminfo mkdir -p $out/share/terminfo
cat > ghostty.info <<'EOF' cat > ghostty.info <<'EOF'
@@ -99,5 +105,7 @@ let
''; '';
in in
{ {
environment.systemPackages = [ ghostty-terminfo ]; config = mkIf cfg.enable {
environment.systemPackages = [ ghostty-terminfo ];
};
} }

View File

@@ -18,10 +18,27 @@ let
cfg = config.athenix.sw.python; cfg = config.athenix.sw.python;
in in
{ {
options.athenix.sw.python = { options.athenix.sw.python = lib.mkOption {
enable = mkEnableOption "Python development tools (pixi, uv)" // { type = lib.types.submodule {
default = true; options = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Enable Python development tools (pixi, uv).
Provides:
- pixi: Fast, cross-platform package manager for Python
- uv: Extremely fast Python package installer and resolver
These tools manage project-based dependencies rather than global
Python packages, avoiding conflicts and improving reproducibility.
'';
};
};
}; };
default = { };
description = "Python development environment configuration.";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {

View File

@@ -1,6 +1,18 @@
{ pkgs, ... }:
{ {
environment.systemPackages = with pkgs; [ config,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.athenix.sw;
in
{
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
python3 python3
git git
(pkgs.writeShellScriptBin "update-ref" '' (pkgs.writeShellScriptBin "update-ref" ''
@@ -508,4 +520,5 @@
printf " rev = %s\n" "$CUR_REV" >&2 printf " rev = %s\n" "$CUR_REV" >&2
'') '')
]; ];
};
} }