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 = {
minimize = true;
nix.auto-gc = true;
is-server = true;
};
environment.sessionVariables = {

View file

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

View file

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

View file

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

View file

@ -2,25 +2,28 @@ _: {
networking = {
useNetworkd = true;
};
systemd.network = {
enable = true;
networks = {
"41-ether" = {
enable = true;
matchConfig = {
Type = "ether";
};
networkConfig = {
DHCP = "yes";
};
dhcpV4Config = {
UseDomains = true;
};
ipv6AcceptRAConfig = {
UseDomains = true;
};
linkConfig = {
RequiredForOnline = "yes";
systemd = {
network = {
enable = true;
wait-online.enable = false;
networks = {
"41-ether" = {
enable = true;
matchConfig = {
Type = "ether";
};
networkConfig = {
DHCP = "yes";
};
dhcpV4Config = {
UseDomains = true;
};
ipv6AcceptRAConfig = {
UseDomains = true;
};
linkConfig = {
RequiredForOnline = "yes";
};
};
};
};

View file

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

View file

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

View file

@ -18,6 +18,7 @@ let cfg = config.nodeconfig; in {
nixos.enable = lib.mkDefault false;
};
fonts.fontconfig.enable = lib.mkDefault false;
programs.command-not-found.enable = lib.mkDefault false;
xdg = {
@ -25,6 +26,7 @@ let cfg = config.nodeconfig; in {
icons.enable = lib.mkDefault false;
mime.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
'';
};
};
}