refactor(treewide): enable modules based on host.type
This commit is contained in:
parent
779603c4cc
commit
25e02c034c
10 changed files with 39 additions and 67 deletions
|
|
@ -1,11 +1,12 @@
|
||||||
{ lib, config, ... }:
|
{ lib, config, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.systemModules.bootloader.systemd;
|
inherit (lib) mkIf;
|
||||||
|
host = config.systemModules.host;
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
config = lib.mkIf cfg.enable {
|
config = mkIf (host.type != "phone") {
|
||||||
boot.loader = {
|
boot.loader = {
|
||||||
systemd-boot = {
|
systemd-boot = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,5 @@
|
||||||
{ lib, ... }:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./tuigreet
|
./tuigreet
|
||||||
];
|
];
|
||||||
|
|
||||||
options.systemModules.displayManager = {
|
|
||||||
tuigreet = {
|
|
||||||
enable = lib.mkEnableOption "Enable tuigreet display manager module";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,16 @@
|
||||||
{ pkgs, lib, config, ... }:
|
{ pkgs, lib, config, ... }:
|
||||||
let
|
let
|
||||||
|
inherit (lib) mkIf;
|
||||||
tuigreet = "${pkgs.greetd.tuigreet}/bin/tuigreet";
|
tuigreet = "${pkgs.greetd.tuigreet}/bin/tuigreet";
|
||||||
cfg = config.systemModules.displayManager.tuigreet;
|
host = config.systemModules.host;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
config = lib.mkIf cfg.enable {
|
config = mkIf (host.type != "phone") {
|
||||||
services.greetd = {
|
services.greetd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
default_session = {
|
default_session = {
|
||||||
command = "${tuigreet} --time --remember --cmd Hyprland";
|
command = "${tuigreet} --time --remember --cmd Hyprland"; # TODO: dont hardcode this
|
||||||
user = "greeter";
|
user = "greeter";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
{ lib, config, ... }:
|
{ lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.systemModules.locale;
|
inherit (lib) mkDefault;
|
||||||
inherit (lib) mkIf mkDefault;
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
config = mkIf cfg.enable {
|
|
||||||
i18n = {
|
i18n = {
|
||||||
defaultLocale = mkDefault "en_US.UTF-8";
|
defaultLocale = mkDefault "en_US.UTF-8";
|
||||||
supportedLocales = mkDefault [
|
supportedLocales = mkDefault [
|
||||||
|
|
@ -16,5 +14,4 @@ in
|
||||||
time.timeZone = mkDefault "Pacific/Auckland";
|
time.timeZone = mkDefault "Pacific/Auckland";
|
||||||
location.provider = "geoclue2";
|
location.provider = "geoclue2";
|
||||||
services.geoclue2.enable = true;
|
services.geoclue2.enable = true;
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
{ lib, config, ... }:
|
{ lib, config, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.systemModules.networking;
|
inherit (lib) mkIf;
|
||||||
inherit (lib) mkIf mkEnableOption;
|
host = config.systemModules.host;
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
@ -15,9 +15,7 @@ in
|
||||||
./tailscale
|
./tailscale
|
||||||
];
|
];
|
||||||
|
|
||||||
options.systemModule.networking.enable = mkEnableOption "Enable networking system module";
|
config = mkIf (host.type != "phone") {
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
networking.networkmanager = {
|
networking.networkmanager = {
|
||||||
enable = true;
|
enable = true;
|
||||||
dns = "systemd-resolved";
|
dns = "systemd-resolved";
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
{ lib, config, ... }:
|
{ lib, config, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.systemModules.networking;
|
inherit (lib) mkIf;
|
||||||
inherit (lib) mkIf mkEnableOption;
|
host = config.systemModules.host;
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
options.systemModules.networking.firewall = mkEnableOption "Enable networking firewall system modules";
|
config = mkIf (host.type != "phone") {
|
||||||
config = mkIf cfg.firewall {
|
|
||||||
networking.firewall = {
|
networking.firewall = {
|
||||||
enable = true;
|
enable = true;
|
||||||
allowedTCPPorts = [
|
allowedTCPPorts = [
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,12 @@
|
||||||
{ lib, config, ... }:
|
{ lib, config, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.systemModules.networking;
|
inherit (lib) mkIf;
|
||||||
inherit (lib) mkIf mkEnableOption;
|
host = config.systemModules.host;
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
options.systemModules.networking.resolved = mkEnableOption "Enable systemd resolved daemon";
|
config = mkIf (host.type != "phone") {
|
||||||
|
|
||||||
config = mkIf cfg.resolved {
|
|
||||||
services.resolved = {
|
services.resolved = {
|
||||||
enable = true;
|
enable = true;
|
||||||
fallbackDns = ["9.9.9.9"];
|
fallbackDns = ["9.9.9.9"];
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,16 @@
|
||||||
{ lib, config, ... }:
|
{ lib, config, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.systemModules.networking;
|
inherit (lib) mkIf mkDefault;
|
||||||
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBn3ff3HaZHIyH4K13k8Mwqu/o7jIABJ8rANK+r2PfJk";
|
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBn3ff3HaZHIyH4K13k8Mwqu/o7jIABJ8rANK+r2PfJk";
|
||||||
phoneKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINredx07UAk2l1wUPujYnmJci1+XEmcUuSX0DIYg6Vzz";
|
phoneKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINredx07UAk2l1wUPujYnmJci1+XEmcUuSX0DIYg6Vzz";
|
||||||
inherit (lib) mkIf mkDefault mkEnableOption;
|
host = config.systemModules.host;
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
options.systemModules.networking.ssh = mkEnableOption "Enable ssh networking module";
|
config = mkIf (host.type != "phone") {
|
||||||
|
|
||||||
config = mkIf cfg.ssh {
|
|
||||||
environment.sessionVariables.SSH_AUTH_SOCK = "~/.1password/agent.sock";
|
environment.sessionVariables.SSH_AUTH_SOCK = "~/.1password/agent.sock";
|
||||||
|
|
||||||
users.users.ooks.openssh.authorizedKeys.keys = [ key ];
|
|
||||||
|
|
||||||
services.openssh = {
|
services.openssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,13 @@
|
||||||
{ lib, config, ... }:
|
{ lib, config, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.systemModules.networking;
|
inherit (lib) mkIf;
|
||||||
inherit (lib) mkIf mkEnableOption;
|
host = config.systemModules.type;
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
options.systemModules.networking.hardenTcp = mkEnableOption "Harden TCP";
|
# nyx module
|
||||||
|
config = mkIf (host.type != "phone") {
|
||||||
config = mkIf cfg.hardenTcp {
|
|
||||||
boot = {
|
boot = {
|
||||||
kernelModules = ["tls" "tcp_bbr"];
|
kernelModules = ["tls" "tcp_bbr"];
|
||||||
kernel.sysctl = {
|
kernel.sysctl = {
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,9 @@
|
||||||
{ lib, config, pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
|
|
||||||
let
|
|
||||||
cfg = config.systemModules.networking;
|
|
||||||
inherit (lib) mkIf mkEnableOption;
|
|
||||||
in
|
|
||||||
|
|
||||||
{
|
{
|
||||||
options.systemModules.networking.tools = mkEnableOption "Enable networking tools";
|
|
||||||
|
|
||||||
config = mkIf cfg.tools {
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
traceroute
|
traceroute
|
||||||
mtr
|
mtr
|
||||||
tcpdump
|
tcpdump
|
||||||
];
|
];
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue