This repository has been archived on 2026-03-10. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
nixos/system/host-capabilities.nix
Torjus Håkestad 7c200468f8
All checks were successful
Run nix flake check / flake-check (push) Successful in 2m12s
system: replace host detection with capabilities module
Replace scattered osConfig.system.name comparisons with a declarative
host.capabilities module. This improves maintainability and semantic
clarity by expressing what capabilities a host has rather than checking
its name.

Changes:
- Add system/host-capabilities.nix with options for hardware, form factor,
  UI behavior, services, and backup configuration
- Configure capabilities in hosts/gunter and hosts/magicman
- Migrate 6 files to use capabilities: packages, waybar, ssh, backup-home
- Remove redundant host name check for pciutils in gunter config
- Make backup-home service conditionally enabled based on capabilities

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-31 10:16:19 +01:00

71 lines
1.8 KiB
Nix

{ lib, ... }:
with lib;
{
options.host.capabilities = {
# Hardware capabilities
hasCuda = mkOption {
type = types.bool;
default = false;
description = "Whether the host has CUDA-capable GPU (for btop, OBS, etc.)";
};
hasNvidia = mkOption {
type = types.bool;
default = false;
description = "Whether the host has NVIDIA GPU";
};
hasBattery = mkOption {
type = types.bool;
default = false;
description = "Whether the host has a battery (laptop)";
};
# Form factor
formFactor = mkOption {
type = types.enum [
"desktop"
"laptop"
];
default = "desktop";
description = "Physical form factor of the host";
};
# UI behavior customizations
volumeScrollStep = mkOption {
type = types.int;
default = 5;
description = "Volume adjustment step percentage for scroll wheel";
};
# Service-specific features
enableArrhist = mkOption {
type = types.bool;
default = false;
description = "Enable Sonarr/Radarr monitoring widget (arrhist)";
};
# Network environment features
hasEduroamAccess = mkOption {
type = types.bool;
default = false;
description = "Whether this host can connect to eduroam (for SSH config)";
};
# Backup configuration
backupRepository = mkOption {
type = types.nullOr types.str;
default = null;
description = "Restic backup repository URL for this host";
example = "rest:http://10.69.12.52:8000/gunter.home.2rjus.net";
};
backupPassword = mkOption {
type = types.nullOr types.str;
default = null;
description = "Restic backup password identifier for this host";
example = "gunter.home.2rjus.net";
};
};
}