diff options
| Commit | 705da9ba2e25fad5f680896f50307f3373d621e2 (patch) | |
|---|---|---|
| Author | 2026-01-24 15:32:45 +0200 | |
| Committer | 2026-01-24 15:32:45 +0200 | |
| Files | c55547f39fb2dd92112ebf8aa3de4ee0848d16c9 | |
| nix-705da9ba2e25fad5f680896f50307f3373d621e2.tar nix-705da9ba2e25fad5f680896f50307f3373d621e2.tar.gz nix-705da9ba2e25fad5f680896f50307f3373d621e2.zip | ||
| Parent | ffb894c8b173eb65db9496243521382b54a525c3 (diff) | |
feat(machines): Add uttu machine
4 files changed, 129 insertions, 0 deletions
| -rw-r--r-- | machines/uttu/configuration.nix | 44 | ||||
| -rw-r--r-- | machines/uttu/hardware-configuration.nix | 38 | ||||
| -rw-r--r-- | machines/uttu/httpd.nix | 40 | ||||
| -rw-r--r-- | machines/uttu/sysidentity.nix | 7 |
diff --git a/machines/uttu/configuration.nix b/machines/uttu/configuration.nix new file mode 100644 index 0000000..7d18b3d --- /dev/null +++ b/machines/uttu/configuration.nix @@ -0,0 +1,44 @@ +# This is device is meant to be a home, LOCAL ONLY server! +# The configurations you will find are woefully insecure and hard-coded. +{ lib, ... }: { + imports = [ + ./httpd.nix + ]; + + options = { + constants = lib.mkOption { + type = lib.types.attrs; + }; + }; + + 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" + ]; + }; +} diff --git a/machines/uttu/hardware-configuration.nix b/machines/uttu/hardware-configuration.nix new file mode 100644 index 0000000..ad13257 --- /dev/null +++ b/machines/uttu/hardware-configuration.nix @@ -0,0 +1,38 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "ehci_pci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/9be5ebbf-03d8-480a-bd36-3e31cfaff6e1"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/82BD-DBE0"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/machines/uttu/httpd.nix b/machines/uttu/httpd.nix new file mode 100644 index 0000000..eb6d8af --- /dev/null +++ b/machines/uttu/httpd.nix @@ -0,0 +1,40 @@ +{ config, ... }: let + inherit (config.constants) ip tld; +in { + services.dnsmasq.settings.address = [ + "/server.${tld}/ftp.${tld}/samba.${tld}/${ip}" + ]; + + services.httpd = { + virtualHosts = { + "server.${tld}" = { + listen = [ { port = 80; } ]; + documentRoot = "/var/www/server"; + locations."/server-status".extraConfig = '' + SetHandler server-status + ''; + }; + + #== File servers ==# + + "samba.${tld}" = rec { + listen = [ { port = 80; } ]; + documentRoot = "/NetworkDirectory"; + extraConfig = '' + <Directory "${documentRoot}"> + IndexOptions +NameWidth=* +Charset=UTF-8 + </Directory> + ''; + }; + "ftp.${tld}" = rec { + listen = [ { port = 80; } ]; + documentRoot = "/home/ftp"; + extraConfig = '' + <Directory "${documentRoot}"> + IndexOptions +NameWidth=* +Charset=UTF-8 + </Directory> + ''; + }; + }; + }; +} diff --git a/machines/uttu/sysidentity.nix b/machines/uttu/sysidentity.nix new file mode 100644 index 0000000..8670fd5 --- /dev/null +++ b/machines/uttu/sysidentity.nix @@ -0,0 +1,7 @@ +groups: { + name = "uttu"; + arch = "x86_64-linux"; + kind = "server"; + + include = groups.home-server; +} |
