feat: rework hostSpec to use providers and machine definitions

This commit is contained in:
Mohammad Rafiq 2025-07-02 21:14:26 +08:00
parent 69d942a1be
commit abfbb5aa09
No known key found for this signature in database

View file

@ -3,76 +3,106 @@
primary = true; primary = true;
email = "rafiq@rrv.sh"; email = "rafiq@rrv.sh";
alternate-emails = [ alternate-emails = [
"mohammadrafiq@rrv.sh" "mohammadrafiq@rrv.sh" # Work
"mohammadrafiq567@gmail.com" "googaabumtum@gmail.com" # Old Personal
"mohammadrafiq567@gmail.com" # Old Work
]; ];
pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILdsZyY3gu8IGB8MzMnLdh+ClDxQQ2RYG9rkeetIKq8n"; pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILdsZyY3gu8IGB8MzMnLdh+ClDxQQ2RYG9rkeetIKq8n";
}; };
entrypoints = { # Services will use this to find where their configuration
# For services that should only have one instance across the whole # should point to and the providers will set up the needed
# flake, define them here and they will get provisioned on those # configuration for each service.
# hosts, with whatever depends on them configured via that hostname. providers = {
nginx.host = "apollo"; reverse-proxy = {
ssh.host = "apollo"; type = "nginx";
host = "apollo";
};
mongodb.host = "helios";
}; };
# This will define all the hosts exposed by the flake and designate the # This will define all the hosts exposed by the flake and designate the
# modules and services, along with defining the hardware configuration # modules and services, along with defining the hardware configuration
# for each host. # for each host.
# <name> of each attr set will resolve to the host's hostname. # <name> of each attr set will resolve to the host's hostname.
# Hosts can reach each other through their hostname (using Tailscale)
hosts.nemesis = { hosts.nemesis = {
platform = "amd"; machine = {
gpu = "nvidia"; localIP = "10.10.0.11"; # Set up a static IP
ephemeralRoot = true; platform = "amd"; # Set up CPU microcode etc
boot-drive = "/dev/disk/by-id/nvme-CT2000P3SSD8_2325E6E77434"; gpu = "nvidia"; # Set up nvidia drivers etc
bootloader = "systemd-boot"; # Partitioning and formatting config using disko
# Enables dotfiles and desktop environment/services. boot-drive = "/dev/disk/by-id/nvme-CT2000P3SSD8_2325E6E77434";
desktop.enable = true; };
extraCfg = { }; # Profiles will define configuration, such as graphical
}; # setting up window managers and web browsers
hosts.apollo = { profiles = [
platform = "intel"; "graphical"
ephemeralRoot = true; "desktop" # might be a no-op?
bootloader = "systemd-boot"; ];
boot-drive = "/dev/disk/by-id/nvme-eui.002538d221b47b01"; services = [
# Public services will be exposed to the web server.
public-services = [
{ {
name = "librechat"; type = "stable-diffusion";
public = false; # false by default
port = 7860;
}
];
# extraCfg will be added directly to the system's config
extraCfg = {
programs.steam.enable = true;
};
};
hosts.apollo = {
machine = {
localIP = "10.10.0.102";
platform = "intel";
boot-drive = "/dev/disk/by-id/nvme-eui.002538d221b47b01";
};
profiles = [
"server" # no-op as servers shouldnt have extra config but might change
];
services = [
{
type = "librechat"; # Picks up the mongodb and nginx automatically
public = true;
port = 1234;
domain = "chat.bwfiq.com"; domain = "chat.bwfiq.com";
} }
{
name = "forgejo";
domain = "git.rrv.sh";
}
{
name = "rrv-sh";
domain = "rrv.sh";
}
{
name = "immich";
domain = "photos.bwfiq.com";
}
{
name = "aenyrathia-wiki";
domain = "aenyrathia.wiki";
}
]; ];
# Internal services will be exposed with tailscale only.
internal-services = [
"mongodb"
"mariadb"
"postgresql"
"redis"
];
extraCfg = { };
}; };
host.helios = {
platform = "intel"; hosts.helios = {
boot-drive = "nvme-eui.6479a784aad00284"; machine = {
ephemeralRoot = true; localIP = "10.10.0.101";
bootloader = "systemd-boot"; platform = "intel";
extraCfg = { }; boot-drive = "nvme-eui.6479a784aad00284";
};
profiles = [ "server" ];
# Sets up network shares of the configured type under a folder
# e.g. /shares/{rafiqmedia, tv-shows}
# These are then consumed on other hosts under /mnt/{hostname}/{rafiqmedia,tv-shows}
shares = [
{
folder = "rafiqmedia";
type = [
"nfs"
"smb"
];
}
];
};
hosts.iris = {
machine = {
localIP = "10.10.0.12";
platform = "apple-silicon";
boot-drive = "";
};
profiles = [
"graphical"
"macbook" # asahi linux config etc - may not be needed
"laptop" # primarily power management
];
}; };
} }