Add fudo-pkgs submodule
This commit is contained in:
+12
-6
@@ -185,11 +185,11 @@ in {
|
||||
|
||||
# Necessary to ensure that Kerberos and Avahi both work. Kerberos needs
|
||||
# the fqdn of the host, whereas Avahi wants just the simple hostname.`
|
||||
hosts = {
|
||||
"127.0.0.2" = [ "${hostname}.${domain-name}" "${hostname}" ];
|
||||
"127.0.0.1" = [ "${hostname}.${domain-name}" "${hostname}" ];
|
||||
"::1" = [ "${hostname}.${domain-name}" "${hostname}" ];
|
||||
};
|
||||
# hosts = {
|
||||
# "127.0.0.2" = mkForce [ "${hostname}.${domain-name}" "${hostname}" ];
|
||||
# "127.0.0.1" = mkForce [ "${hostname}.${domain-name}" "${hostname}" ];
|
||||
# "::1" = mkForce [ "${hostname}.${domain-name}" "${hostname}" ];
|
||||
# };
|
||||
|
||||
firewall = {
|
||||
enable = (length host-cfg.external-interfaces) > 0;
|
||||
@@ -197,11 +197,17 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
environment.etc.hosts = mkForce {
|
||||
# NixOS generates a stupid hosts file, just force it
|
||||
environment.etc.hosts = let
|
||||
host-entries = mapAttrsToList
|
||||
(ip: hostnames: "${ip} ${concatStringsSep " " hostnames}")
|
||||
config.fudo.system.hostfile-entries;
|
||||
in mkForce {
|
||||
text = ''
|
||||
127.0.0.1 ${hostname}.${domain-name} ${hostname} localhost
|
||||
127.0.0.2 ${hostname} localhost
|
||||
::1 ${hostname}.${domain-name} ${hostname} localhost
|
||||
${concatStringsSep "\n" host-entries}
|
||||
'';
|
||||
user = "root";
|
||||
group = "root";
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{ lib, config, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.fudo.local-network;
|
||||
|
||||
@@ -88,12 +87,12 @@ in {
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
networking.hosts = let
|
||||
fudo.system.hostfile-entries = let
|
||||
other-hosts = filterAttrs
|
||||
(hostname: hostOpts: hostname != config.instance.hostname)
|
||||
cfg.network-definition.hosts;
|
||||
in mapAttrs'
|
||||
(hostname: hostOpts: nameValuePair hostOpts.ipv4-address ["${hostname}.${cfg.domain}" hostname])
|
||||
in mapAttrs' (hostname: hostOpts:
|
||||
nameValuePair hostOpts.ipv4-address ["${hostname}.${cfg.domain}" hostname])
|
||||
other-hosts;
|
||||
|
||||
services.dhcpd4 = let network = cfg.network-definition;
|
||||
|
||||
@@ -38,6 +38,16 @@ in {
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# DO THIS MANUALLY since NixOS sux at making a reasonable /etc/hosts
|
||||
hostfile-entries = mkOption {
|
||||
type = attrsOf (listOf str);
|
||||
description = "Map of extra IP addresses to hostnames for /etc/hosts";
|
||||
default = {};
|
||||
example = {
|
||||
"10.0.0.3" = [ "my-host" "my-host.my.domain" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (cfg.internal-port-map != { }) {
|
||||
|
||||
@@ -25,6 +25,9 @@ let
|
||||
config.fudo.groups;
|
||||
|
||||
in {
|
||||
local-host = local-host;
|
||||
local-domain = local-domain;
|
||||
local-site = local-site;
|
||||
local-users = local-users;
|
||||
local-admins = local-admins;
|
||||
local-groups = local-groups;
|
||||
|
||||
Reference in New Issue
Block a user