refactor: reorganize directory structure (variants -> hw, glue -> fleet)
- Rename variants/ to hw/ for clearer hardware module naming - Rename glue/ to fleet/ for more intuitive fleet management - Move boot/fs configuration from glue/boot.nix to separate fleet/boot.nix and fleet/fs.nix - Improve separation of concerns between boot, filesystem, and common config
This commit is contained in:
90
fleet/fs.nix
Normal file
90
fleet/fs.nix
Normal file
@@ -0,0 +1,90 @@
|
||||
# ============================================================================
|
||||
# FS & Storage Configuration
|
||||
# ============================================================================
|
||||
# This module defines:
|
||||
# - Disko partition layout (EFI, swap, root)
|
||||
# - Filesystem options (device, swap size)
|
||||
|
||||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
options.athenix = {
|
||||
host.filesystem = {
|
||||
device = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
description = "The main disk device to use for installation.";
|
||||
};
|
||||
useSwap = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Whether to create and use a swap partition.";
|
||||
};
|
||||
swapSize = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
description = "The size of the swap partition.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
# ========== Disk Partitioning (Disko) ==========
|
||||
disko.enableConfig = lib.mkDefault (config.athenix.host.filesystem.device != null);
|
||||
|
||||
disko.devices = {
|
||||
disk.main = {
|
||||
type = "disk";
|
||||
device = config.athenix.host.filesystem.device;
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
# EFI System Partition
|
||||
ESP = {
|
||||
name = "ESP";
|
||||
label = "BOOT";
|
||||
size = "1G";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "umask=0077" ];
|
||||
extraArgs = [
|
||||
"-n"
|
||||
"BOOT"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Swap Partition (size configurable per host)
|
||||
swap = lib.mkIf config.athenix.host.filesystem.useSwap {
|
||||
name = "swap";
|
||||
label = "swap";
|
||||
size = config.athenix.host.filesystem.swapSize;
|
||||
content = {
|
||||
type = "swap";
|
||||
};
|
||||
};
|
||||
|
||||
# Root Partition (takes remaining space)
|
||||
root = {
|
||||
name = "root";
|
||||
label = "root";
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
extraArgs = [
|
||||
"-L"
|
||||
"ROOT"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user