2021-05-30 19:10:28 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
2022-08-13 20:59:05 +00:00
|
|
|
let cfg = config.pub-solar.core;
|
2021-05-30 19:10:28 +00:00
|
|
|
in
|
|
|
|
{
|
2022-08-13 20:59:05 +00:00
|
|
|
options.pub-solar.core = {
|
2021-05-30 19:10:28 +00:00
|
|
|
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;
|
2022-02-14 09:50:34 +00:00
|
|
|
description = "Configuration of iNet Wireless Daemon.";
|
2021-05-30 19:10:28 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
config = {
|
2022-08-24 16:19:03 +00:00
|
|
|
# disable NetworkManager-wait-online by default
|
|
|
|
systemd.services.NetworkManager-wait-online.enable = lib.mkDefault false;
|
|
|
|
|
2021-05-30 19:10:28 +00:00
|
|
|
networking.networkmanager = {
|
|
|
|
# Enable networkmanager. REMEMBER to add yourself to group in order to use nm related stuff.
|
|
|
|
enable = true;
|
2022-05-17 22:30:24 +00:00
|
|
|
wifi.backend = "iwd";
|
2021-05-30 19:10:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# 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 = {
|
2022-08-10 20:32:27 +00:00
|
|
|
"127.0.0.1" = [ "cups.local" "help.local" "caddy.local" ];
|
2021-05-30 19:10:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# Caddy reverse proxy for local services like cups
|
|
|
|
services.caddy = {
|
|
|
|
enable = true;
|
2022-06-02 08:09:42 +00:00
|
|
|
globalConfig = ''
|
2022-08-10 20:32:27 +00:00
|
|
|
default_bind 127.0.0.1
|
2022-06-02 08:09:42 +00:00
|
|
|
auto_https off
|
|
|
|
'';
|
|
|
|
extraConfig = ''
|
2022-08-10 20:32:27 +00:00
|
|
|
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
|
|
|
|
}
|
2021-05-30 19:10:28 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|