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,
|
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 {
|
||||||
|
|||||||
@@ -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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 [ ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user