162 lines
3.8 KiB
Nix
162 lines
3.8 KiB
Nix
{
|
|
description = "Flake for server muffin";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
|
|
|
lanzaboote = {
|
|
url = "github:nix-community/lanzaboote";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
|
|
|
nix-minecraft = {
|
|
url = "github:Infinidoge/nix-minecraft";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
vpn-confinement.url = "github:Maroka-chan/VPN-Confinement";
|
|
|
|
nixpkgs-qbt.url = "github:NixOS/nixpkgs/pull/287923/head";
|
|
|
|
home-manager = {
|
|
url = "github:nix-community/home-manager/release-24.11";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
disko = {
|
|
url = "github:nix-community/disko";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs =
|
|
{
|
|
nixpkgs,
|
|
nix-minecraft,
|
|
nixos-hardware,
|
|
vpn-confinement,
|
|
nixpkgs-qbt,
|
|
home-manager,
|
|
lanzaboote,
|
|
disko,
|
|
...
|
|
}@inputs:
|
|
let
|
|
username = "primary";
|
|
hostname = "muffin";
|
|
eth_interface = "enp4s0";
|
|
|
|
service_configs = rec {
|
|
zpool = "tank";
|
|
hdd_path = "/mnt/hdd";
|
|
services_dir = "/tank/services";
|
|
torrent_group = "media";
|
|
|
|
# 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;
|
|
owntracks = 3825;
|
|
gitea = 2283;
|
|
immich = 2284;
|
|
};
|
|
|
|
https = {
|
|
certs = services_dir + "/http_certs";
|
|
data_dir = services_dir + "/http";
|
|
domain = "gardling.com";
|
|
wg_ip = "192.168.15.1";
|
|
matrix_hostname = "matrix.${service_configs.https.domain}";
|
|
};
|
|
|
|
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";
|
|
};
|
|
|
|
owntracks = {
|
|
data_dir = "/tank/services/owntracks";
|
|
};
|
|
};
|
|
in
|
|
{
|
|
nixosConfigurations.${hostname} = nixpkgs.lib.nixosSystem {
|
|
specialArgs = {
|
|
inherit
|
|
username
|
|
hostname
|
|
eth_interface
|
|
service_configs
|
|
inputs
|
|
;
|
|
};
|
|
modules =
|
|
[
|
|
./disk-config.nix
|
|
disko.nixosModules.disko
|
|
./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 ];
|
|
}
|
|
|
|
lanzaboote.nixosModules.lanzaboote
|
|
|
|
home-manager.nixosModules.home-manager
|
|
(
|
|
{
|
|
pkgs,
|
|
username,
|
|
home-manager,
|
|
stateVersion,
|
|
...
|
|
}:
|
|
{
|
|
home-manager.users.${username} = import ./home.nix;
|
|
}
|
|
)
|
|
]
|
|
++ (with nixos-hardware.nixosModules; [
|
|
common-cpu-amd-pstate
|
|
common-cpu-amd-zenpower
|
|
common-pc-ssd
|
|
common-gpu-intel
|
|
]);
|
|
};
|
|
};
|
|
}
|