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
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
This commit is contained in:
@@ -7,8 +7,14 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
# Import all hardware modules so they're available for enabling
|
||||
hwTypes = import ../hw { inherit inputs; };
|
||||
hwModules = lib.attrValues hwTypes;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./fs.nix
|
||||
@@ -16,7 +22,9 @@
|
||||
./user-config.nix
|
||||
./fleet-option.nix
|
||||
../sw
|
||||
];
|
||||
inputs.vscode-server.nixosModules.default
|
||||
inputs.nixos-wsl.nixosModules.default
|
||||
] ++ hwModules;
|
||||
|
||||
options.athenix = {
|
||||
forUser = lib.mkOption {
|
||||
|
||||
@@ -20,8 +20,6 @@ let
|
||||
# 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
|
||||
|
||||
hostTypes = config.athenix.hwTypes;
|
||||
|
||||
# Helper to create a single NixOS system configuration
|
||||
mkHost =
|
||||
{
|
||||
@@ -123,11 +121,6 @@ let
|
||||
}
|
||||
) 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
|
||||
externalPathModule =
|
||||
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 =
|
||||
userNixosModules
|
||||
++ [
|
||||
./common.nix
|
||||
typeModule
|
||||
overrideModule
|
||||
{ networking.hostName = hostName; }
|
||||
{
|
||||
# Inject user definitions from flake-parts level
|
||||
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;
|
||||
in
|
||||
{
|
||||
|
||||
@@ -10,41 +10,64 @@
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.athenix.hw.nix-desktop;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
(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 = [
|
||||
"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
|
||||
];
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
# ========== Filesystem 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";
|
||||
# ========== Boot Configuration ==========
|
||||
|
||||
# ========== Hardware Configuration ==========
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
boot.initrd.availableKernelModules = [
|
||||
"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 ==========
|
||||
athenix.sw.enable = lib.mkDefault true;
|
||||
athenix.sw.desktop.enable = lib.mkDefault true;
|
||||
# ========== Filesystem 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 ==========
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
|
||||
# ========== Software Profile ==========
|
||||
athenix.sw.enable = lib.mkDefault true;
|
||||
athenix.sw.desktop.enable = lib.mkDefault true;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -11,56 +11,78 @@
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.athenix.hw.nix-ephemeral;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
# ========== 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
|
||||
];
|
||||
|
||||
# ========== 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"
|
||||
];
|
||||
options.athenix.hw.nix-ephemeral = mkOption {
|
||||
type = types.submodule {
|
||||
options = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enable ephemeral/diskless system hardware configuration.";
|
||||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
description = "Ephemeral hardware type configuration.";
|
||||
};
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
config = mkIf cfg.enable {
|
||||
# ========== 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;
|
||||
athenix.sw.stateless-kiosk.enable = lib.mkDefault true;
|
||||
# ========== 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";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
|
||||
athenix.sw.enable = lib.mkDefault true;
|
||||
athenix.sw.stateless-kiosk.enable = lib.mkDefault true;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,54 +10,76 @@
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.athenix.hw.nix-laptop;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
# ========== 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";
|
||||
options.athenix.hw.nix-laptop = mkOption {
|
||||
type = types.submodule {
|
||||
options = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enable laptop hardware configuration with power management.";
|
||||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
description = "Laptop hardware type configuration.";
|
||||
};
|
||||
|
||||
athenix.sw.enable = lib.mkDefault true;
|
||||
athenix.sw.desktop.enable = lib.mkDefault true;
|
||||
config = mkIf cfg.enable {
|
||||
# ========== 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;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,56 +5,72 @@
|
||||
# Disables boot/disk management and enables remote development support.
|
||||
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
modulesPath,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.athenix.hw.nix-lxc;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
inputs.vscode-server.nixosModules.default
|
||||
"${modulesPath}/virtualisation/proxmox-lxc.nix"
|
||||
];
|
||||
options.athenix.hw.nix-lxc = mkOption {
|
||||
type = types.submodule {
|
||||
options = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enable Proxmox LXC container hardware configuration.";
|
||||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
description = "Proxmox LXC hardware type configuration.";
|
||||
};
|
||||
|
||||
# ========== Nix Configuration ==========
|
||||
nix.settings.trusted-users = [
|
||||
"root"
|
||||
"engr-ugaif"
|
||||
];
|
||||
nix.settings.experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
config = mkIf cfg.enable {
|
||||
# ========== Nix Configuration ==========
|
||||
nix.settings.trusted-users = [
|
||||
"root"
|
||||
"engr-ugaif"
|
||||
];
|
||||
nix.settings.experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
|
||||
# ========== Container-Specific Configuration ==========
|
||||
boot.isContainer = true;
|
||||
boot.loader.systemd-boot.enable = lib.mkForce false; # No bootloader in container
|
||||
disko.enableConfig = lib.mkForce false; # No disk management in container
|
||||
console.enable = true;
|
||||
# ========== Container-Specific Configuration ==========
|
||||
boot.isContainer = true;
|
||||
boot.loader.systemd-boot.enable = lib.mkForce false; # No bootloader in container
|
||||
disko.enableConfig = lib.mkForce false; # No disk management in container
|
||||
console.enable = true;
|
||||
|
||||
# Allow getty to work in containers
|
||||
systemd.services."getty@".unitConfig.ConditionPathExists = [
|
||||
""
|
||||
"/dev/%I"
|
||||
];
|
||||
# Allow getty to work in containers
|
||||
systemd.services."getty@".unitConfig.ConditionPathExists = [
|
||||
""
|
||||
"/dev/%I"
|
||||
];
|
||||
|
||||
# Suppress unnecessary systemd units for containers
|
||||
systemd.suppressedSystemUnits = [
|
||||
"dev-mqueue.mount"
|
||||
"sys-kernel-debug.mount"
|
||||
"sys-fs-fuse-connections.mount"
|
||||
];
|
||||
# Suppress unnecessary systemd units for containers
|
||||
systemd.suppressedSystemUnits = [
|
||||
"dev-mqueue.mount"
|
||||
"sys-kernel-debug.mount"
|
||||
"sys-fs-fuse-connections.mount"
|
||||
];
|
||||
|
||||
# ========== Remote Development ==========
|
||||
services.vscode-server.enable = true;
|
||||
# ========== Remote Development ==========
|
||||
services.vscode-server.enable = true;
|
||||
|
||||
# ========== System Configuration ==========
|
||||
system.stateVersion = "25.11";
|
||||
athenix.host.buildMethods = lib.mkDefault [
|
||||
"lxc" # LXC container tarball
|
||||
"proxmox" # Proxmox VMA archive
|
||||
];
|
||||
# ========== System Configuration ==========
|
||||
system.stateVersion = "25.11";
|
||||
athenix.host.buildMethods = lib.mkDefault [
|
||||
"lxc" # LXC container tarball
|
||||
"proxmox" # Proxmox VMA archive
|
||||
];
|
||||
|
||||
athenix.sw.enable = lib.mkDefault true;
|
||||
athenix.sw.headless.enable = lib.mkDefault true;
|
||||
athenix.sw.enable = lib.mkDefault true;
|
||||
athenix.sw.headless.enable = lib.mkDefault true;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -12,7 +12,11 @@
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.athenix.hw.nix-surface;
|
||||
# Use older kernel version for better Surface Go compatibility
|
||||
refSystem = inputs.nixpkgs-old-kernel.lib.nixosSystem {
|
||||
system = pkgs.stdenv.hostPlatform.system;
|
||||
@@ -26,44 +30,60 @@ in
|
||||
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 = [
|
||||
"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
|
||||
];
|
||||
config = mkIf cfg.enable {
|
||||
# ========== Boot Configuration ==========
|
||||
|
||||
# Use older kernel for better Surface hardware support
|
||||
boot.kernelPackages = lib.mkForce refKernelPackages;
|
||||
boot.initrd.availableKernelModules = [
|
||||
"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 ==========
|
||||
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";
|
||||
# Use older kernel for better Surface hardware support
|
||||
boot.kernelPackages = lib.mkForce refKernelPackages;
|
||||
|
||||
# ========== Hardware Configuration ==========
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
# ========== Filesystem Configuration ==========
|
||||
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 ==========
|
||||
athenix.sw.enable = lib.mkDefault true;
|
||||
athenix.sw.tablet-kiosk.enable = lib.mkDefault true; # Touch-optimized kiosk mode
|
||||
# ========== Hardware Configuration ==========
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
|
||||
# ========== Software Profile ==========
|
||||
athenix.sw.enable = lib.mkDefault true;
|
||||
athenix.sw.tablet-kiosk.enable = lib.mkDefault true; # Touch-optimized kiosk mode
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,16 +7,30 @@
|
||||
{
|
||||
lib,
|
||||
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 {
|
||||
type = lib.types.str;
|
||||
default = "engr-ugaif";
|
||||
@@ -29,7 +43,7 @@
|
||||
example = "alice";
|
||||
};
|
||||
|
||||
config = {
|
||||
config = mkIf cfg.enable {
|
||||
# ========== WSL Configuration ==========
|
||||
wsl.enable = true;
|
||||
# Use forUser if set, otherwise fall back to wsl.user option
|
||||
@@ -55,5 +69,8 @@
|
||||
# Provide dummy values for required options from boot.nix
|
||||
athenix.host.filesystem.device = "/dev/null";
|
||||
athenix.host.filesystem.swapSize = "0G";
|
||||
|
||||
# WSL doesn't use installer ISOs
|
||||
athenix.host.buildMethods = lib.mkDefault [ ];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,40 +10,62 @@
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.athenix.hw.nix-zima;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
(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 = [
|
||||
"xhci_pci" # USB 3.0 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
|
||||
];
|
||||
config = mkIf cfg.enable {
|
||||
# ========== Boot Configuration ==========
|
||||
|
||||
# ========== Filesystem Configuration ==========
|
||||
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";
|
||||
boot.initrd.availableKernelModules = [
|
||||
"xhci_pci" # USB 3.0 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
|
||||
];
|
||||
|
||||
# ========== Hardware Configuration ==========
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
# ========== Filesystem Configuration ==========
|
||||
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 ==========
|
||||
athenix.sw.enable = lib.mkDefault true;
|
||||
athenix.sw.desktop.enable = lib.mkDefault true;
|
||||
# ========== 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;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user