Skip to content

Commit d27f285

Browse files
committed
Restructure deployment naming scheme
The deployments now get their names from the NATO phonetic alphabet. Deployment sites get greek letters as names, though don't need to be in order.
1 parent 74c5d09 commit d27f285

File tree

6 files changed

+316
-17
lines changed

6 files changed

+316
-17
lines changed

flake.lock

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,34 @@
1+
# . _ ___ _
2+
# ___|_|_ _ ___ ___ ___| _|_|___
3+
# | | |_|_| | _| . | | _| | . |
4+
# |_|_|_|_|_| |___|___|_|_|_| |_|_ |
5+
# . |___|
6+
# ──────────────────────────────────────────────────────────────────────────────
7+
# A central flake for deploying all nix-based systems across multiple sites.
8+
19
{
2-
description = "This flake manages all my nix machines.";
10+
description = "Central flake for managing all nix deployments.";
311

412
inputs = {
513
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
614
sops-nix.url = "github:Mic92/sops-nix";
715
nix-minecraft.url = "github:Infinidoge/nix-minecraft";
816
};
917

10-
outputs =
11-
inputs@{ self, nixpkgs, ... }:
18+
outputs = inputs@{ self, nixpkgs, ... }:
1219
let
1320
system = "x86_64-linux";
1421
pkgs = nixpkgs.legacyPackages.${system};
15-
in
16-
{
22+
in {
1723
# The itx server hosting most of my homelab.
1824
nixosConfigurations.itxserver = nixpkgs.lib.nixosSystem {
1925
specialArgs = { inherit inputs; };
2026
modules = [ ./hosts/itxserver/configuration.nix ];
2127
};
28+
29+
nixosConfigurations.alfa = nixpkgs.lib.nixosSystem {
30+
specialArgs = { inherit inputs; };
31+
modules = [ ./hosts/s-alfa/default.nix ];
32+
};
2233
};
2334
}

hosts/common.nix

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# . _ _
2+
# ___ ___ _____ _____ ___ ___ ___ ___| |_|_|___ ___ ___
3+
# | _| . | | | . | | | . | . | _| | . | |_ -|
4+
# |___|___|_|_|_|_|_|_|___|_|_| |___| _| | |_|___|_|_|___|
5+
# . |_| |__|
6+
# ──────────────────────────────────────────────────────────────────────────────
7+
# Defines options that are common across all host systems, be that servers or
8+
# clients.
9+
10+
{ pkgs, ... }: {
11+
# This is the default locale for any machine
12+
i18n.defaultLocale = "en_US.UTF-8";
13+
14+
# Common nix settings that apply to all machines
15+
nix = {
16+
settings = {
17+
experimental-features = [ "nix-command" "flakes" ];
18+
auto-optimise-store = true;
19+
};
20+
gc = {
21+
automatic = true;
22+
dates = "weekly";
23+
options = "--delete-older-than 30d";
24+
};
25+
};
26+
27+
# Basic packages that are nice to have on any machine with any user
28+
environment.systemPackages = with pkgs; [
29+
bat
30+
btop
31+
curl
32+
fastfetch
33+
git
34+
nixfmt
35+
tmux
36+
tree
37+
vim
38+
wget
39+
];
40+
}

hosts/s-alfa/default.nix

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
# . _ ___
2+
# ___ ___ ___ _ _ ___ ___ __| | _| __
3+
# |_ -| -_| _| | | -_| _| |. | | _||. |
4+
# |___|___|_| \_/|___|_| |___|_|_| |___|
5+
# ──────────────────────────────────────────────────────────────────────────────
6+
# Defines the configuration for the central server ''alfa''. This server hosts
7+
# all the containerized services and holds all the data.
8+
9+
{ config, lib, pkgs, ... }@args:
10+
let inherit (args) inputs;
11+
in {
12+
imports = [
13+
# The hardware-dependent options:
14+
./hardware.nix
15+
# Common settings thath apply to all machines:
16+
../common.nix
17+
# Deployment-site specific options:
18+
../../sites/theta.nix
19+
# The users for this system:
20+
../../users/lukas.nix
21+
../../users/docker.nix
22+
# The custom modules:
23+
../../modules/containers/atuin.nix
24+
../../modules/containers/stump.nix
25+
../../modules/containers/homeassistant.nix
26+
../../modules/containers/plex.nix
27+
../../modules/containers/freshrss.nix
28+
../../modules/other/minecraft-server.nix
29+
# Any third-party modules or flakes:
30+
inputs.sops-nix.nixosModules.sops
31+
];
32+
33+
sops = {
34+
defaultSopsFormat = "dotenv";
35+
age.keyFile = "/home/lukas/.config/sops/age/keys.txt";
36+
secrets.syncthing-user = {
37+
sopsFile = ../../secrets/syncthing.env.enc;
38+
key = "user";
39+
};
40+
secrets.syncthing-password = {
41+
sopsFile = ../../secrets/syncthing.env.enc;
42+
key = "password";
43+
};
44+
};
45+
46+
boot = {
47+
loader.grub = {
48+
enable = true;
49+
zfsSupport = true;
50+
efiSupport = true;
51+
efiInstallAsRemovable = true;
52+
mirroredBoots = [{
53+
devices = [ "nodev" ];
54+
path = "/boot";
55+
}];
56+
};
57+
zfs.extraPools = [ "zpool" ];
58+
};
59+
60+
networking = {
61+
hostName = "alfa";
62+
hostId = "1A0B35B6";
63+
networkmanager = {
64+
enable = true;
65+
unmanaged = [ "eno1" ];
66+
};
67+
useDHCP = false;
68+
interfaces = {
69+
eno1.ipv4.addresses = [{
70+
address = "10.0.0.10";
71+
prefixLength = 24;
72+
}];
73+
};
74+
defaultGateway = { interface = "eno1"; };
75+
nameservers = [ "1.1.1.1" "1.0.0.1" "100.100.100.100" ];
76+
firewall = {
77+
allowedTCPPorts = [
78+
8123 # Home assistant web GUI
79+
8000
80+
8888
81+
32400 # Plex web GUI
82+
8384 # Syncthing web GUI
83+
22000 # Syncthing traffic
84+
];
85+
allowedUDPPorts = [
86+
22000 # Syncthing traffic
87+
21027 # Syncthing discovery
88+
];
89+
};
90+
search = [ "tabby-crocodile.ts.net" ];
91+
};
92+
93+
console = {
94+
font = "Lat2-Terminus16";
95+
useXkbConfig = true;
96+
};
97+
98+
environment.systemPackages = with pkgs; [
99+
compose2nix
100+
gcc
101+
gnumake
102+
sops
103+
tailscale
104+
];
105+
106+
services = {
107+
zfs = {
108+
autoScrub.enable = true;
109+
autoSnapshot.enable = true;
110+
};
111+
openssh = {
112+
enable = true;
113+
ports = [ 22 ];
114+
settings = {
115+
PasswordAuthentication = false;
116+
KbdInteractiveAuthentication = false;
117+
PermitRootLogin = "no";
118+
AllowUsers = [ "lukas" ];
119+
};
120+
};
121+
fail2ban = { enable = true; };
122+
envfs.enable = true;
123+
tailscale.enable = true;
124+
syncthing = {
125+
enable = true;
126+
group = "syncthing";
127+
user = "lukas";
128+
dataDir = "/home/lukas/sync";
129+
configDir = "/home/lukas/.config/syncthing";
130+
overrideDevices = true;
131+
overrideFolders = true;
132+
settings = {
133+
gui = {
134+
user = config.sops.secrets.syncthing-user;
135+
password = config.sops.secrets.syncthing-password;
136+
address = "0.0.0.0:8384";
137+
};
138+
devices = {
139+
"MacBook-Pro" = {
140+
id =
141+
"GZAKPGB-BBVIY5T-2D3EY22-YYMGT5L-R3MNHGX-GYWNRWR-TG4BUMW-BQMBBAU";
142+
};
143+
};
144+
folders = {
145+
"Mobile Backups" = {
146+
path = "/data/backups/lukas/phone";
147+
devices = [ "MacBook-Pro" ];
148+
};
149+
"Documents" = {
150+
path = "/data/backups/lukas/documents";
151+
devices = [ "MacBook-Pro" ];
152+
};
153+
"Picture Archive" = {
154+
path = "/data/pictures/lukas/archive";
155+
devices = [ "MacBook-Pro" ];
156+
};
157+
};
158+
};
159+
};
160+
};
161+
162+
programs = {
163+
zsh.enable = true;
164+
neovim.enable = true;
165+
neovim.defaultEditor = true;
166+
};
167+
168+
system.stateVersion = "25.05";
169+
}

hosts/s-alfa/hardware.nix

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
config,
3+
lib,
4+
pkgs,
5+
modulesPath,
6+
...
7+
}:
8+
{
9+
imports = [
10+
(modulesPath + "/installer/scan/not-detected.nix")
11+
];
12+
13+
boot.initrd.availableKernelModules = [
14+
"xhci_pci"
15+
"ahci"
16+
"nvme"
17+
"usbhid"
18+
"usb_storage"
19+
"sd_mod"
20+
];
21+
boot.initrd.kernelModules = [ ];
22+
boot.kernelModules = [ "kvm-intel" ];
23+
boot.extraModulePackages = [ ];
24+
25+
fileSystems."/" = {
26+
device = "zpool/root";
27+
fsType = "zfs";
28+
};
29+
30+
fileSystems."/nix" = {
31+
device = "zpool/nix";
32+
fsType = "zfs";
33+
};
34+
35+
fileSystems."/var" = {
36+
device = "zpool/var";
37+
fsType = "zfs";
38+
};
39+
40+
fileSystems."/home" = {
41+
device = "zpool/home";
42+
fsType = "zfs";
43+
};
44+
45+
fileSystems."/srv" = {
46+
device = "zpool/srv";
47+
fsType = "zfs";
48+
};
49+
50+
fileSystems."/boot" = {
51+
device = "/dev/disk/by-uuid/8BFB-9BC1";
52+
fsType = "vfat";
53+
options = [
54+
"fmask=0077"
55+
"dmask=0077"
56+
];
57+
};
58+
59+
swapDevices = [
60+
{ device = "/dev/disk/by-uuid/62f8f557-bc44-4545-8ac5-4f633ebb63a5"; }
61+
];
62+
63+
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
64+
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
65+
}

sites/theta.nix

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# . _ _ _ _ _
2+
# ___|_| |_ ___ | |_| |_ ___| |_ __
3+
# |_ -| | _| -_| | _| | -_| _||. |
4+
# |___|_| | |___| | | |_|_|___| | |___|
5+
# . |__| |__| |__|
6+
# ──────────────────────────────────────────────────────────────────────────────
7+
# Deployment site theta. This nix expression sets all site-related options.
8+
9+
{ ... }: {
10+
time.timeZone = "Europe/Berlin";
11+
12+
networking = { defaultGateway = { address = "10.0.0.1"; }; };
13+
}
14+

0 commit comments

Comments
 (0)