Files
homelab-config/virtual-machines/vm-test/virtual.nix
T

87 lines
1.7 KiB
Nix
Raw Normal View History

2026-09-15 22:36:17 -05:00
{
config,
pkgs,
meta,
2026-09-26 01:32:45 -05:00
credentials,
2026-09-15 22:36:17 -05:00
...
}:
{
2026-09-15 23:14:19 -05:00
2026-09-17 22:47:14 -05:00
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
2026-09-26 00:44:43 -05:00
2026-09-17 22:47:14 -05:00
nixpkgs.config.allowUnfree = true;
2026-09-15 23:14:19 -05:00
# Allow login and remote control of VM
users.users.admin = {
isNormalUser = true;
2026-09-17 21:56:36 -05:00
hashedPassword = "$y$j9T$WI7E.NXw4qar1DXodrVWG/$gUErw1R6W8k1UFm49C5.vEc9MT5RcKW0BKitURNqbl/";
2026-09-15 23:14:19 -05:00
extraGroups = [ "wheel" ];
2026-09-17 21:56:36 -05:00
2026-09-15 23:14:19 -05:00
openssh.authorizedKeys.keys = [
2026-09-17 21:22:57 -05:00
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAcofS7u0BYzRBn0i4RuXPHWpnvk3nEbGo9B9ghsR4oL roydumblauskas@gmail.com"
2026-09-15 23:14:19 -05:00
];
};
2026-09-17 21:56:36 -05:00
# Don't allow password login
services.openssh = {
enable = true;
settings = {
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
};
};
2026-09-17 22:47:14 -05:00
# Packages
environment.systemPackages = with pkgs; [
curl
kitty
2026-09-17 23:11:42 -05:00
kubectl
2026-09-17 22:47:14 -05:00
nginx
tmux
vim
wget
];
2026-09-15 22:36:17 -05:00
# ================================ #
# K3S SERVICE #
# ================================ #
services.k3s = {
enable = true;
disable = [ "traefik" ];
role = "server";
# only enable the service on k3s when roughly finalized
# Until then use a vm, as k3s is persisted
extraFlags = [
"--data-dir=/var/lib/rancher/k3s"
"--cluster-cidr=10.42.0.0/20"
];
};
# ================================ #
# PSQL SERVICE #
# ================================ #
# Postgresql/postgrest for row storage (not on k3s)
services.postgresql-db = {
enable = true;
dataDir = "/var/lib/postgresql";
port = 5432;
2026-09-26 01:48:56 -05:00
credentialsFile = credentials.psql-env;
2026-09-15 22:36:17 -05:00
databases = [
"test"
];
ipMasks = [
"10.42.0.0/20" # k3s pod mask
];
};
2026-09-17 22:08:15 -05:00
# To stop the complaining
system.stateVersion = "26.05";
2026-09-15 22:36:17 -05:00
}