refactor: Fleet and sw behind mkIf guards
This commit is contained in:
@@ -5,9 +5,24 @@
|
|||||||
# - Bootloader configuration (systemd-boot with Plymouth)
|
# - Bootloader configuration (systemd-boot with Plymouth)
|
||||||
# - Timezone and locale settings
|
# - Timezone and locale settings
|
||||||
# - Systemd sleep configuration
|
# - 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 = {
|
boot = {
|
||||||
loader.systemd-boot.enable = lib.mkDefault true;
|
loader.systemd-boot.enable = lib.mkDefault true;
|
||||||
loader.efi.canTouchEfiVariables = lib.mkDefault true;
|
loader.efi.canTouchEfiVariables = lib.mkDefault true;
|
||||||
@@ -45,4 +60,5 @@
|
|||||||
SuspendState=freeze
|
SuspendState=freeze
|
||||||
HibernateDelaySec=2h
|
HibernateDelaySec=2h
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
24
fleet/fs.nix
24
fleet/fs.nix
@@ -4,9 +4,17 @@
|
|||||||
# This module defines:
|
# This module defines:
|
||||||
# - Disko partition layout (EFI, swap, root)
|
# - Disko partition layout (EFI, swap, root)
|
||||||
# - Filesystem options (device, swap size)
|
# - 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, ... }:
|
{ 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 = {
|
options.athenix = {
|
||||||
host.filesystem = {
|
host.filesystem = {
|
||||||
@@ -49,14 +57,17 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = lib.mkMerge [
|
||||||
|
{
|
||||||
# ========== Disk Partitioning (Disko) ==========
|
# ========== 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 = {
|
disko.devices = {
|
||||||
disk.main = {
|
disk.main = {
|
||||||
type = "disk";
|
type = "disk";
|
||||||
device = config.athenix.host.filesystem.device;
|
device = cfg.device;
|
||||||
content = {
|
content = {
|
||||||
type = "gpt";
|
type = "gpt";
|
||||||
partitions = {
|
partitions = {
|
||||||
@@ -79,10 +90,10 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
# Swap Partition (size configurable per host)
|
# Swap Partition (size configurable per host)
|
||||||
swap = lib.mkIf config.athenix.host.filesystem.useSwap {
|
swap = lib.mkIf cfg.useSwap {
|
||||||
name = "swap";
|
name = "swap";
|
||||||
label = "swap";
|
label = "swap";
|
||||||
size = config.athenix.host.filesystem.swapSize;
|
size = cfg.swapSize;
|
||||||
content = {
|
content = {
|
||||||
type = "swap";
|
type = "swap";
|
||||||
};
|
};
|
||||||
@@ -107,5 +118,6 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
})
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
{
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
@@ -10,7 +12,11 @@
|
|||||||
# It reconstructs the terminfo database from the provided definition and
|
# It reconstructs the terminfo database from the provided definition and
|
||||||
# adds it to the system packages.
|
# adds it to the system packages.
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
cfg = config.athenix.sw;
|
||||||
|
|
||||||
ghostty-terminfo = pkgs.runCommand "ghostty-terminfo" { } ''
|
ghostty-terminfo = pkgs.runCommand "ghostty-terminfo" { } ''
|
||||||
mkdir -p $out/share/terminfo
|
mkdir -p $out/share/terminfo
|
||||||
cat > ghostty.info <<'EOF'
|
cat > ghostty.info <<'EOF'
|
||||||
@@ -99,5 +105,7 @@ let
|
|||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
config = mkIf cfg.enable {
|
||||||
environment.systemPackages = [ ghostty-terminfo ];
|
environment.systemPackages = [ ghostty-terminfo ];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,28 @@ let
|
|||||||
cfg = config.athenix.sw.python;
|
cfg = config.athenix.sw.python;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.athenix.sw.python = {
|
options.athenix.sw.python = lib.mkOption {
|
||||||
enable = mkEnableOption "Python development tools (pixi, uv)" // {
|
type = lib.types.submodule {
|
||||||
|
options = {
|
||||||
|
enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
default = true;
|
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 {
|
config = mkIf cfg.enable {
|
||||||
environment.systemPackages = [
|
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; [
|
environment.systemPackages = with pkgs; [
|
||||||
python3
|
python3
|
||||||
git
|
git
|
||||||
@@ -508,4 +520,5 @@
|
|||||||
printf " rev = %s\n" "$CUR_REV" >&2
|
printf " rev = %s\n" "$CUR_REV" >&2
|
||||||
'')
|
'')
|
||||||
];
|
];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user