feat: Builder config settable with options
This commit is contained in:
100
sw/default.nix
100
sw/default.nix
@@ -17,6 +17,12 @@ with lib;
|
||||
|
||||
let
|
||||
cfg = config.ugaif.sw;
|
||||
|
||||
# Normalize type to always be a list
|
||||
swTypes = if isList cfg.type then cfg.type else [ cfg.type ];
|
||||
|
||||
# Helper to check if a type is enabled
|
||||
hasType = type: elem type swTypes;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
@@ -29,14 +35,26 @@ in
|
||||
enable = mkEnableOption "Standard Workstation Configuration";
|
||||
|
||||
type = mkOption {
|
||||
type = types.enum [
|
||||
"desktop"
|
||||
"tablet-kiosk"
|
||||
"headless"
|
||||
"stateless-kiosk"
|
||||
type = types.oneOf [
|
||||
(types.enum [
|
||||
"desktop"
|
||||
"tablet-kiosk"
|
||||
"headless"
|
||||
"stateless-kiosk"
|
||||
"builders"
|
||||
])
|
||||
(types.listOf (
|
||||
types.enum [
|
||||
"desktop"
|
||||
"tablet-kiosk"
|
||||
"headless"
|
||||
"stateless-kiosk"
|
||||
"builders"
|
||||
]
|
||||
))
|
||||
];
|
||||
default = "desktop";
|
||||
description = "Type of system configuration: 'desktop' for normal OS, 'tablet-kiosk' for tablet/kiosk mode.";
|
||||
description = "Type(s) of system configuration. Can be a single type or a list of types to combine multiple configurations.";
|
||||
};
|
||||
|
||||
extraPackages = mkOption {
|
||||
@@ -56,6 +74,58 @@ in
|
||||
default = "https://ha.factory.uga.edu";
|
||||
description = "URL to open in Chromium kiosk mode.";
|
||||
};
|
||||
|
||||
# Builders-specific options
|
||||
builders = mkOption {
|
||||
type = types.submodule {
|
||||
options = {
|
||||
githubRunner = {
|
||||
enable = mkEnableOption "GitHub Actions self-hosted runner";
|
||||
|
||||
url = mkOption {
|
||||
type = types.str;
|
||||
description = "GitHub repository URL for the runner";
|
||||
};
|
||||
|
||||
tokenFile = mkOption {
|
||||
type = types.path;
|
||||
default = "/var/lib/github-runner-token";
|
||||
description = ''
|
||||
Path to file containing GitHub PAT token.
|
||||
Generate at: https://github.com/settings/tokens
|
||||
The token must have repo access.
|
||||
'';
|
||||
};
|
||||
|
||||
extraLabels = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = "Extra labels to identify this runner in workflows";
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
default = "engr-ugaif";
|
||||
description = "User to run the runner as";
|
||||
};
|
||||
|
||||
workDir = mkOption {
|
||||
type = types.str;
|
||||
default = "/var/lib/github-runner";
|
||||
description = "Working directory for runner";
|
||||
};
|
||||
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
default = "nixos-systems";
|
||||
description = "Name of the GitHub runner service";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
description = "Builder-specific configuration options";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
@@ -80,7 +150,7 @@ in
|
||||
];
|
||||
}
|
||||
# ========== Software Profile Imports ==========
|
||||
(mkIf (cfg.type == "desktop") (
|
||||
(mkIf (hasType "desktop") (
|
||||
import ./desktop {
|
||||
inherit
|
||||
config
|
||||
@@ -90,7 +160,7 @@ in
|
||||
;
|
||||
}
|
||||
))
|
||||
(mkIf (cfg.type == "tablet-kiosk") (
|
||||
(mkIf (hasType "tablet-kiosk") (
|
||||
import ./tablet-kiosk {
|
||||
inherit
|
||||
config
|
||||
@@ -100,7 +170,7 @@ in
|
||||
;
|
||||
}
|
||||
))
|
||||
(mkIf (cfg.type == "headless") (
|
||||
(mkIf (hasType "headless") (
|
||||
import ./headless {
|
||||
inherit
|
||||
config
|
||||
@@ -110,7 +180,7 @@ in
|
||||
;
|
||||
}
|
||||
))
|
||||
(mkIf (cfg.type == "stateless-kiosk") (
|
||||
(mkIf (hasType "stateless-kiosk") (
|
||||
import ./stateless-kiosk {
|
||||
inherit
|
||||
config
|
||||
@@ -120,5 +190,15 @@ in
|
||||
;
|
||||
}
|
||||
))
|
||||
(mkIf (hasType "builders") (
|
||||
import ./builders {
|
||||
inherit
|
||||
config
|
||||
lib
|
||||
pkgs
|
||||
inputs
|
||||
;
|
||||
}
|
||||
))
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user