Skip to content

Commit c18b5b3

Browse files
Merge branch 'Vanderscycle:main' into main
2 parents e3e4e40 + ef5dd00 commit c18b5b3

File tree

8 files changed

+287
-16
lines changed

8 files changed

+287
-16
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
keys:
2+
- &primary age1df2u7xvze6rq5utz74ckx059wr3z97j484wc04063437h6hn4v6s9auec3
3+
creation_rules:
4+
- path_regex: secrets/.*\.yaml$
5+
key_groups:
6+
- age:
7+
- *primary
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# Edit this configuration file to define what should be installed on
2+
# your system. Help is available in the configuration.nix(5) man page, on
3+
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
4+
5+
{
6+
config,
7+
inputs,
8+
pkgs,
9+
meta,
10+
...
11+
}:
12+
13+
{
14+
imports = [
15+
./hardware-configuration.nix
16+
inputs.sops-nix.nixosModules.sops
17+
];
18+
19+
nix = {
20+
optimise.automatic = true;
21+
settings = {
22+
experimental-features = "nix-command flakes";
23+
};
24+
gc = {
25+
automatic = true;
26+
options = "--delete-older-than 14d";
27+
};
28+
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; # for nix.nix
29+
};
30+
31+
nixpkgs = {
32+
hostPlatform = "x86_64-linux";
33+
config.allowUnfree = true;
34+
};
35+
36+
# Use the systemd-boot EFI boot loader.
37+
boot.loader = {
38+
grub.enable = true;
39+
grub.device = "/dev/sda"; # Install GRUB to the MBR
40+
efi.canTouchEfiVariables = false; # Disable EFI settings since you're using legacy boot.
41+
};
42+
43+
# Set your time zone.
44+
time.timeZone = "America/Vancouver";
45+
46+
# Select internationalisation properties.
47+
i18n.defaultLocale = "en_US.UTF-8";
48+
console = {
49+
font = "Lat2-Terminus16";
50+
keyMap = "us";
51+
#useXkbConfig = true; # use xkb.options in tty.
52+
};
53+
54+
users.users.${meta.username} = {
55+
isNormalUser = true;
56+
extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
57+
packages = with pkgs; [
58+
tree
59+
];
60+
# Created using mkpasswd
61+
hashedPassword = "$6$NQrAUhx13piyrmgZ$GFNEe2v/1tbRO5M3806EWcsoHifN1GIIzhLz.hsVv8Ug3nKgLzP/PMm6MzAS.XRJwzfpdK28LdMLG9uIRtibn/";
62+
openssh.authorizedKeys.keys = [
63+
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMCpHZBybBTCsCyW6/Q4OZ07SvUpRUvclc10u25j0B+Q hvandersleyen@gmail.com"
64+
];
65+
};
66+
67+
environment.systemPackages = with pkgs; [
68+
sops
69+
git
70+
vim
71+
factorio-headless
72+
iptables
73+
];
74+
75+
sops = {
76+
defaultSopsFile = ./secrets/secrets.yaml;
77+
defaultSopsFormat = "yaml";
78+
79+
age.keyFile = "/home/${meta.username}/.config/sops/age/keys.txt";
80+
secrets = {
81+
"game-password" = {
82+
owner = meta.username;
83+
};
84+
"token" = {
85+
owner = meta.username;
86+
};
87+
"admin" = {
88+
owner = meta.username;
89+
};
90+
};
91+
};
92+
93+
# Enable the OpenSSH daemon.
94+
services.openssh.enable = true;
95+
systemd.tmpfiles.rules = [
96+
# Copy/Link the save file (use either C or L)
97+
"C /var/lib/factorio/saves/save1.zip - - - - ${builtins.path { path = ./save1.zip; }}"
98+
];
99+
services.factorio = {
100+
bind = "192.168.4.129";
101+
enable = true;
102+
public = true;
103+
username = builtins.readFile config.sops.secrets."admin".path;
104+
token = builtins.readFile config.sops.secrets."token".path;
105+
openFirewall = true;
106+
stateDirName = "factorio";
107+
extraSettingsFile = pkgs.writeText "server-settings.json" (
108+
builtins.toJSON {
109+
game-password = builtins.readFile config.sops.secrets."game-password".path;
110+
}
111+
);
112+
extraSettings = {
113+
max_players = 16;
114+
};
115+
autosave-interval = 20;
116+
# When not present in /var/lib/${config.services.factorio.stateDirName}/saves, a new map with default settings will be generated before starting the service.
117+
saveName = "save1";
118+
game-name = "[NixOs] factorio";
119+
description = "Factorio on nixos";
120+
admins = [
121+
(builtins.readFile config.sops.secrets."admin".path)
122+
];
123+
};
124+
125+
# networking
126+
networking = {
127+
defaultGateway = "192.168.4.1"; # Point to Proxmox
128+
nameservers = [ "192.168.1.1" ]; # Ensure DNS resolution
129+
hostName = meta.hostname; # Define your hostname.
130+
networkmanager.enable = true; # Easiest to use and most distros use this by default.
131+
firewall = {
132+
enable = false;
133+
allowedUDPPorts = [ 34197 ]; # Explicitly open Factorio port
134+
allowedTCPPorts = [ 27015 ];
135+
};
136+
};
137+
# Configure network proxy if necessary
138+
# networking.proxy.default = "http://user:password@proxy:port/";
139+
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
140+
141+
# Copy the NixOS configuration file and link it from the resulting system
142+
# (/run/current-system/configuration.nix). This is useful in case you
143+
# accidentally delete configuration.nix.
144+
# system.copySystemConfiguration = true;
145+
146+
# This option defines the first version of NixOS you have installed on this particular machine,
147+
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
148+
#
149+
# Most users should NEVER change this value after the initial install, for any reason,
150+
# even if you've upgraded your system to a new NixOS release.
151+
#
152+
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
153+
# so changing it will NOT upgrade your system.
154+
#
155+
# This value being lower than the current NixOS release does NOT mean your system is
156+
# out of date, out of support, or vulnerable.
157+
#
158+
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
159+
# and migrated your data accordingly.
160+
#
161+
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
162+
system.stateVersion = "25.05"; # Did you read the comment?
163+
164+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
description = "Monolith homelab";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
7+
quadlet-nix = {
8+
url = "github:SEIAROTg/quadlet-nix";
9+
inputs.nixpkgs.follows = "nixpkgs";
10+
};
11+
12+
sops-nix = {
13+
url = "github:Mic92/sops-nix";
14+
inputs.nixpkgs.follows = "nixpkgs";
15+
};
16+
};
17+
18+
outputs =
19+
inputs@{
20+
self,
21+
quadlet-nix,
22+
nixpkgs,
23+
sops-nix,
24+
...
25+
}:
26+
{
27+
nixosConfigurations = {
28+
monolith = nixpkgs.lib.nixosSystem rec {
29+
specialArgs = {
30+
meta = {
31+
hostname = "monolith";
32+
username = "monolith";
33+
};
34+
system = "x86_64-linux";
35+
inherit inputs;
36+
} // inputs;
37+
modules = [
38+
./configuration.nix
39+
quadlet-nix.nixosModules.quadlet
40+
];
41+
};
42+
};
43+
};
44+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Do not modify this file! It was generated by ‘nixos-generate-config’
2+
# and may be overwritten by future invocations. Please make changes
3+
# to /etc/nixos/configuration.nix instead.
4+
{ config, lib, pkgs, modulesPath, ... }:
5+
6+
{
7+
imports =
8+
[ (modulesPath + "/profiles/qemu-guest.nix")
9+
];
10+
11+
boot.initrd.availableKernelModules = [ "uhci_hcd" "ehci_pci" "ahci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
12+
boot.initrd.kernelModules = [ ];
13+
boot.kernelModules = [ ];
14+
boot.extraModulePackages = [ ];
15+
16+
fileSystems."/" =
17+
{ device = "/dev/disk/by-uuid/c5f8f80a-cb86-49a7-aafa-a4ca7fccd9f0";
18+
fsType = "ext4";
19+
};
20+
21+
swapDevices = [ ];
22+
23+
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
24+
# (the default) this is the recommended approach. When using systemd-networkd it's
25+
# still possible to use this option, but it's recommended to use it in conjunction
26+
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
27+
networking.useDHCP = lib.mkDefault true;
28+
# networking.interfaces.enp6s18.useDHCP = lib.mkDefault true;
29+
30+
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
31+
}
7.28 MB
Binary file not shown.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
game-password: ENC[AES256_GCM,data:R2C02AUuaXVgaI+0/yHwfg==,iv:eRJNwnpvUjBNQcjfZ6EkHq58T2SsilP30QXxApWjwT4=,tag:aKiJuPKOnImSEE6aDbjCdg==,type:str]
2+
admin: ENC[AES256_GCM,data:eDmssivECpqWCek=,iv:KBk0i5vs8//DYBGJG2NPKRVEkQn/zhkRxY/3Nh26hJQ=,tag:BRqhacHW9UmD+IVcFLOsVQ==,type:str]
3+
token: ENC[AES256_GCM,data:sF1Z4aFEyutuAo6SlXMEqu0/KDVLRr0xNBCktUZj,iv:g48K3ehppX7UlGnNRzFY+czhtCZOsTA0vid1zkRpc3A=,tag:222VA0Be9aYRyCgvIeCqQQ==,type:str]
4+
sops:
5+
age:
6+
- recipient: age1df2u7xvze6rq5utz74ckx059wr3z97j484wc04063437h6hn4v6s9auec3
7+
enc: |
8+
-----BEGIN AGE ENCRYPTED FILE-----
9+
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBDekFPcnNRNHZlSzVkWm51
10+
MzdXTTUySVkxNFdGSDM1SzBDUjF0MUJXMlhBCnczMUJzVHRaZ1BJaEZtTFlDU0Rt
11+
ME1XT2dUdlVBWS9IT2NNTGZpWEhyV3MKLS0tIC9UcjExMHZMTlFTek1MZWtUYWdp
12+
UEt1NmxlRXFHc29IeisxZUVFMGVTVVEKSGueDRDgLWaGlwKqVKlsehufZEKxF/wb
13+
EBKkrbHHwsumMS2LNC7/dVU1165IvVRFRvXYa8NW0dlYXjvE6l4yog==
14+
-----END AGE ENCRYPTED FILE-----
15+
lastmodified: "2025-05-24T05:13:47Z"
16+
mac: ENC[AES256_GCM,data:+jdHFf6jawgNoTsGMEz9nMDgzn/T2CFbFP2l8WzkAbSVo46cofm9mg/i1kg60jh2bqAkZYotrUPaVyuh0phAtWTVsxVMt1x0orFfJeRPoYehtuaKI6uXmiJmXs8LWo5PavUOe9CyGGRyic6uz7A9i7wDhBfJHkM1ht0jTzaPdZI=,iv:nRYKwTEjoCRhc4k4ZZkPDaQg6PlwdI/q2XyBBR30o+w=,tag:lnyy7DRizclUatp69nPEpw==,type:str]
17+
unencrypted_suffix: _unencrypted
18+
version: 3.10.2

nix-darwin/users/henri/configuration.nix

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,6 @@
2121
./sops.nix
2222
];
2323

24-
systemd.user.startServices = "sd-switch";
25-
virtualisation.quadlet.containers = {
26-
echo-server = {
27-
autoStart = true;
28-
serviceConfig = {
29-
RestartSec = "10";
30-
Restart = "always";
31-
};
32-
containerConfig = {
33-
image = "docker.io/mendhak/http-https-echo:31";
34-
publishPorts = [ "127.0.0.1:8080:8080" ];
35-
userns = "keep-id";
36-
};
37-
};
38-
};
39-
4024
system.stateVersion = "25.05";
4125
boot.extraModprobeConfig = ''options bluetooth disable_ertm=1 '';
4226
# cron

nix-darwin/users/henri/home.nix

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
{
55
config,
6+
inputs,
67
username,
78
pkgs,
89
lib,
@@ -20,15 +21,37 @@
2021
../../home-modules/window-managers/hyprland
2122
# bar
2223
../../home-modules/status-bars/waybar
24+
inputs.quadlet-nix.homeManagerModules.quadlet
2325
];
2426

27+
# TODO: move this to a vm called homelab monolith add factorio, nextcloud
28+
systemd.user.startServices = "sd-switch";
29+
virtualisation.quadlet.containers = {
30+
echo-server = {
31+
autoStart = true;
32+
serviceConfig = {
33+
RestartSec = "10";
34+
Restart = "always";
35+
};
36+
containerConfig = {
37+
image = "docker.io/mendhak/http-https-echo:31";
38+
publishPorts = [ "127.0.0.1:8080:8080" ];
39+
userns = "keep-id";
40+
};
41+
};
42+
};
2543
# services
2644
dunst.enable = lib.mkForce false;
2745
fcitx.enable = true; # chinese fonts are super pixels
2846
gnome.enable = true;
2947
ssh = {
3048
enable = true;
3149
hosts = {
50+
monolith = {
51+
# ssh monolith
52+
hostname = "192.168.4.129";
53+
user = "henri";
54+
};
3255
factorio = {
3356
# ssh factorio
3457
hostname = "192.168.4.250";

0 commit comments

Comments
 (0)