Summary Files Commits Branches @commit @diff @stats
path: root / machines / uttu
diff options
context:
space:
mode:
Commit4a93734a74aaefa2f85c9a5483d1668483209267 (patch)
Author
 Syndamia <kamen@syndamia.com>
2026-01-24 23:39:28 +0200
Committer
 Syndamia <kamen@syndamia.com>
2026-01-24 23:39:28 +0200
Files0f6c1caf2f0f13d56baeaedb4796f003490be7dd /machines/uttu
nix-4a93734a74aaefa2f85c9a5483d1668483209267.tar
nix-4a93734a74aaefa2f85c9a5483d1668483209267.tar.gz
nix-4a93734a74aaefa2f85c9a5483d1668483209267.zip
Parent705da9ba2e25fad5f680896f50307f3373d621e2 (diff)
feat(machines)!: Split duties between marduk and uttu
2 files changed, 58 insertions, 37 deletions
-rw-r--r--machines/uttu/configuration.nix89
-rw-r--r--machines/uttu/httpd.nix6
diff --git a/machines/uttu/configuration.nix b/machines/uttu/configuration.nix
index 7d18b3d..e3a1d5c 100644
--- a/machines/uttu/configuration.nix
+++ b/machines/uttu/configuration.nix
@@ -1,44 +1,67 @@
# This is device is meant to be a home, LOCAL ONLY server!
# The configurations you will find are woefully insecure and hard-coded.
-{ lib, ... }: {
+{ config, lib, ... }: {
imports = [
./httpd.nix
];
- options = {
- constants = lib.mkOption {
- type = lib.types.attrs;
+ srv = {
+ static = {
+ ip = "192.168.0.10";
+ interface = "enp1s0";
};
+ # This is actually a fantastic TLD. Very few sites use it, you may
+ # consider it as an abbreviation of "internal" and is one of the
+ # "original" gTLDs, introduced in 1988, so every device will always
+ # work with it.
+ tld = "int";
};
- config = rec {
- constants = {
- # I've currently set this IP in my router configuration.
- # It would be better to write a proper static IP NixOS config, but its
- # fine like that.
- ip = "192.168.0.11";
- # This is actually a fantastic TLD. Very few sites use it, you may
- # consider it as an abbreviation of "internal" and is one of the
- # "original" gTLDs, introduced in 1988, so every device will always
- # work with it.
- tld = "int";
- };
-
- # This improves SSH speed via server.int
- # The main problem is that when SSH-ing with server.int, the domain is
- # queried, however DNS resolution doesn't happen through dnsmasq but
- # through the nss hosts, which causes ~20 seconds of delay.
- # Now we're first checking /etc/hosts and then the databases listed.
- networking.hosts = {
- ${constants.ip} = [ "server.int" ];
- };
- system.nssDatabases.hosts = lib.mkForce [
- "files"
- "mymachines"
- "mdns4_minimal"
- "[NOTFOUND=return]"
- "myhostname"
- "dns"
- ];
+ # This improves SSH speed via server.int
+ # The main problem is that when SSH-ing with server.int, the domain is
+ # queried, however DNS resolution doesn't happen through dnsmasq but
+ # through the nss hosts, which causes ~20 seconds of delay.
+ # Now we're first checking /etc/hosts and then the databases listed.
+ networking.hosts = {
+ ${config.srv.static.ip} = [ "${config.networking.hostName}.${config.srv.tld}" ];
};
+ system.nssDatabases.hosts = lib.mkForce [
+ "files"
+ "mymachines"
+ "mdns4_minimal"
+ "[NOTFOUND=return]"
+ "myhostname"
+ "dns"
+ ];
+
+ # Redirect all domains, defined by marduk, to marduk
+ services.dnsmasq.settings.address = let
+ configurationPath = ../marduk/configuration.nix;
+
+ importModule = path:
+ let
+ module = import path;
+ in
+ if builtins.isFunction module
+ then module { config = {}; lib = {}; pkgs = {}; }
+ else module;
+
+ inherit (importModule configurationPath) srv;
+
+ extractAttrs = moduleImport:
+ let
+ module = importModule moduleImport;
+ in
+ (module.srv.slds or []) ++
+ (builtins.foldl'
+ (acc: x:
+ acc ++ extractAttrs x)
+ []
+ (module.imports or []));
+
+ slds = extractAttrs configurationPath;
+ in
+ builtins.map
+ (sld: "/${sld}.${srv.tld}/${srv.static.ip}")
+ slds;
}
diff --git a/machines/uttu/httpd.nix b/machines/uttu/httpd.nix
index eb6d8af..ca215d7 100644
--- a/machines/uttu/httpd.nix
+++ b/machines/uttu/httpd.nix
@@ -1,9 +1,7 @@
{ config, ... }: let
- inherit (config.constants) ip tld;
+ inherit (config.srv) tld;
in {
- services.dnsmasq.settings.address = [
- "/server.${tld}/ftp.${tld}/samba.${tld}/${ip}"
- ];
+ srv.slds = [ "server" "ftp" "samba" ];
services.httpd = {
virtualHosts = {