Compare commits
2 Commits
85653e632f
...
d8cee7e79b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d8cee7e79b | ||
|
|
063336f736 |
@@ -5,9 +5,24 @@
|
||||
# - Bootloader configuration (systemd-boot with Plymouth)
|
||||
# - Timezone and locale settings
|
||||
# - Systemd sleep configuration
|
||||
#
|
||||
# Only applies to:
|
||||
# - Linux systems (not Darwin/macOS)
|
||||
# - Systems with actual boot hardware (not containers/WSL)
|
||||
|
||||
{ lib, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
# Check if this is a bootable system (not container, not WSL)
|
||||
isBootable = !(config.boot.isContainer or false) && (pkgs.stdenv.isLinux);
|
||||
in
|
||||
{
|
||||
config = lib.mkIf isBootable {
|
||||
boot = {
|
||||
loader.systemd-boot.enable = lib.mkDefault true;
|
||||
loader.efi.canTouchEfiVariables = lib.mkDefault true;
|
||||
@@ -45,4 +60,5 @@
|
||||
SuspendState=freeze
|
||||
HibernateDelaySec=2h
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
24
fleet/fs.nix
24
fleet/fs.nix
@@ -4,9 +4,17 @@
|
||||
# This module defines:
|
||||
# - Disko partition layout (EFI, swap, root)
|
||||
# - Filesystem options (device, swap size)
|
||||
#
|
||||
# Only applies to systems with physical disk management needs
|
||||
# (not containers, not WSL, not systems without a configured device)
|
||||
|
||||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.athenix.host.filesystem;
|
||||
# Only enable disk config if device is set and disko is enabled
|
||||
hasDiskConfig = cfg.device != null && config.disko.enableConfig;
|
||||
in
|
||||
{
|
||||
options.athenix = {
|
||||
host.filesystem = {
|
||||
@@ -49,14 +57,17 @@
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
# ========== Disk Partitioning (Disko) ==========
|
||||
disko.enableConfig = lib.mkDefault (config.athenix.host.filesystem.device != null);
|
||||
disko.enableConfig = lib.mkDefault (cfg.device != null);
|
||||
}
|
||||
|
||||
(lib.mkIf hasDiskConfig {
|
||||
disko.devices = {
|
||||
disk.main = {
|
||||
type = "disk";
|
||||
device = config.athenix.host.filesystem.device;
|
||||
device = cfg.device;
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
@@ -79,10 +90,10 @@
|
||||
};
|
||||
|
||||
# Swap Partition (size configurable per host)
|
||||
swap = lib.mkIf config.athenix.host.filesystem.useSwap {
|
||||
swap = lib.mkIf cfg.useSwap {
|
||||
name = "swap";
|
||||
label = "swap";
|
||||
size = config.athenix.host.filesystem.swapSize;
|
||||
size = cfg.swapSize;
|
||||
content = {
|
||||
type = "swap";
|
||||
};
|
||||
@@ -107,5 +118,6 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
||||
|
||||
@@ -10,11 +10,33 @@
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.athenix.hw.nix-desktop;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
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.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
# ========== Boot Configuration ==========
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
@@ -47,4 +69,5 @@
|
||||
# ========== Software Profile ==========
|
||||
athenix.sw.enable = lib.mkDefault true;
|
||||
athenix.sw.desktop.enable = lib.mkDefault true;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -11,11 +11,32 @@
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.athenix.hw.nix-ephemeral;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
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.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# ========== Boot Configuration ==========
|
||||
boot.initrd.availableKernelModules = [
|
||||
"xhci_pci" # USB 3.0 support
|
||||
@@ -63,4 +84,5 @@
|
||||
|
||||
athenix.sw.enable = lib.mkDefault true;
|
||||
athenix.sw.stateless-kiosk.enable = lib.mkDefault true;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,11 +10,32 @@
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.athenix.hw.nix-laptop;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
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.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# ========== Boot Configuration ==========
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
@@ -60,4 +81,5 @@
|
||||
|
||||
athenix.sw.enable = lib.mkDefault true;
|
||||
athenix.sw.desktop.enable = lib.mkDefault true;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,17 +5,32 @@
|
||||
# Disables boot/disk management and enables remote development support.
|
||||
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
modulesPath,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
inputs.vscode-server.nixosModules.default
|
||||
"${modulesPath}/virtualisation/proxmox-lxc.nix"
|
||||
];
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.athenix.hw.nix-lxc;
|
||||
in
|
||||
{
|
||||
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.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# ========== Nix Configuration ==========
|
||||
nix.settings.trusted-users = [
|
||||
"root"
|
||||
@@ -57,4 +72,5 @@
|
||||
|
||||
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,6 +30,21 @@ in
|
||||
inputs.nixos-hardware.nixosModules.microsoft-surface-go
|
||||
];
|
||||
|
||||
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.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# ========== Boot Configuration ==========
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
@@ -66,4 +85,5 @@ in
|
||||
# ========== 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,11 +10,32 @@
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.athenix.hw.nix-zima;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
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.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# ========== Boot Configuration ==========
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
@@ -46,4 +67,5 @@
|
||||
# ========== Software Profile ==========
|
||||
athenix.sw.enable = lib.mkDefault true;
|
||||
athenix.sw.desktop.enable = lib.mkDefault true;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
@@ -10,7 +12,11 @@
|
||||
# It reconstructs the terminfo database from the provided definition and
|
||||
# adds it to the system packages.
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.athenix.sw;
|
||||
|
||||
ghostty-terminfo = pkgs.runCommand "ghostty-terminfo" { } ''
|
||||
mkdir -p $out/share/terminfo
|
||||
cat > ghostty.info <<'EOF'
|
||||
@@ -99,5 +105,7 @@ let
|
||||
'';
|
||||
in
|
||||
{
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [ ghostty-terminfo ];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -18,11 +18,28 @@ let
|
||||
cfg = config.athenix.sw.python;
|
||||
in
|
||||
{
|
||||
options.athenix.sw.python = {
|
||||
enable = mkEnableOption "Python development tools (pixi, uv)" // {
|
||||
options.athenix.sw.python = lib.mkOption {
|
||||
type = lib.types.submodule {
|
||||
options = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Enable Python development tools (pixi, uv).
|
||||
|
||||
Provides:
|
||||
- pixi: Fast, cross-platform package manager for Python
|
||||
- uv: Extremely fast Python package installer and resolver
|
||||
|
||||
These tools manage project-based dependencies rather than global
|
||||
Python packages, avoiding conflicts and improving reproducibility.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
description = "Python development environment configuration.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.athenix.sw;
|
||||
in
|
||||
{
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
python3
|
||||
git
|
||||
@@ -508,4 +520,5 @@
|
||||
printf " rev = %s\n" "$CUR_REV" >&2
|
||||
'')
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user