all: add module config.nodeconfig.is-server

This commit is contained in:
Adithya 2024-10-22 22:13:53 +05:30
parent 2fccc35829
commit 81a8c582e7
Signed by: adtya
GPG key ID: B8857BFBA2C47B9C
9 changed files with 68 additions and 19 deletions

View file

@ -10,6 +10,7 @@ _: {
nodeconfig = { nodeconfig = {
minimize = true; minimize = true;
nix.auto-gc = true; nix.auto-gc = true;
is-server = true;
}; };
environment.sessionVariables = { environment.sessionVariables = {

View file

@ -12,6 +12,7 @@ _: {
minimize = true; minimize = true;
nix.auto-gc = true; nix.auto-gc = true;
is-pi = true; is-pi = true;
is-server = true;
}; };
i18n = { i18n = {

View file

@ -12,6 +12,7 @@ _: {
minimize = true; minimize = true;
nix.auto-gc = true; nix.auto-gc = true;
is-pi = true; is-pi = true;
is-server = true;
}; };
i18n = { i18n = {

View file

@ -12,6 +12,7 @@ _: {
minimize = true; minimize = true;
nix.auto-gc = true; nix.auto-gc = true;
is-pi = true; is-pi = true;
is-server = true;
}; };
i18n = { i18n = {

View file

@ -2,8 +2,10 @@ _: {
networking = { networking = {
useNetworkd = true; useNetworkd = true;
}; };
systemd.network = { systemd = {
network = {
enable = true; enable = true;
wait-online.enable = false;
networks = { networks = {
"41-ether" = { "41-ether" = {
enable = true; enable = true;
@ -25,4 +27,5 @@ _: {
}; };
}; };
}; };
};
} }

View file

@ -10,6 +10,7 @@ _: {
nodeconfig = { nodeconfig = {
minimize = true; minimize = true;
nix.auto-gc = true; nix.auto-gc = true;
is-server = true;
}; };
environment.sessionVariables = { environment.sessionVariables = {

View file

@ -3,6 +3,7 @@ _: {
./general.nix ./general.nix
./nix.nix ./nix.nix
./pi.nix ./pi.nix
./server.nix
./wireguard.nix ./wireguard.nix
]; ];
} }

View file

@ -18,6 +18,7 @@ let cfg = config.nodeconfig; in {
nixos.enable = lib.mkDefault false; nixos.enable = lib.mkDefault false;
}; };
fonts.fontconfig.enable = lib.mkDefault false;
programs.command-not-found.enable = lib.mkDefault false; programs.command-not-found.enable = lib.mkDefault false;
xdg = { xdg = {
@ -25,6 +26,7 @@ let cfg = config.nodeconfig; in {
icons.enable = lib.mkDefault false; icons.enable = lib.mkDefault false;
mime.enable = lib.mkDefault false; mime.enable = lib.mkDefault false;
sounds.enable = lib.mkDefault false; sounds.enable = lib.mkDefault false;
menus.enable = lib.mkDefault false;
}; };
}; };
} }

38
modules/server.nix Normal file
View file

@ -0,0 +1,38 @@
{ lib, config, ... }:
let cfg = config.nodeconfig; in {
options.nodeconfig = {
is-server = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "configure node as a server";
};
};
config = lib.mkIf cfg.is-server {
boot.kernel.sysctl = {
"net.core.default_qdisc" = "fq";
"net.ipv4.tcp_congestion_control" = "bbr";
};
networking.firewall = {
allowPing = true;
logRefusedConnections = lib.mkDefault false;
};
systemd = {
services = {
NetworkManager-wait-online.enable = false;
systemd-networkd.stopIfChanged = false;
systemd-resolved.stopIfChanged = false;
};
enableEmergencyMode = false;
watchdog = {
runtimeTime = "15s";
rebootTime = "30s";
kexecTime = "1m";
};
sleep.extraConfig = ''
AllowSuspend=no
AllowHibernation=no
'';
};
};
}