refactor: Fleet and sw behind mkIf guards

This commit is contained in:
UGA Innovation Factory
2026-01-27 16:11:36 -05:00
parent 85653e632f
commit 063336f736
5 changed files with 156 additions and 90 deletions

View File

@@ -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
'';
};
}

View File

@@ -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 @@
};
};
};
};
})
];
}

View File

@@ -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 ];
};
}

View File

@@ -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 = [

View File

@@ -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
'')
];
};
}