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,128 +1,54 @@
|
|||
{ pkgs, lib, ... }:
|
||||
|
||||
|
||||
|
||||
|
||||
{ config, inputs, pkgs, ... }:
|
||||
|
||||
# Imports
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
let
|
||||
inherit (lib) mkDefault;
|
||||
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBn3ff3HaZHIyH4K13k8Mwqu/o7jIABJ8rANK+r2PfJk";
|
||||
in
|
||||
|
||||
{
|
||||
imports = [
|
||||
inputs.hardware.nixosModules.common-pc-ssd
|
||||
inputs.hardware.nixosModules.common-cpu-intel
|
||||
inputs.hardware.nixosModules.common-gpu-intel
|
||||
|
||||
./hardware-configuration.nix
|
||||
|
||||
../common/user/ooks
|
||||
../common/base
|
||||
../common/features/bluetooth.nix
|
||||
../common/features/greetd.nix
|
||||
|
||||
];
|
||||
|
||||
# Hostname and networking
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
networking = {
|
||||
hostName = "ooksx1";
|
||||
networkmanager.enable = true;
|
||||
ooknet.host = {
|
||||
name = "ooksx1";
|
||||
type = "laptop";
|
||||
role = "workstation";
|
||||
profiles = [ "console-tools" ];
|
||||
admin = {
|
||||
name = "ooks";
|
||||
shell = "fish";
|
||||
sshKey = key;
|
||||
homeManager = true;
|
||||
};
|
||||
hardware = {
|
||||
cpu.type = "intel";
|
||||
gpu.type = "intel";
|
||||
features = [
|
||||
"bluetooth"
|
||||
"backlight"
|
||||
"battery"
|
||||
"ssd"
|
||||
"audio"
|
||||
"video"
|
||||
];
|
||||
battery = {
|
||||
powersave = {
|
||||
minFreq = 800;
|
||||
maxFreq = 1800;
|
||||
};
|
||||
performance = {
|
||||
minFreq = 1800;
|
||||
maxFreq = 3600;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
# Printing
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
services.printing.enable = true;
|
||||
|
||||
# Kernel
|
||||
# ------------------------------------------------------------------------------------------------
|
||||
|
||||
boot = {
|
||||
kernelPackages = pkgs.linuxKernel.packages.linux_zen;
|
||||
};
|
||||
|
||||
|
||||
# Laptop Programs
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
powerManagement.powertop.enable = true;
|
||||
programs = {
|
||||
light.enable = true;
|
||||
dconf.enable = true;
|
||||
kdeconnect.enable = true;
|
||||
};
|
||||
|
||||
|
||||
hardware = {
|
||||
opengl = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
# gnupg
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
programs.gnupg.agent = {
|
||||
enable = true;
|
||||
enableSSHSupport = true;
|
||||
};
|
||||
|
||||
# Services
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
services = {
|
||||
logind = {
|
||||
lidSwitch = "suspend";
|
||||
};
|
||||
dbus = {
|
||||
enable = true;
|
||||
packages = [ pkgs.gcr ];
|
||||
};
|
||||
auto-cpufreq = {
|
||||
enable = true;
|
||||
settings = {
|
||||
battery = {
|
||||
governor = "powersave";
|
||||
turbo = "never";
|
||||
};
|
||||
charger = {
|
||||
governor = "performance";
|
||||
turbo = "auto";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemd = {
|
||||
user.services.polkit-gnome-authentication-agent-1 = {
|
||||
description = "polkit-gnome-authentication-agent-1";
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
wants = [ "graphical-session.target" ];
|
||||
after = [ "graphical-session.target" ];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
|
||||
Restart = "on-failure";
|
||||
RestartSec = 1;
|
||||
TimeoutStopSec = 10;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Firewall
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
# networking.firewall.allowedTCPPorts = [ ... ];
|
||||
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||
# Or disable the firewall altogether.
|
||||
# networking.firewall.enable = false;
|
||||
|
||||
# System Version
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
system = {
|
||||
stateVersion = "22.05";
|
||||
};
|
||||
system.stateVersion = mkDefault "23.11";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{ lib, config, inputs, pkgs, ... }:
|
||||
{ lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBn3ff3HaZHIyH4K13k8Mwqu/o7jIABJ8rANK+r2PfJk";
|
||||
|
|
@ -13,13 +13,19 @@ in
|
|||
name = "ooksdesk";
|
||||
type = "desktop";
|
||||
role = "workstation";
|
||||
profiles = [ "gaming" "creative" ];
|
||||
profiles = [ "gaming" "creative" "console-tools" ];
|
||||
admin = {
|
||||
name = "ooks";
|
||||
shell = "fish";
|
||||
sshKey = key;
|
||||
homeManager = true;
|
||||
};
|
||||
networking = {
|
||||
tailscale = {
|
||||
enable = true;
|
||||
client = true;
|
||||
};
|
||||
};
|
||||
hardware = {
|
||||
cpu.type = "amd";
|
||||
cpu.amd.pstate.enable = true;
|
||||
|
|
@ -36,11 +42,6 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
ooknet.networking.tailscale = {
|
||||
enable = true;
|
||||
client = true;
|
||||
};
|
||||
|
||||
boot = {
|
||||
kernelPackages = pkgs.linuxPackages_xanmod_latest;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,17 +12,20 @@ in
|
|||
ooknet.host = {
|
||||
name = "ooksmedia";
|
||||
type = "desktop";
|
||||
function = [
|
||||
"workstation"
|
||||
"gaming"
|
||||
"media-server"
|
||||
];
|
||||
role = "workstation";
|
||||
profiles = [ "media-server" "console-tools" ];
|
||||
admin = {
|
||||
name = "ooks";
|
||||
shell = "fish";
|
||||
sshKey = key;
|
||||
homeManager = true;
|
||||
};
|
||||
networking = {
|
||||
tailscale = {
|
||||
enable = true;
|
||||
server = true;
|
||||
};
|
||||
};
|
||||
hardware = {
|
||||
cpu.type = "intel";
|
||||
cpu.amd.pstate.enable = true;
|
||||
|
|
@ -34,12 +37,6 @@ in
|
|||
];
|
||||
};
|
||||
};
|
||||
|
||||
ooknet.networking.tailscale = {
|
||||
enable = true;
|
||||
server = true;
|
||||
};
|
||||
|
||||
boot = {
|
||||
kernelPackages = pkgs.linuxPackages_xanmod_latest;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,38 +1,68 @@
|
|||
{ pkgs, ... }:
|
||||
{ pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkDefault;
|
||||
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBn3ff3HaZHIyH4K13k8Mwqu/o7jIABJ8rANK+r2PfJk";
|
||||
in
|
||||
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
../../profiles
|
||||
];
|
||||
|
||||
activeProfiles = ["base" "laptop"];
|
||||
|
||||
ooknet.user = {
|
||||
ooks.enable = true;
|
||||
shell.fish.enable = true;
|
||||
ooknet.host = {
|
||||
name = "ooksmicro";
|
||||
type = "micro";
|
||||
role = "workstation";
|
||||
profiles = [ "console-tools" ];
|
||||
admin = {
|
||||
name = "ooks";
|
||||
shell = "fish";
|
||||
sshKey = key;
|
||||
homeManager = true;
|
||||
};
|
||||
|
||||
ooknet.laptop.power = {
|
||||
networking = {
|
||||
tailscale = {
|
||||
enable = true;
|
||||
client = true;
|
||||
};
|
||||
};
|
||||
hardware = {
|
||||
cpu.type = "intel";
|
||||
gpu.type = "intel";
|
||||
features = [
|
||||
"bluetooth"
|
||||
"backlight"
|
||||
"battery"
|
||||
"ssd"
|
||||
"audio"
|
||||
"video"
|
||||
];
|
||||
battery = {
|
||||
powersave = {
|
||||
minFreq = 800;
|
||||
maxFreq = 1600;
|
||||
minFreq = 500;
|
||||
maxFreq = 800;
|
||||
};
|
||||
performance = {
|
||||
minFreq = 1100;
|
||||
maxFreq = 2600;
|
||||
minFreq = 1200;
|
||||
maxFreq = 2400;
|
||||
};
|
||||
};
|
||||
|
||||
networking = {
|
||||
hostName = "ooksmicro";
|
||||
};
|
||||
monitors = [{
|
||||
name = "DSI-1";
|
||||
width = 720;
|
||||
height = 1280;
|
||||
workspace = "1";
|
||||
primary = true;
|
||||
transform = 3;
|
||||
}];
|
||||
};
|
||||
|
||||
boot = {
|
||||
kernelPackages = pkgs.linuxKernel.packages.linux_zen;
|
||||
# need this due to
|
||||
kernelParams = [ "fbcon=rotate:1" ];
|
||||
# required for keyboard to work during boot
|
||||
initrd.availableKernelModules = [ "battery" ];
|
||||
};
|
||||
|
||||
system.stateVersion = mkDefault "23.11";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,13 +14,20 @@ in
|
|||
ooknet.host = {
|
||||
name = "ookst480s";
|
||||
type = "laptop";
|
||||
function = [ "workstation" ];
|
||||
role = "workstation";
|
||||
profiles = [ "console-tools" ];
|
||||
admin = {
|
||||
name = "ooks";
|
||||
shell = "fish";
|
||||
sshKey = key;
|
||||
homeManager = true;
|
||||
};
|
||||
networking = {
|
||||
tailscale = {
|
||||
enable = true;
|
||||
client = true;
|
||||
};
|
||||
};
|
||||
hardware = {
|
||||
cpu.type = "intel";
|
||||
gpu.type = "intel";
|
||||
|
|
@ -32,6 +39,13 @@ in
|
|||
"audio"
|
||||
"video"
|
||||
];
|
||||
monitors = [{
|
||||
name = "eDP-1";
|
||||
width = 1920;
|
||||
height = 1080;
|
||||
workspace = "1";
|
||||
primary = true;
|
||||
}];
|
||||
battery = {
|
||||
powersave = {
|
||||
minFreq = 800;
|
||||
|
|
|
|||
|
|
@ -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