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
|
# Expose artifacts to all systems, but they are always built for x86_64-linux
|
||||||
packages = forAllSystems (_: artifacts);
|
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.
|
# the target device and swap size.
|
||||||
|
|
||||||
{
|
{
|
||||||
options.ugaif.host = {
|
options.ugaif = {
|
||||||
filesystem = {
|
host = {
|
||||||
device = lib.mkOption {
|
filesystem = {
|
||||||
type = lib.types.str;
|
device = lib.mkOption {
|
||||||
description = "The main disk device to use for installation.";
|
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 {
|
buildMethods = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.listOf lib.types.str;
|
||||||
description = "The size of the swap partition.";
|
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;
|
system.gc = {
|
||||||
default = [ "installer-iso" ];
|
enable = lib.mkOption {
|
||||||
description = ''
|
type = lib.types.bool;
|
||||||
List of allowed build methods for this host.
|
default = true;
|
||||||
Supported methods:
|
description = "Whether to enable automatic garbage collection.";
|
||||||
- "installer-iso": Generates an auto-install ISO that installs this configuration to disk.
|
};
|
||||||
- "iso": Generates a live ISO (using nixos-generators).
|
frequency = lib.mkOption {
|
||||||
- "ipxe": Generates iPXE netboot artifacts (kernel, initrd, script).
|
type = lib.types.str;
|
||||||
- "lxc": Generates an LXC container tarball.
|
default = "weekly";
|
||||||
- "proxmox": Generates a Proxmox VMA archive.
|
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 = {
|
config = {
|
||||||
# Enable Disko for declarative partitioning
|
# Enable Disko for declarative partitioning
|
||||||
disko.enableConfig = true;
|
disko.enableConfig = lib.mkDefault true;
|
||||||
|
|
||||||
disko.devices = {
|
disko.devices = {
|
||||||
disk.main = {
|
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
|
let
|
||||||
nixpkgs = inputs.nixpkgs;
|
nixpkgs = inputs.nixpkgs;
|
||||||
lib = nixpkgs.lib;
|
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
|
# Helper to create a single NixOS system configuration
|
||||||
mkHost =
|
mkHost =
|
||||||
{
|
{
|
||||||
@@ -72,8 +40,7 @@ let
|
|||||||
) accounts;
|
) accounts;
|
||||||
|
|
||||||
allModules =
|
allModules =
|
||||||
commonModules
|
userFlakeModules
|
||||||
++ userFlakeModules
|
|
||||||
++ extraModules
|
++ extraModules
|
||||||
++ [
|
++ [
|
||||||
{ networking.hostName = hostName; }
|
{ networking.hostName = hostName; }
|
||||||
@@ -164,7 +131,7 @@ let
|
|||||||
typeFile = ./types + "/${type}.nix";
|
typeFile = ./types + "/${type}.nix";
|
||||||
modules =
|
modules =
|
||||||
if builtins.pathExists typeFile then
|
if builtins.pathExists typeFile then
|
||||||
import typeFile { inherit inputs; }
|
[ (import typeFile { inherit inputs; }) ]
|
||||||
else
|
else
|
||||||
throw "Host type '${type}' not found in hosts/types/";
|
throw "Host type '${type}' not found in hosts/types/";
|
||||||
in
|
in
|
||||||
|
|||||||
@@ -1,43 +1,41 @@
|
|||||||
{ inputs, ... }:
|
{ inputs, ... }:
|
||||||
[
|
{
|
||||||
(
|
config,
|
||||||
{
|
lib,
|
||||||
config,
|
modulesPath,
|
||||||
lib,
|
...
|
||||||
modulesPath,
|
}:
|
||||||
...
|
{
|
||||||
}:
|
imports = [
|
||||||
{
|
(import ../common.nix { inherit inputs; })
|
||||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [
|
boot.initrd.availableKernelModules = [
|
||||||
"xhci_pci"
|
"xhci_pci"
|
||||||
"nvme"
|
"nvme"
|
||||||
"usb_storage"
|
"usb_storage"
|
||||||
"sd_mod"
|
"sd_mod"
|
||||||
"sdhci_pci"
|
"sdhci_pci"
|
||||||
];
|
];
|
||||||
boot.initrd.kernelModules = [ ];
|
boot.initrd.kernelModules = [ ];
|
||||||
boot.kernelModules = [ "kvm-intel" ];
|
boot.kernelModules = [ "kvm-intel" ];
|
||||||
boot.extraModulePackages = [ ];
|
boot.extraModulePackages = [ ];
|
||||||
boot.kernelParams = [
|
boot.kernelParams = [
|
||||||
"quiet"
|
"quiet"
|
||||||
"splash"
|
"splash"
|
||||||
"boot.shell_on_fail"
|
"boot.shell_on_fail"
|
||||||
"udev.log_priority=3"
|
"udev.log_priority=3"
|
||||||
"rd.systemd.show_status=auto"
|
"rd.systemd.show_status=auto"
|
||||||
];
|
];
|
||||||
|
|
||||||
ugaif.host.filesystem.swapSize = lib.mkDefault "16G";
|
ugaif.host.filesystem.swapSize = lib.mkDefault "16G";
|
||||||
ugaif.host.filesystem.device = lib.mkDefault "/dev/nvme0n1";
|
ugaif.host.filesystem.device = lib.mkDefault "/dev/nvme0n1";
|
||||||
ugaif.host.buildMethods = lib.mkDefault [ "installer-iso" ];
|
ugaif.host.buildMethods = lib.mkDefault [ "installer-iso" ];
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
|
|
||||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
}
|
|
||||||
)
|
ugaif.sw.enable = true;
|
||||||
{
|
ugaif.sw.type = lib.mkDefault "desktop";
|
||||||
ugaif.sw.enable = true;
|
}
|
||||||
ugaif.sw.type = "desktop";
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|||||||
@@ -1,63 +1,61 @@
|
|||||||
{ inputs, ... }:
|
{ inputs, ... }:
|
||||||
[
|
{
|
||||||
(
|
config,
|
||||||
{
|
lib,
|
||||||
config,
|
modulesPath,
|
||||||
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.
|
||||||
# This host type is for ephemeral, diskless systems (e.g. kiosks, netboot clients).
|
imports = [
|
||||||
# It runs entirely from RAM and does not persist state across reboots.
|
(import ../common.nix { inherit inputs; })
|
||||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [
|
boot.initrd.availableKernelModules = [
|
||||||
"xhci_pci"
|
"xhci_pci"
|
||||||
"nvme"
|
"nvme"
|
||||||
"usb_storage"
|
"usb_storage"
|
||||||
"sd_mod"
|
"sd_mod"
|
||||||
"sdhci_pci"
|
"sdhci_pci"
|
||||||
];
|
];
|
||||||
boot.initrd.kernelModules = [ ];
|
boot.initrd.kernelModules = [ ];
|
||||||
boot.kernelModules = [ "kvm-intel" ];
|
boot.kernelModules = [ "kvm-intel" ];
|
||||||
boot.extraModulePackages = [ ];
|
boot.extraModulePackages = [ ];
|
||||||
boot.kernelParams = [
|
boot.kernelParams = [
|
||||||
"quiet"
|
"quiet"
|
||||||
"splash"
|
"splash"
|
||||||
"boot.shell_on_fail"
|
"boot.shell_on_fail"
|
||||||
"udev.log_priority=3"
|
"udev.log_priority=3"
|
||||||
"rd.systemd.show_status=auto"
|
"rd.systemd.show_status=auto"
|
||||||
];
|
];
|
||||||
|
|
||||||
# Ephemeral setup: No swap, no disk
|
# Ephemeral setup: No swap, no disk
|
||||||
ugaif.host.filesystem.swapSize = lib.mkForce "0G";
|
ugaif.host.filesystem.swapSize = lib.mkForce "0G";
|
||||||
ugaif.host.filesystem.device = lib.mkForce "/dev/null"; # Dummy device
|
ugaif.host.filesystem.device = lib.mkForce "/dev/null"; # Dummy device
|
||||||
ugaif.host.buildMethods = lib.mkDefault [
|
ugaif.host.buildMethods = lib.mkDefault [
|
||||||
"iso"
|
"iso"
|
||||||
"ipxe"
|
"ipxe"
|
||||||
];
|
];
|
||||||
|
|
||||||
# Disable Disko config since we are running from RAM/ISO
|
# Disable Disko config since we are running from RAM/ISO
|
||||||
disko.enableConfig = lib.mkForce false;
|
disko.enableConfig = lib.mkForce false;
|
||||||
|
|
||||||
# Define a dummy root filesystem to satisfy assertions
|
# Define a dummy root filesystem to satisfy assertions
|
||||||
fileSystems."/" = {
|
fileSystems."/" = {
|
||||||
device = "none";
|
device = "none";
|
||||||
fsType = "tmpfs";
|
fsType = "tmpfs";
|
||||||
options = [
|
options = [
|
||||||
"defaults"
|
"defaults"
|
||||||
"size=50%"
|
"size=50%"
|
||||||
"mode=755"
|
"mode=755"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
}
|
|
||||||
)
|
ugaif.sw.enable = true;
|
||||||
{
|
ugaif.sw.type = lib.mkDefault "stateless-kiosk";
|
||||||
ugaif.sw.enable = true;
|
}
|
||||||
ugaif.sw.type = "stateless-kiosk";
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|||||||
@@ -1,57 +1,55 @@
|
|||||||
{ inputs, ... }:
|
{ inputs, ... }:
|
||||||
[
|
{
|
||||||
(
|
config,
|
||||||
{
|
lib,
|
||||||
config,
|
modulesPath,
|
||||||
lib,
|
...
|
||||||
modulesPath,
|
}:
|
||||||
...
|
{
|
||||||
}:
|
imports = [
|
||||||
{
|
(import ../common.nix { inherit inputs; })
|
||||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [
|
boot.initrd.availableKernelModules = [
|
||||||
"xhci_pci"
|
"xhci_pci"
|
||||||
"thunderbolt"
|
"thunderbolt"
|
||||||
"nvme"
|
"nvme"
|
||||||
"usb_storage"
|
"usb_storage"
|
||||||
"sd_mod"
|
"sd_mod"
|
||||||
"sdhci_pci"
|
"sdhci_pci"
|
||||||
];
|
];
|
||||||
boot.initrd.kernelModules = [ ];
|
boot.initrd.kernelModules = [ ];
|
||||||
boot.kernelModules = [ "kvm-intel" ];
|
boot.kernelModules = [ "kvm-intel" ];
|
||||||
boot.extraModulePackages = [ ];
|
boot.extraModulePackages = [ ];
|
||||||
boot.kernelParams = [
|
boot.kernelParams = [
|
||||||
"quiet"
|
"quiet"
|
||||||
"splash"
|
"splash"
|
||||||
"boot.shell_on_fail"
|
"boot.shell_on_fail"
|
||||||
"udev.log_priority=3"
|
"udev.log_priority=3"
|
||||||
"rd.systemd.show_status=auto"
|
"rd.systemd.show_status=auto"
|
||||||
"i915.enable_psr=0"
|
"i915.enable_psr=0"
|
||||||
"i915.enable_dc=0"
|
"i915.enable_dc=0"
|
||||||
"i915.enable_fbc=0"
|
"i915.enable_fbc=0"
|
||||||
];
|
];
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
|
|
||||||
ugaif.host.filesystem.device = lib.mkDefault "/dev/nvme0n1";
|
ugaif.host.filesystem.device = lib.mkDefault "/dev/nvme0n1";
|
||||||
ugaif.host.filesystem.swapSize = lib.mkDefault "34G";
|
ugaif.host.filesystem.swapSize = lib.mkDefault "34G";
|
||||||
ugaif.host.buildMethods = lib.mkDefault [ "installer-iso" ];
|
ugaif.host.buildMethods = lib.mkDefault [ "installer-iso" ];
|
||||||
|
|
||||||
# Suspend / logind behavior
|
# Suspend / logind behavior
|
||||||
services.upower.enable = lib.mkDefault true;
|
services.upower.enable = lib.mkDefault true;
|
||||||
services.logind.settings = {
|
services.logind.settings = {
|
||||||
Login = {
|
Login = {
|
||||||
HandleLidSwitch = "suspend";
|
HandleLidSwitch = "suspend";
|
||||||
HandleLidSwitchExternalPower = "suspend";
|
HandleLidSwitchExternalPower = "suspend";
|
||||||
HandleLidSwitchDocked = "ignore";
|
HandleLidSwitchDocked = "ignore";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
|
||||||
)
|
ugaif.sw.enable = true;
|
||||||
{
|
ugaif.sw.type = lib.mkDefault "desktop";
|
||||||
ugaif.sw.enable = true;
|
}
|
||||||
ugaif.sw.type = "desktop";
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|||||||
@@ -1,48 +1,46 @@
|
|||||||
{ inputs, ... }:
|
{ inputs, ... }:
|
||||||
[
|
{
|
||||||
inputs.vscode-server.nixosModules.default
|
config,
|
||||||
(
|
lib,
|
||||||
{
|
modulesPath,
|
||||||
config,
|
...
|
||||||
lib,
|
}:
|
||||||
modulesPath,
|
{
|
||||||
...
|
imports = [
|
||||||
}:
|
(import ../common.nix { inherit inputs; })
|
||||||
{
|
inputs.vscode-server.nixosModules.default
|
||||||
nix.settings.trusted-users = [
|
"${modulesPath}/virtualisation/proxmox-lxc.nix"
|
||||||
"root"
|
];
|
||||||
"engr-ugaif"
|
|
||||||
];
|
nix.settings.trusted-users = [
|
||||||
nix.settings.experimental-features = [
|
"root"
|
||||||
"nix-command"
|
"engr-ugaif"
|
||||||
"flakes"
|
];
|
||||||
];
|
nix.settings.experimental-features = [
|
||||||
imports = [
|
"nix-command"
|
||||||
"${modulesPath}/virtualisation/proxmox-lxc.nix"
|
"flakes"
|
||||||
];
|
];
|
||||||
boot.isContainer = true;
|
|
||||||
boot.loader.systemd-boot.enable = lib.mkForce false;
|
boot.isContainer = true;
|
||||||
disko.enableConfig = lib.mkForce false;
|
boot.loader.systemd-boot.enable = lib.mkForce false;
|
||||||
console.enable = true;
|
disko.enableConfig = lib.mkForce false;
|
||||||
systemd.services."getty@".unitConfig.ConditionPathExists = [
|
console.enable = true;
|
||||||
""
|
systemd.services."getty@".unitConfig.ConditionPathExists = [
|
||||||
"/dev/%I"
|
""
|
||||||
];
|
"/dev/%I"
|
||||||
systemd.suppressedSystemUnits = [
|
];
|
||||||
"dev-mqueue.mount"
|
systemd.suppressedSystemUnits = [
|
||||||
"sys-kernel-debug.mount"
|
"dev-mqueue.mount"
|
||||||
"sys-fs-fuse-connections.mount"
|
"sys-kernel-debug.mount"
|
||||||
];
|
"sys-fs-fuse-connections.mount"
|
||||||
services.vscode-server.enable = true;
|
];
|
||||||
system.stateVersion = "25.11";
|
services.vscode-server.enable = true;
|
||||||
ugaif.host.buildMethods = lib.mkDefault [
|
system.stateVersion = "25.11";
|
||||||
"lxc"
|
ugaif.host.buildMethods = lib.mkDefault [
|
||||||
"proxmox"
|
"lxc"
|
||||||
];
|
"proxmox"
|
||||||
}
|
];
|
||||||
)
|
|
||||||
{
|
ugaif.sw.enable = true;
|
||||||
ugaif.sw.enable = true;
|
ugaif.sw.type = lib.mkDefault "headless";
|
||||||
ugaif.sw.type = "headless";
|
}
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|||||||
@@ -1,59 +1,57 @@
|
|||||||
{ inputs, ... }:
|
{ inputs, ... }:
|
||||||
[
|
{
|
||||||
(
|
config,
|
||||||
{
|
lib,
|
||||||
config,
|
pkgs,
|
||||||
lib,
|
modulesPath,
|
||||||
pkgs,
|
...
|
||||||
modulesPath,
|
}:
|
||||||
...
|
let
|
||||||
}:
|
refSystem = inputs.nixpkgs-old-kernel.lib.nixosSystem {
|
||||||
let
|
system = pkgs.stdenv.hostPlatform.system;
|
||||||
refSystem = inputs.nixpkgs-old-kernel.lib.nixosSystem {
|
modules = [ inputs.nixos-hardware.nixosModules.microsoft-surface-go ];
|
||||||
system = pkgs.stdenv.hostPlatform.system;
|
};
|
||||||
modules = [ inputs.nixos-hardware.nixosModules.microsoft-surface-go ];
|
refKernelPackages = refSystem.config.boot.kernelPackages;
|
||||||
};
|
in
|
||||||
refKernelPackages = refSystem.config.boot.kernelPackages;
|
{
|
||||||
in
|
imports = [
|
||||||
{
|
(import ../common.nix { inherit inputs; })
|
||||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
|
inputs.nixos-hardware.nixosModules.microsoft-surface-go
|
||||||
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [
|
boot.initrd.availableKernelModules = [
|
||||||
"xhci_pci"
|
"xhci_pci"
|
||||||
"nvme"
|
"nvme"
|
||||||
"usb_storage"
|
"usb_storage"
|
||||||
"sd_mod"
|
"sd_mod"
|
||||||
"sdhci_pci"
|
"sdhci_pci"
|
||||||
];
|
];
|
||||||
boot.initrd.kernelModules = [ ];
|
boot.initrd.kernelModules = [ ];
|
||||||
boot.kernelModules = [ "kvm-intel" ];
|
boot.kernelModules = [ "kvm-intel" ];
|
||||||
boot.extraModulePackages = [ ];
|
boot.extraModulePackages = [ ];
|
||||||
boot.kernelParams = [
|
boot.kernelParams = [
|
||||||
"quiet"
|
"quiet"
|
||||||
"splash"
|
"splash"
|
||||||
"boot.shell_on_fail"
|
"boot.shell_on_fail"
|
||||||
"udev.log_priority=3"
|
"udev.log_priority=3"
|
||||||
"rd.systemd.show_status=auto"
|
"rd.systemd.show_status=auto"
|
||||||
"intel_ipu3_imgu"
|
"intel_ipu3_imgu"
|
||||||
"intel_ipu3_isys"
|
"intel_ipu3_isys"
|
||||||
"fbcon=map:1"
|
"fbcon=map:1"
|
||||||
"i915.enable_psr=0" # Panel Self Refresh breaks resume on Surface
|
"i915.enable_psr=0" # Panel Self Refresh breaks resume on Surface
|
||||||
"i915.enable_dc=0"
|
"i915.enable_dc=0"
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.kernelPackages = lib.mkForce refKernelPackages;
|
boot.kernelPackages = lib.mkForce refKernelPackages;
|
||||||
|
|
||||||
ugaif.host.filesystem.swapSize = lib.mkDefault "8G";
|
ugaif.host.filesystem.swapSize = lib.mkDefault "8G";
|
||||||
ugaif.host.filesystem.device = lib.mkDefault "/dev/mmcblk0";
|
ugaif.host.filesystem.device = lib.mkDefault "/dev/mmcblk0";
|
||||||
ugaif.host.buildMethods = lib.mkDefault [ "installer-iso" ];
|
ugaif.host.buildMethods = lib.mkDefault [ "installer-iso" ];
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
|
|
||||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
}
|
|
||||||
)
|
ugaif.sw.enable = true;
|
||||||
inputs.nixos-hardware.nixosModules.microsoft-surface-go
|
ugaif.sw.type = lib.mkDefault "tablet-kiosk";
|
||||||
{
|
}
|
||||||
ugaif.sw.enable = true;
|
|
||||||
ugaif.sw.type = "tablet-kiosk";
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|||||||
@@ -1,39 +1,43 @@
|
|||||||
{ inputs, ... }:
|
{ inputs, ... }:
|
||||||
[
|
{
|
||||||
inputs.nixos-wsl.nixosModules.default
|
lib,
|
||||||
inputs.vscode-server.nixosModules.default
|
config,
|
||||||
(
|
...
|
||||||
{ lib, config, ... }:
|
}:
|
||||||
{
|
{
|
||||||
options.ugaif.host.wsl.user = lib.mkOption {
|
imports = [
|
||||||
type = lib.types.str;
|
(import ../common.nix { inherit inputs; })
|
||||||
default = "engr-ugaif";
|
inputs.nixos-wsl.nixosModules.default
|
||||||
description = "The default user to log in as in WSL.";
|
inputs.vscode-server.nixosModules.default
|
||||||
};
|
];
|
||||||
|
|
||||||
config = {
|
options.ugaif.host.wsl.user = lib.mkOption {
|
||||||
wsl.enable = true;
|
type = lib.types.str;
|
||||||
wsl.defaultUser = config.ugaif.host.wsl.user;
|
default = "engr-ugaif";
|
||||||
|
description = "The default user to log in as in WSL.";
|
||||||
|
};
|
||||||
|
|
||||||
# Enable the headless software profile
|
config = {
|
||||||
ugaif.sw.enable = true;
|
wsl.enable = true;
|
||||||
ugaif.sw.type = "headless";
|
wsl.defaultUser = config.ugaif.host.wsl.user;
|
||||||
|
|
||||||
# Fix for VS Code Server in WSL if needed, though vscode-server input exists
|
# Enable the headless software profile
|
||||||
services.vscode-server.enable = true;
|
ugaif.sw.enable = true;
|
||||||
|
ugaif.sw.type = lib.mkDefault "headless";
|
||||||
|
|
||||||
# Disable Disko and Bootloader for WSL
|
# Fix for VS Code Server in WSL if needed, though vscode-server input exists
|
||||||
disko.enableConfig = lib.mkForce false;
|
services.vscode-server.enable = true;
|
||||||
boot.loader.systemd-boot.enable = lib.mkForce false;
|
|
||||||
boot.loader.grub.enable = lib.mkForce false;
|
|
||||||
|
|
||||||
# Disable networking for wsl (it manages its own networking)
|
# Disable Disko and Bootloader for WSL
|
||||||
systemd.network.enable = lib.mkForce false;
|
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
|
# Disable networking for wsl (it manages its own networking)
|
||||||
ugaif.host.filesystem.device = "/dev/null";
|
systemd.network.enable = lib.mkForce false;
|
||||||
ugaif.host.filesystem.swapSize = "0G";
|
|
||||||
};
|
# 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