pub-solar-os/modules/core/networking.nix
Hendrik Sokolowski 57f608ecde
Disable NetworkManager-wait-online system service
This service is presumably useful for devices that need to ensure there
is an active internet connection before starting other systemd units.
This is neither the case for end-user devices as the an active internet
connection is only needed after login nor the case for server-like
systems as they normally have a static / dhcp-based network configuration
which does not require switchable network configuration profiles.
2022-08-24 21:47:58 +02:00

64 lines
1.6 KiB
Nix

{ config, pkgs, lib, ... }:
with lib;
let cfg = config.pub-solar.core;
in
{
options.pub-solar.core = {
binaryCaches = mkOption {
type = types.listOf types.str;
default = [ ];
description = "Binary caches to use.";
};
publicKeys = mkOption {
type = types.listOf types.str;
default = [ ];
description = "Public keys of binary caches.";
};
iwdConfig = mkOption {
type = with types; nullOr (attrsOf (attrsOf (oneOf [ bool int str ])));
default = null;
description = "Configuratoin of iNet Wireless Daemon.";
};
};
config = {
# disable NetworkManager-wait-online by default
systemd.services.NetworkManager-wait-online.enable = lib.mkDefault false;
networking.networkmanager = {
# Enable networkmanager. REMEMBER to add yourself to group in order to use nm related stuff.
enable = true;
};
# Customized binary caches list (with fallback to official binary cache)
nix.binaryCaches = cfg.binaryCaches;
nix.binaryCachePublicKeys = cfg.publicKeys;
# These entries get added to /etc/hosts
networking.hosts = {
"127.0.0.1" = [ "cups.local" "help.local" "caddy.local" ];
};
# Caddy reverse proxy for local services like cups
services.caddy = {
enable = true;
globalConfig = ''
default_bind 127.0.0.1
auto_https off
'';
extraConfig = ''
cups.local:80 {
request_header Host localhost:631
reverse_proxy unix//run/cups/cups.sock
}
help.local:80 {
root * ${pkgs.psos-docs}/lib/html
file_server
}
'';
};
};
}