{ description = "Flake for server muffin"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixos-hardware.url = "github:NixOS/nixos-hardware/master"; nix-minecraft.url = "github:Infinidoge/nix-minecraft"; nix-minecraft.inputs.nixpkgs.follows = "nixpkgs"; vpn-confinement.url = "github:Maroka-chan/VPN-Confinement"; nixpkgs-qbt.url = "github:NixOS/nixpkgs/pull/287923/head"; }; outputs = { nixpkgs, nix-minecraft, nixos-hardware, vpn-confinement, nixpkgs-qbt, ... }@inputs: let username = "primary"; hostname = "muffin"; eth_interface = "enp3s0"; service_configs = rec { hdd_path = "/mnt/hdd"; services_dir = "/tank/services"; # TODO: add checks to make sure none of these collide ports = { https = 443; jellyfin = 8096; # no services.jellyfin option for this torrent = 6011; ollama = 11434; bitmagnet = 3333; }; https = { certs = services_dir + "/http_certs"; data_dir = services_dir + "/http"; domain = "gardling.com"; wg_ip = "192.168.15.1"; }; gitea = { dir = services_dir + "/gitea"; domain = "git.${https.domain}"; }; postgres = { socket = "/run/postgresql"; }; immich = { dir = services_dir + "/immich"; }; minecraft = { parent_dir = services_dir + "/minecraft"; server_name = "main"; }; torrent = { SavePath = hdd_path + "/torrents"; TempPath = hdd_path + "/torrents/incomplete"; }; jellyfin = { dir = services_dir + "/jellyfin"; }; }; in { nixosConfigurations.${hostname} = nixpkgs.lib.nixosSystem { specialArgs = { inherit username hostname eth_interface service_configs inputs ; }; modules = [ ./configuration.nix vpn-confinement.nixosModules.default # import the `services.qbittorrent` module (nixpkgs-qbt + "/nixos/modules/services/torrent/qbittorrent.nix") # get nix-minecraft working! nix-minecraft.nixosModules.minecraft-servers { nixpkgs.overlays = [ nix-minecraft.overlay ]; } ] ++ (with nixos-hardware.nixosModules; [ common-cpu-amd-pstate common-cpu-amd-zenpower common-pc-ssd common-gpu-intel ]); }; }; }