refactor: Make more modular and do some refactoring
This commit is contained in:
committed by
Hunter Halloran
parent
205f03337a
commit
01af38a5b9
@@ -91,5 +91,8 @@
|
||||
|
||||
# Expose artifacts to all systems, but they are always built for x86_64-linux
|
||||
packages = forAllSystems (_: artifacts);
|
||||
|
||||
# Expose host type modules for external use
|
||||
nixosModules = import ./installer/modules.nix { inherit inputs; };
|
||||
};
|
||||
}
|
||||
|
||||
@@ -12,35 +12,60 @@
|
||||
# the target device and swap size.
|
||||
|
||||
{
|
||||
options.ugaif.host = {
|
||||
filesystem = {
|
||||
device = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "The main disk device to use for installation.";
|
||||
options.ugaif = {
|
||||
host = {
|
||||
filesystem = {
|
||||
device = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "The main disk device to use for installation.";
|
||||
};
|
||||
swapSize = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "The size of the swap partition.";
|
||||
};
|
||||
};
|
||||
swapSize = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "The size of the swap partition.";
|
||||
buildMethods = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ "installer-iso" ];
|
||||
description = ''
|
||||
List of allowed build methods for this host.
|
||||
Supported methods:
|
||||
- "installer-iso": Generates an auto-install ISO that installs this configuration to disk.
|
||||
- "iso": Generates a live ISO (using nixos-generators).
|
||||
- "ipxe": Generates iPXE netboot artifacts (kernel, initrd, script).
|
||||
- "lxc": Generates an LXC container tarball.
|
||||
- "proxmox": Generates a Proxmox VMA archive.
|
||||
'';
|
||||
};
|
||||
};
|
||||
buildMethods = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ "installer-iso" ];
|
||||
description = ''
|
||||
List of allowed build methods for this host.
|
||||
Supported methods:
|
||||
- "installer-iso": Generates an auto-install ISO that installs this configuration to disk.
|
||||
- "iso": Generates a live ISO (using nixos-generators).
|
||||
- "ipxe": Generates iPXE netboot artifacts (kernel, initrd, script).
|
||||
- "lxc": Generates an LXC container tarball.
|
||||
- "proxmox": Generates a Proxmox VMA archive.
|
||||
'';
|
||||
|
||||
system.gc = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Whether to enable automatic garbage collection.";
|
||||
};
|
||||
frequency = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "weekly";
|
||||
description = "How often to run garbage collection (systemd timer format).";
|
||||
};
|
||||
retentionDays = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 30;
|
||||
description = "Number of days to keep old generations before deletion.";
|
||||
};
|
||||
optimise = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Whether to automatically optimize the Nix store.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
# Enable Disko for declarative partitioning
|
||||
disko.enableConfig = true;
|
||||
disko.enableConfig = lib.mkDefault true;
|
||||
|
||||
disko.devices = {
|
||||
disk.main = {
|
||||
|
||||
47
hosts/common.nix
Normal file
47
hosts/common.nix
Normal file
@@ -0,0 +1,47 @@
|
||||
# ============================================================================
|
||||
# Common Modules
|
||||
# ============================================================================
|
||||
# This module contains all the common configuration shared by all host types.
|
||||
# It includes:
|
||||
# - Boot and user configuration
|
||||
# - Software configurations
|
||||
# - User management (users.nix)
|
||||
# - Home Manager integration
|
||||
# - Secret management (agenix)
|
||||
# - Disk partitioning (disko)
|
||||
# - System-wide Nix settings (experimental features, garbage collection)
|
||||
|
||||
{ inputs }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
./boot.nix
|
||||
./user-config.nix
|
||||
../sw
|
||||
../users.nix
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
inputs.agenix.nixosModules.default
|
||||
inputs.disko.nixosModules.disko
|
||||
];
|
||||
|
||||
system.stateVersion = "25.11";
|
||||
|
||||
nix.settings.experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
|
||||
# Automatic Garbage Collection
|
||||
nix.gc = lib.mkIf config.ugaif.system.gc.enable {
|
||||
automatic = true;
|
||||
dates = config.ugaif.system.gc.frequency;
|
||||
options = "--delete-older-than ${toString config.ugaif.system.gc.retentionDays}d";
|
||||
};
|
||||
|
||||
# Optimize storage
|
||||
nix.optimise.automatic = config.ugaif.system.gc.optimise;
|
||||
}
|
||||
@@ -16,38 +16,6 @@
|
||||
let
|
||||
nixpkgs = inputs.nixpkgs;
|
||||
lib = nixpkgs.lib;
|
||||
home-manager = inputs.home-manager;
|
||||
agenix = inputs.agenix;
|
||||
disko = inputs.disko;
|
||||
|
||||
# Modules shared by all hosts
|
||||
commonModules = [
|
||||
./boot.nix
|
||||
./user-config.nix
|
||||
../users.nix
|
||||
../sw
|
||||
home-manager.nixosModules.home-manager
|
||||
agenix.nixosModules.default
|
||||
disko.nixosModules.disko
|
||||
{
|
||||
system.stateVersion = "25.11";
|
||||
nix.settings.experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
|
||||
# Automatic Garbage Collection
|
||||
nix.gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 30d";
|
||||
};
|
||||
|
||||
# Optimize storage
|
||||
nix.optimise.automatic = true;
|
||||
}
|
||||
];
|
||||
|
||||
# Helper to create a single NixOS system configuration
|
||||
mkHost =
|
||||
{
|
||||
@@ -72,8 +40,7 @@ let
|
||||
) accounts;
|
||||
|
||||
allModules =
|
||||
commonModules
|
||||
++ userFlakeModules
|
||||
userFlakeModules
|
||||
++ extraModules
|
||||
++ [
|
||||
{ networking.hostName = hostName; }
|
||||
@@ -164,7 +131,7 @@ let
|
||||
typeFile = ./types + "/${type}.nix";
|
||||
modules =
|
||||
if builtins.pathExists typeFile then
|
||||
import typeFile { inherit inputs; }
|
||||
[ (import typeFile { inherit inputs; }) ]
|
||||
else
|
||||
throw "Host type '${type}' not found in hosts/types/";
|
||||
in
|
||||
|
||||
@@ -1,43 +1,41 @@
|
||||
{ inputs, ... }:
|
||||
[
|
||||
(
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
(import ../common.nix { inherit inputs; })
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
"xhci_pci"
|
||||
"nvme"
|
||||
"usb_storage"
|
||||
"sd_mod"
|
||||
"sdhci_pci"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
boot.kernelParams = [
|
||||
"quiet"
|
||||
"splash"
|
||||
"boot.shell_on_fail"
|
||||
"udev.log_priority=3"
|
||||
"rd.systemd.show_status=auto"
|
||||
];
|
||||
boot.initrd.availableKernelModules = [
|
||||
"xhci_pci"
|
||||
"nvme"
|
||||
"usb_storage"
|
||||
"sd_mod"
|
||||
"sdhci_pci"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
boot.kernelParams = [
|
||||
"quiet"
|
||||
"splash"
|
||||
"boot.shell_on_fail"
|
||||
"udev.log_priority=3"
|
||||
"rd.systemd.show_status=auto"
|
||||
];
|
||||
|
||||
ugaif.host.filesystem.swapSize = lib.mkDefault "16G";
|
||||
ugaif.host.filesystem.device = lib.mkDefault "/dev/nvme0n1";
|
||||
ugaif.host.buildMethods = lib.mkDefault [ "installer-iso" ];
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
ugaif.host.filesystem.swapSize = lib.mkDefault "16G";
|
||||
ugaif.host.filesystem.device = lib.mkDefault "/dev/nvme0n1";
|
||||
ugaif.host.buildMethods = lib.mkDefault [ "installer-iso" ];
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
)
|
||||
{
|
||||
ugaif.sw.enable = true;
|
||||
ugaif.sw.type = "desktop";
|
||||
}
|
||||
]
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
|
||||
ugaif.sw.enable = true;
|
||||
ugaif.sw.type = lib.mkDefault "desktop";
|
||||
}
|
||||
|
||||
@@ -1,63 +1,61 @@
|
||||
{ inputs, ... }:
|
||||
[
|
||||
(
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
{
|
||||
# This host type is for ephemeral, diskless systems (e.g. kiosks, netboot clients).
|
||||
# It runs entirely from RAM and does not persist state across reboots.
|
||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
{
|
||||
# This host type is for ephemeral, diskless systems (e.g. kiosks, netboot clients).
|
||||
# It runs entirely from RAM and does not persist state across reboots.
|
||||
imports = [
|
||||
(import ../common.nix { inherit inputs; })
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
"xhci_pci"
|
||||
"nvme"
|
||||
"usb_storage"
|
||||
"sd_mod"
|
||||
"sdhci_pci"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
boot.kernelParams = [
|
||||
"quiet"
|
||||
"splash"
|
||||
"boot.shell_on_fail"
|
||||
"udev.log_priority=3"
|
||||
"rd.systemd.show_status=auto"
|
||||
];
|
||||
boot.initrd.availableKernelModules = [
|
||||
"xhci_pci"
|
||||
"nvme"
|
||||
"usb_storage"
|
||||
"sd_mod"
|
||||
"sdhci_pci"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
boot.kernelParams = [
|
||||
"quiet"
|
||||
"splash"
|
||||
"boot.shell_on_fail"
|
||||
"udev.log_priority=3"
|
||||
"rd.systemd.show_status=auto"
|
||||
];
|
||||
|
||||
# Ephemeral setup: No swap, no disk
|
||||
ugaif.host.filesystem.swapSize = lib.mkForce "0G";
|
||||
ugaif.host.filesystem.device = lib.mkForce "/dev/null"; # Dummy device
|
||||
ugaif.host.buildMethods = lib.mkDefault [
|
||||
"iso"
|
||||
"ipxe"
|
||||
];
|
||||
# Ephemeral setup: No swap, no disk
|
||||
ugaif.host.filesystem.swapSize = lib.mkForce "0G";
|
||||
ugaif.host.filesystem.device = lib.mkForce "/dev/null"; # Dummy device
|
||||
ugaif.host.buildMethods = lib.mkDefault [
|
||||
"iso"
|
||||
"ipxe"
|
||||
];
|
||||
|
||||
# Disable Disko config since we are running from RAM/ISO
|
||||
disko.enableConfig = lib.mkForce false;
|
||||
# Disable Disko config since we are running from RAM/ISO
|
||||
disko.enableConfig = lib.mkForce false;
|
||||
|
||||
# Define a dummy root filesystem to satisfy assertions
|
||||
fileSystems."/" = {
|
||||
device = "none";
|
||||
fsType = "tmpfs";
|
||||
options = [
|
||||
"defaults"
|
||||
"size=50%"
|
||||
"mode=755"
|
||||
];
|
||||
};
|
||||
# Define a dummy root filesystem to satisfy assertions
|
||||
fileSystems."/" = {
|
||||
device = "none";
|
||||
fsType = "tmpfs";
|
||||
options = [
|
||||
"defaults"
|
||||
"size=50%"
|
||||
"mode=755"
|
||||
];
|
||||
};
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
)
|
||||
{
|
||||
ugaif.sw.enable = true;
|
||||
ugaif.sw.type = "stateless-kiosk";
|
||||
}
|
||||
]
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
|
||||
ugaif.sw.enable = true;
|
||||
ugaif.sw.type = lib.mkDefault "stateless-kiosk";
|
||||
}
|
||||
|
||||
@@ -1,57 +1,55 @@
|
||||
{ inputs, ... }:
|
||||
[
|
||||
(
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
(import ../common.nix { inherit inputs; })
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
"xhci_pci"
|
||||
"thunderbolt"
|
||||
"nvme"
|
||||
"usb_storage"
|
||||
"sd_mod"
|
||||
"sdhci_pci"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
boot.kernelParams = [
|
||||
"quiet"
|
||||
"splash"
|
||||
"boot.shell_on_fail"
|
||||
"udev.log_priority=3"
|
||||
"rd.systemd.show_status=auto"
|
||||
"i915.enable_psr=0"
|
||||
"i915.enable_dc=0"
|
||||
"i915.enable_fbc=0"
|
||||
];
|
||||
boot.initrd.availableKernelModules = [
|
||||
"xhci_pci"
|
||||
"thunderbolt"
|
||||
"nvme"
|
||||
"usb_storage"
|
||||
"sd_mod"
|
||||
"sdhci_pci"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
boot.kernelParams = [
|
||||
"quiet"
|
||||
"splash"
|
||||
"boot.shell_on_fail"
|
||||
"udev.log_priority=3"
|
||||
"rd.systemd.show_status=auto"
|
||||
"i915.enable_psr=0"
|
||||
"i915.enable_dc=0"
|
||||
"i915.enable_fbc=0"
|
||||
];
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
|
||||
ugaif.host.filesystem.device = lib.mkDefault "/dev/nvme0n1";
|
||||
ugaif.host.filesystem.swapSize = lib.mkDefault "34G";
|
||||
ugaif.host.buildMethods = lib.mkDefault [ "installer-iso" ];
|
||||
ugaif.host.filesystem.device = lib.mkDefault "/dev/nvme0n1";
|
||||
ugaif.host.filesystem.swapSize = lib.mkDefault "34G";
|
||||
ugaif.host.buildMethods = lib.mkDefault [ "installer-iso" ];
|
||||
|
||||
# Suspend / logind behavior
|
||||
services.upower.enable = lib.mkDefault true;
|
||||
services.logind.settings = {
|
||||
Login = {
|
||||
HandleLidSwitch = "suspend";
|
||||
HandleLidSwitchExternalPower = "suspend";
|
||||
HandleLidSwitchDocked = "ignore";
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
{
|
||||
ugaif.sw.enable = true;
|
||||
ugaif.sw.type = "desktop";
|
||||
}
|
||||
]
|
||||
# Suspend / logind behavior
|
||||
services.upower.enable = lib.mkDefault true;
|
||||
services.logind.settings = {
|
||||
Login = {
|
||||
HandleLidSwitch = "suspend";
|
||||
HandleLidSwitchExternalPower = "suspend";
|
||||
HandleLidSwitchDocked = "ignore";
|
||||
};
|
||||
};
|
||||
|
||||
ugaif.sw.enable = true;
|
||||
ugaif.sw.type = lib.mkDefault "desktop";
|
||||
}
|
||||
|
||||
@@ -1,48 +1,46 @@
|
||||
{ inputs, ... }:
|
||||
[
|
||||
inputs.vscode-server.nixosModules.default
|
||||
(
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
{
|
||||
nix.settings.trusted-users = [
|
||||
"root"
|
||||
"engr-ugaif"
|
||||
];
|
||||
nix.settings.experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
imports = [
|
||||
"${modulesPath}/virtualisation/proxmox-lxc.nix"
|
||||
];
|
||||
boot.isContainer = true;
|
||||
boot.loader.systemd-boot.enable = lib.mkForce false;
|
||||
disko.enableConfig = lib.mkForce false;
|
||||
console.enable = true;
|
||||
systemd.services."getty@".unitConfig.ConditionPathExists = [
|
||||
""
|
||||
"/dev/%I"
|
||||
];
|
||||
systemd.suppressedSystemUnits = [
|
||||
"dev-mqueue.mount"
|
||||
"sys-kernel-debug.mount"
|
||||
"sys-fs-fuse-connections.mount"
|
||||
];
|
||||
services.vscode-server.enable = true;
|
||||
system.stateVersion = "25.11";
|
||||
ugaif.host.buildMethods = lib.mkDefault [
|
||||
"lxc"
|
||||
"proxmox"
|
||||
];
|
||||
}
|
||||
)
|
||||
{
|
||||
ugaif.sw.enable = true;
|
||||
ugaif.sw.type = "headless";
|
||||
}
|
||||
]
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
(import ../common.nix { inherit inputs; })
|
||||
inputs.vscode-server.nixosModules.default
|
||||
"${modulesPath}/virtualisation/proxmox-lxc.nix"
|
||||
];
|
||||
|
||||
nix.settings.trusted-users = [
|
||||
"root"
|
||||
"engr-ugaif"
|
||||
];
|
||||
nix.settings.experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
|
||||
boot.isContainer = true;
|
||||
boot.loader.systemd-boot.enable = lib.mkForce false;
|
||||
disko.enableConfig = lib.mkForce false;
|
||||
console.enable = true;
|
||||
systemd.services."getty@".unitConfig.ConditionPathExists = [
|
||||
""
|
||||
"/dev/%I"
|
||||
];
|
||||
systemd.suppressedSystemUnits = [
|
||||
"dev-mqueue.mount"
|
||||
"sys-kernel-debug.mount"
|
||||
"sys-fs-fuse-connections.mount"
|
||||
];
|
||||
services.vscode-server.enable = true;
|
||||
system.stateVersion = "25.11";
|
||||
ugaif.host.buildMethods = lib.mkDefault [
|
||||
"lxc"
|
||||
"proxmox"
|
||||
];
|
||||
|
||||
ugaif.sw.enable = true;
|
||||
ugaif.sw.type = lib.mkDefault "headless";
|
||||
}
|
||||
|
||||
@@ -1,59 +1,57 @@
|
||||
{ inputs, ... }:
|
||||
[
|
||||
(
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
let
|
||||
refSystem = inputs.nixpkgs-old-kernel.lib.nixosSystem {
|
||||
system = pkgs.stdenv.hostPlatform.system;
|
||||
modules = [ inputs.nixos-hardware.nixosModules.microsoft-surface-go ];
|
||||
};
|
||||
refKernelPackages = refSystem.config.boot.kernelPackages;
|
||||
in
|
||||
{
|
||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
let
|
||||
refSystem = inputs.nixpkgs-old-kernel.lib.nixosSystem {
|
||||
system = pkgs.stdenv.hostPlatform.system;
|
||||
modules = [ inputs.nixos-hardware.nixosModules.microsoft-surface-go ];
|
||||
};
|
||||
refKernelPackages = refSystem.config.boot.kernelPackages;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
(import ../common.nix { inherit inputs; })
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
inputs.nixos-hardware.nixosModules.microsoft-surface-go
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
"xhci_pci"
|
||||
"nvme"
|
||||
"usb_storage"
|
||||
"sd_mod"
|
||||
"sdhci_pci"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
boot.kernelParams = [
|
||||
"quiet"
|
||||
"splash"
|
||||
"boot.shell_on_fail"
|
||||
"udev.log_priority=3"
|
||||
"rd.systemd.show_status=auto"
|
||||
"intel_ipu3_imgu"
|
||||
"intel_ipu3_isys"
|
||||
"fbcon=map:1"
|
||||
"i915.enable_psr=0" # Panel Self Refresh breaks resume on Surface
|
||||
"i915.enable_dc=0"
|
||||
];
|
||||
boot.initrd.availableKernelModules = [
|
||||
"xhci_pci"
|
||||
"nvme"
|
||||
"usb_storage"
|
||||
"sd_mod"
|
||||
"sdhci_pci"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
boot.kernelParams = [
|
||||
"quiet"
|
||||
"splash"
|
||||
"boot.shell_on_fail"
|
||||
"udev.log_priority=3"
|
||||
"rd.systemd.show_status=auto"
|
||||
"intel_ipu3_imgu"
|
||||
"intel_ipu3_isys"
|
||||
"fbcon=map:1"
|
||||
"i915.enable_psr=0" # Panel Self Refresh breaks resume on Surface
|
||||
"i915.enable_dc=0"
|
||||
];
|
||||
|
||||
boot.kernelPackages = lib.mkForce refKernelPackages;
|
||||
boot.kernelPackages = lib.mkForce refKernelPackages;
|
||||
|
||||
ugaif.host.filesystem.swapSize = lib.mkDefault "8G";
|
||||
ugaif.host.filesystem.device = lib.mkDefault "/dev/mmcblk0";
|
||||
ugaif.host.buildMethods = lib.mkDefault [ "installer-iso" ];
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
ugaif.host.filesystem.swapSize = lib.mkDefault "8G";
|
||||
ugaif.host.filesystem.device = lib.mkDefault "/dev/mmcblk0";
|
||||
ugaif.host.buildMethods = lib.mkDefault [ "installer-iso" ];
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
)
|
||||
inputs.nixos-hardware.nixosModules.microsoft-surface-go
|
||||
{
|
||||
ugaif.sw.enable = true;
|
||||
ugaif.sw.type = "tablet-kiosk";
|
||||
}
|
||||
]
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
|
||||
ugaif.sw.enable = true;
|
||||
ugaif.sw.type = lib.mkDefault "tablet-kiosk";
|
||||
}
|
||||
|
||||
@@ -1,39 +1,43 @@
|
||||
{ inputs, ... }:
|
||||
[
|
||||
inputs.nixos-wsl.nixosModules.default
|
||||
inputs.vscode-server.nixosModules.default
|
||||
(
|
||||
{ lib, config, ... }:
|
||||
{
|
||||
options.ugaif.host.wsl.user = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "engr-ugaif";
|
||||
description = "The default user to log in as in WSL.";
|
||||
};
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
(import ../common.nix { inherit inputs; })
|
||||
inputs.nixos-wsl.nixosModules.default
|
||||
inputs.vscode-server.nixosModules.default
|
||||
];
|
||||
|
||||
config = {
|
||||
wsl.enable = true;
|
||||
wsl.defaultUser = config.ugaif.host.wsl.user;
|
||||
options.ugaif.host.wsl.user = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "engr-ugaif";
|
||||
description = "The default user to log in as in WSL.";
|
||||
};
|
||||
|
||||
# Enable the headless software profile
|
||||
ugaif.sw.enable = true;
|
||||
ugaif.sw.type = "headless";
|
||||
config = {
|
||||
wsl.enable = true;
|
||||
wsl.defaultUser = config.ugaif.host.wsl.user;
|
||||
|
||||
# Fix for VS Code Server in WSL if needed, though vscode-server input exists
|
||||
services.vscode-server.enable = true;
|
||||
# Enable the headless software profile
|
||||
ugaif.sw.enable = true;
|
||||
ugaif.sw.type = lib.mkDefault "headless";
|
||||
|
||||
# Disable Disko and Bootloader for WSL
|
||||
disko.enableConfig = lib.mkForce false;
|
||||
boot.loader.systemd-boot.enable = lib.mkForce false;
|
||||
boot.loader.grub.enable = lib.mkForce false;
|
||||
# Fix for VS Code Server in WSL if needed, though vscode-server input exists
|
||||
services.vscode-server.enable = true;
|
||||
|
||||
# Disable networking for wsl (it manages its own networking)
|
||||
systemd.network.enable = lib.mkForce false;
|
||||
# Disable Disko and Bootloader for WSL
|
||||
disko.enableConfig = lib.mkForce false;
|
||||
boot.loader.systemd-boot.enable = lib.mkForce false;
|
||||
boot.loader.grub.enable = lib.mkForce false;
|
||||
|
||||
# Provide dummy values for required options from boot.nix
|
||||
ugaif.host.filesystem.device = "/dev/null";
|
||||
ugaif.host.filesystem.swapSize = "0G";
|
||||
};
|
||||
}
|
||||
)
|
||||
]
|
||||
# Disable networking for wsl (it manages its own networking)
|
||||
systemd.network.enable = lib.mkForce false;
|
||||
|
||||
# Provide dummy values for required options from boot.nix
|
||||
ugaif.host.filesystem.device = "/dev/null";
|
||||
ugaif.host.filesystem.swapSize = "0G";
|
||||
};
|
||||
}
|
||||
|
||||
20
installer/modules.nix
Normal file
20
installer/modules.nix
Normal file
@@ -0,0 +1,20 @@
|
||||
# ============================================================================
|
||||
# Host Type Modules Export
|
||||
# ============================================================================
|
||||
# This file exposes each host type as a reusable NixOS module that can be
|
||||
# imported by external flakes or configurations.
|
||||
#
|
||||
# Usage in another flake:
|
||||
# inputs.nixos-systems.nixosModules.nix-desktop
|
||||
# inputs.nixos-systems.nixosModules.nix-laptop
|
||||
# etc.
|
||||
|
||||
{ inputs }:
|
||||
{
|
||||
nix-desktop = import ../hosts/types/nix-desktop.nix { inherit inputs; };
|
||||
nix-laptop = import ../hosts/types/nix-laptop.nix { inherit inputs; };
|
||||
nix-surface = import ../hosts/types/nix-surface.nix { inherit inputs; };
|
||||
nix-lxc = import ../hosts/types/nix-lxc.nix { inherit inputs; };
|
||||
nix-wsl = import ../hosts/types/nix-wsl.nix { inherit inputs; };
|
||||
nix-ephemeral = import ../hosts/types/nix-ephemeral.nix { inherit inputs; };
|
||||
}
|
||||
Reference in New Issue
Block a user