From 4772a085ae9c6360b873c057a7d84aad3f801e1c Mon Sep 17 00:00:00 2001 From: k3t Date: Fri, 4 Sep 2026 15:42:35 -0600 Subject: [PATCH] rename a few things, add minizen host, rebase with other changes --- flake.nix | 65 ++++++------------- hosts/minizen/configuration.nix | 45 +++++++++++++ hosts/minizen/hardware-configuration.nix | 26 ++++++++ hosts/minizen/services.d/dns.nix | 64 ++++++++++++++++++ hosts/minizen/services.d/gonic.nix | 25 +++++++ hosts/minizen/services.d/minecraft.nix | 20 ++++++ hosts/minizen/services.d/nginx.nix | 17 +++++ .../{tbb-btrfs.nix => btrfs-with-subvols.nix} | 0 8 files changed, 218 insertions(+), 44 deletions(-) create mode 100644 hosts/minizen/configuration.nix create mode 100644 hosts/minizen/hardware-configuration.nix create mode 100644 hosts/minizen/services.d/dns.nix create mode 100644 hosts/minizen/services.d/gonic.nix create mode 100644 hosts/minizen/services.d/minecraft.nix create mode 100644 hosts/minizen/services.d/nginx.nix rename modules/sys/fs/mounts/btrfs/{tbb-btrfs.nix => btrfs-with-subvols.nix} (100%) diff --git a/flake.nix b/flake.nix index 5dbb307..6bb9637 100644 --- a/flake.nix +++ b/flake.nix @@ -42,19 +42,6 @@ in { nixosConfigurations = { - # repurposed for use as nas - #"TheBlackBox" = mkHost "x86_64-linux" [ - # ./modules/common.nix - # ./modules/desktop-common.nix - # ./hosts/desktop/configuration.nix - # spicetify-nix.nixosModules.spicetify - # home-manager.nixosModules.home-manager - # { - # home-manager.useGlobalPkgs = true; - # home-manager.useUserPackages = true; - # home-manager.users.k3t = ./home/desktop.nix; - # } - #]; "TheBlackBox" = mkHost "x86_64-linux" [ ./modules/audio/base.nix ./modules/audio/zeroconf.nix @@ -87,14 +74,20 @@ ./modules/sys/fs/btrfs.nix ./modules/sys/fs/mounts/efi.nix - ./modules/sys/fs/mounts/btrfs/tbb-btrfs.nix + ./modules/sys/fs/mounts/btrfs/btrfs-with-subvols.nix ./modules/sys/fs/mounts/swap.nix ./modules/sys/hw/boot.nix ./modules/sys/hw/libinput.nix +<<<<<<< HEAD ./modules/sys/hw/cpu/amd64.nix ./modules/sys/hw/gpu/nvidia.nix ./modules/sys/hw/gpu/vmware.nix +======= + ./modules/sys/hw/cpu/intel.nix + ./modules/sys/hw/gpu/nvidia.nix + +>>>>>>> 29fc11b (whole lotta changes, check individual files) ./modules/sys/hw/input/keyboard.nix ./modules/sys/hw/input/tablet.nix ./modules/sys/hw/input/xbox.nix @@ -105,7 +98,6 @@ ./modules/sys/pkgs.nix ./modules/sys/rc/openssh.nix ./modules/sys/rc/sunshine.nix - ./modules/sys/rc/synergy.nix ./modules/sys/rgb.nix ./modules/sys/security.nix @@ -175,60 +167,45 @@ ./hosts/IdeaPad/configuration.nix ]; - "htpc" = mkHost "x86_64-linux" [ + "minizen" = mkHost "x86_64-linux" [ + ./modules/audio/base.nix ./modules/audio/zeroconf.nix - ./modules/bluetooth/desktop.nix - ./modules/de/kde.nix - ./modules/de/i3.nix - ./modules/desktop-common.nix - - ./modules/gui/services/fcast.nix - ./modules/gui/apps/firefox.nix - ./modules/gui/apps/spicetify.nix - ./modules/gui/apps/steam.nix - ./modules/gui/fonts.nix - ./modules/gui/services/flatpak.nix - ./modules/gui/services/kdeconnect.nix - ./modules/gui/services/kwallet.nix - ./modules/gui/services/xdg.nix - - ./modules/net/services/avahi.nix ./modules/net/services/fail2ban.nix ./modules/net/services/networkmanager.nix - ./modules/net/services/printing.nix ./modules/net/services/tailscale.nix - ./modules/sys/compat.nix ./modules/sys/firewall.nix + ./modules/sys/fs/btrfs.nix + ./modules/sys/fs/mounts/efi.nix + ./modules/sys/fs/mounts/btrfs/btrfs-with-subvols.nix + ./modules/sys/fs/mounts/swap.nix + ./modules/sys/hw/boot.nix - ./modules/sys/hw/cpu/amd64.nix - ./modules/sys/hw/gpu/amd.nix + ./modules/sys/hw/cpu/arm64.nix ./modules/sys/nix.nix ./modules/sys/perf.nix ./modules/sys/pkgs.nix ./modules/sys/rc/openssh.nix - ./modules/sys/rc/synergy.nix - ./modules/sys/rc/sunshine.nix - ./modules/sys/rgb.nix ./modules/sys/security.nix ./modules/sys/shell.nix ./modules/sys/stateversion.nix ./modules/sys/sysctl.nix ./modules/sys/time.nix ./modules/sys/users/k3t.nix - - ./hosts/htpc/configuration.nix - spicetify-nix.nixosModules.spicetify + ./hosts/minizen/configuration.nix home-manager.nixosModules.home-manager + { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.users.k3t = ./home/desktop.nix; + home-manager.users.k3t = ./home/server.nix; } ]; + }; + "ThinkPad" = mkHost "x86_64-linux" [ ./modules/audio/base.nix ./modules/audio/zeroconf.nix @@ -261,7 +238,7 @@ ./modules/sys/fs/btrfs.nix ./modules/sys/fs/mounts/efi.nix - ./modules/sys/fs/mounts/btrfs/tbb-btrfs.nix + ./modules/sys/fs/mounts/btrfs/btrfs-with-subvols.nix ./modules/sys/fs/mounts/swap.nix diff --git a/hosts/minizen/configuration.nix b/hosts/minizen/configuration.nix new file mode 100644 index 0000000..d325d97 --- /dev/null +++ b/hosts/minizen/configuration.nix @@ -0,0 +1,45 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page, on +# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). + +{ config, lib, pkgs, inputs, ... }: + +{ + imports = + (lib.filesystem.listFilesRecursive ./services.d) + ++ [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + networking.hostName = "minizen"; # Define your hostname. + + # podman + virtualisation.podman = { + enable = true; + autoPrune.enable = true; + dockerCompat = true; # optional; lets you use `docker` CLI + }; + virtualisation.oci-containers.backend = "podman"; + + # Enable container name DNS for all Podman networks. + networking.firewall.interfaces = let + matchAll = if !config.networking.nftables.enable then "podman+" else "podman*"; + in { + "${matchAll}".allowedUDPPorts = [ 53 ]; + }; + + # List packages installed in system profile. + # You can use https://search.nixos.org/ to find more packages (and options). + environment.systemPackages = with pkgs; [ + waypipe + ]; + + # Open ports in the firewall. + networking.firewall.allowedTCPPorts = [ 80 443 25565 4433 9971 853 ]; + networking.firewall.allowedUDPPorts = [ 443 24454 4433 9971 ]; + + # Copy the NixOS configuration file and link it from the resulting system + # (/run/current-system/configuration.nix). This is useful in case you + # accidentally delete configuration.nix. + # system.copySystemConfiguration = true; +} diff --git a/hosts/minizen/hardware-configuration.nix b/hosts/minizen/hardware-configuration.nix new file mode 100644 index 0000000..35079c6 --- /dev/null +++ b/hosts/minizen/hardware-configuration.nix @@ -0,0 +1,26 @@ +# 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 + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "virtio_pci" "virtio_scsi" "usbhid" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp7s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/hosts/minizen/services.d/dns.nix b/hosts/minizen/services.d/dns.nix new file mode 100644 index 0000000..78dfde9 --- /dev/null +++ b/hosts/minizen/services.d/dns.nix @@ -0,0 +1,64 @@ +{ config, lib, pkgs, ... }: + +{ + services.blocky = { + enable = true; + settings = { + certFile = "/etc/nixos/dns.crt"; + keyFile = "/etc/nixos/dns.key"; + caching = { + minTime = "5m"; + maxTime = "30m"; + prefetching = true; + }; + ports = { + dns = 5353; + tls = 853; + http = 4000; + }; + + upstreams.groups.default = [ + "https://dns.quad9.net/dns-query" + ]; + # For initially solving DoH/DoT Requests when no system Resolver is available. + bootstrapDns = { + upstream = "https://dns.quad9.net/dns-query"; + ips = [ "9.9.9.9" "1.1.1.1" ]; + }; + + #Enable Blocking of certain domains. + blocking = { + loading.refreshPeriod = "1h"; + denylists = { + ads = [ + "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" + "https://v.firebog.net/hosts/AdguardDNS.txt" + "https://v.firebog.net/hosts/Admiral.txt" + "https://raw.githubusercontent.com/anudeepND/blacklist/master/adservers.txt" + "https://raw.githubusercontent.com/FadeMind/hosts.extras/master/UncheckyAds/hosts" + ]; + tracking = [ + "https://v.firebog.net/hosts/Easyprivacy.txt" + "https://v.firebog.net/hosts/Prigent-Ads.txt" + "https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt" + "https://hostfiles.frogeye.fr/firstparty-trackers-hosts.txt" + "https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.2o7Net/hosts" + ]; + sus = [ + "https://someonewhocares.org/hosts/zero/hosts" + "https://raw.githubusercontent.com/RooneyMcNibNug/pihole-stuff/master/SNAFU.txt" + "https://raw.githubusercontent.com/matomo-org/referrer-spam-blacklist/master/spammers.txt" + "https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Spam/hosts" + "https://raw.githubusercontent.com/PolishFiltersTeam/KADhosts/master/KADhosts.txt" + "https://raw.githubusercontent.com/matomo-org/referrer-spam-blacklist/master/spammers.txt" + ]; + }; + + #Configure what block categories are used + clientGroupsBlock = { + default = [ "ads" "tracking" "sus" ]; + }; + }; + }; + }; +} \ No newline at end of file diff --git a/hosts/minizen/services.d/gonic.nix b/hosts/minizen/services.d/gonic.nix new file mode 100644 index 0000000..ce637ae --- /dev/null +++ b/hosts/minizen/services.d/gonic.nix @@ -0,0 +1,25 @@ +{ config, lib, pkgs, ... }: + + +{ + services.gonic = { + enable = true; + settings = { + music-path = [ + "/home/k3t/Music" + ]; + playlists-path = "/home/k3t/Playlists"; + podcast-path = "/home/k3t/Podcasts"; + }; + }; + + services.nginx.virtualHosts."fckurspotify.lostin06.duckdns.org" = { + enableACME = true; + forceSSL = true; + locations."/" = { + proxyPass = "http://127.0.0.1:4747"; + proxyWebsockets = true; + recommendedProxySettings = true; + }; + }; +} \ No newline at end of file diff --git a/hosts/minizen/services.d/minecraft.nix b/hosts/minizen/services.d/minecraft.nix new file mode 100644 index 0000000..1fda7f5 --- /dev/null +++ b/hosts/minizen/services.d/minecraft.nix @@ -0,0 +1,20 @@ +{ config, pkgs, lib, ... }: + +{ + virtualisation.oci-containers.containers."minecraft-server" = { + image = "ghcr.io/graalvm/graalvm-community:25"; + volumes = [ + "/var/lib/minecraft:/data:rw" + ]; + ports = [ + "25565:25565/tcp" + "24454:24454/udp" + ]; + extraOptions = [ + "--tty" + "--interactive" + ]; + entrypoint = "/data/run.sh"; + log-driver = "journald"; + }; +} diff --git a/hosts/minizen/services.d/nginx.nix b/hosts/minizen/services.d/nginx.nix new file mode 100644 index 0000000..33a272b --- /dev/null +++ b/hosts/minizen/services.d/nginx.nix @@ -0,0 +1,17 @@ +{ config, lib, pkgs, ... }: + + +{ + services.nginx = { + enable = true; + recommendedGzipSettings = true; + recommendedOptimisation = true; + recommendedProxySettings = true; + recommendedTlsSettings = true; + }; + + security.acme = { + acceptTerms = true; + defaults.email = "k3t@k3t.dev"; + }; +} diff --git a/modules/sys/fs/mounts/btrfs/tbb-btrfs.nix b/modules/sys/fs/mounts/btrfs/btrfs-with-subvols.nix similarity index 100% rename from modules/sys/fs/mounts/btrfs/tbb-btrfs.nix rename to modules/sys/fs/mounts/btrfs/btrfs-with-subvols.nix