refactor(nixos:tailcale): move options --> ooknet.host.networking.tailscale
This commit is contained in:
parent
fa926b9453
commit
dd6271f7d6
7 changed files with 195 additions and 224 deletions
|
|
@ -1,42 +1,14 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.ooknet.networking.tailscale;
|
||||
cfg = config.ooknet.host.networking.tailscale;
|
||||
inherit (config.services) tailscale;
|
||||
inherit (lib.lists) optionals;
|
||||
inherit (lib.types) bool listOf str;
|
||||
inherit (lib.strings) concatStringsSep;
|
||||
inherit (lib) mkIf mkEnableOption mkOption mkDefault;
|
||||
inherit (lib) mkIf mkDefault;
|
||||
in
|
||||
|
||||
{
|
||||
options.ooknet.networking.tailscale = {
|
||||
enable = mkEnableOption "Enable tailscale system module";
|
||||
server = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Define if the host is a server";
|
||||
};
|
||||
client = mkOption {
|
||||
type = bool;
|
||||
default = cfg.enable;
|
||||
description = "Define if the host is a client";
|
||||
};
|
||||
tag = mkOption {
|
||||
type = listOf str;
|
||||
default =
|
||||
if cfg.client then ["tag:client"]
|
||||
else if cfg.server then ["tag:server"]
|
||||
else [];
|
||||
description = "Sets host tag depending on if server/client";
|
||||
};
|
||||
operator = mkOption {
|
||||
type = str;
|
||||
default = "ooks";
|
||||
description = "Name of the tailscale operator";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
services.tailscale = {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@
|
|||
let
|
||||
inherit (lib) mkOption mkEnableOption;
|
||||
inherit (lib.types) bool enum listOf int submodule nullOr str;
|
||||
admin = config.ooknet.host.admin;
|
||||
hardware = config.ooknet.host.hardware;
|
||||
tailscale = config.ooknet.host.networking.tailscale;
|
||||
in
|
||||
|
||||
{
|
||||
|
|
@ -24,7 +26,7 @@ in
|
|||
};
|
||||
|
||||
profiles = mkOption {
|
||||
type = listOf (enum ["gaming" "creative" "productivity" "media-server"]);
|
||||
type = listOf (enum ["gaming" "creative" "productivity" "console-tools" "media-server"]);
|
||||
default = [];
|
||||
};
|
||||
|
||||
|
|
@ -52,6 +54,35 @@ in
|
|||
homeManager = mkEnableOption "";
|
||||
};
|
||||
|
||||
networking = {
|
||||
tailscale = {
|
||||
enable = mkEnableOption "Enable tailscale system module";
|
||||
server = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Define if the host is a server";
|
||||
};
|
||||
client = mkOption {
|
||||
type = bool;
|
||||
default = tailscale.enable;
|
||||
description = "Define if the host is a client";
|
||||
};
|
||||
tag = mkOption {
|
||||
type = listOf str;
|
||||
default =
|
||||
if tailscale.client then ["tag:client"]
|
||||
else if tailscale.server then ["tag:server"]
|
||||
else [];
|
||||
description = "Sets host tag depending on if server/client";
|
||||
};
|
||||
operator = mkOption {
|
||||
type = str;
|
||||
default = "${admin.name}";
|
||||
description = "Name of the tailscale operator";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
hardware = {
|
||||
gpu = {
|
||||
type = mkOption {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue