replace with real hardware configs
This commit is contained in:
Generated
+21
@@ -20,6 +20,26 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"disko": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1781152676,
|
||||||
|
"narHash": "sha256-RxWs5ND31KzTG7wvMM+PMfUjyNpmIEr999lqNARaM5o=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "disko",
|
||||||
|
"rev": "ff8702b4de27f72b4c78573dfb89ec74e36abdf1",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "disko",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-compat": {
|
"flake-compat": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
@@ -119,6 +139,7 @@
|
|||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"deploy-rs": "deploy-rs",
|
"deploy-rs": "deploy-rs",
|
||||||
|
"disko": "disko",
|
||||||
"flake-parts": "flake-parts",
|
"flake-parts": "flake-parts",
|
||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": "nixpkgs_2",
|
||||||
"process-compose-flake": "process-compose-flake",
|
"process-compose-flake": "process-compose-flake",
|
||||||
|
|||||||
@@ -7,6 +7,10 @@
|
|||||||
deploy-rs.url = "github:serokell/deploy-rs";
|
deploy-rs.url = "github:serokell/deploy-rs";
|
||||||
process-compose-flake.url = "github:Platonic-Systems/process-compose-flake";
|
process-compose-flake.url = "github:Platonic-Systems/process-compose-flake";
|
||||||
services-flake.url = "github:juspay/services-flake";
|
services-flake.url = "github:juspay/services-flake";
|
||||||
|
disko = {
|
||||||
|
url = "github:nix-community/disko";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
sops-nix = {
|
sops-nix = {
|
||||||
url = "github:Mic92/sops-nix";
|
url = "github:Mic92/sops-nix";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|||||||
@@ -3,6 +3,16 @@
|
|||||||
{
|
{
|
||||||
system.stateVersion = "26.05";
|
system.stateVersion = "26.05";
|
||||||
|
|
||||||
|
# Bootloader. The disko layout (hardware-configurations/disk-config.nix) lays
|
||||||
|
# down both a BIOS-boot (EF02) partition and an ESP mounted at /boot, so grub
|
||||||
|
# works whether the VM firmware is legacy BIOS or UEFI. disko fills in
|
||||||
|
# boot.loader.grub.devices from the EF02 partition; we just enable grub here.
|
||||||
|
boot.loader.grub = {
|
||||||
|
enable = true;
|
||||||
|
efiSupport = true;
|
||||||
|
efiInstallAsRemovable = true;
|
||||||
|
};
|
||||||
|
|
||||||
nix.settings = {
|
nix.settings = {
|
||||||
experimental-features = [ "nix-command" "flakes" ];
|
experimental-features = [ "nix-command" "flakes" ];
|
||||||
trusted-users = [ "@wheel" "deploy" ];
|
trusted-users = [ "@wheel" "deploy" ];
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
# Postgres data lives on the dedicated second disk (/dev/sdb), not the OS disk.
|
||||||
|
# The shared hardware-configuration.nix + sda disk layout come from ./default.nix.
|
||||||
|
imports = [ ./hardware-configurations/db-data-disk.nix ];
|
||||||
|
|
||||||
networking.hostName = "db-host";
|
networking.hostName = "db-host";
|
||||||
|
|
||||||
services.gebos.secrets.postgresAdmin = true;
|
services.gebos.secrets.postgresAdmin = true;
|
||||||
|
|
||||||
# Skeleton: real hardware-configuration.nix + boot/fs lives next to this file
|
|
||||||
# once we have the actual box. Marked here so the structure is visible.
|
|
||||||
# imports = [ ./db-host.hardware.nix ];
|
|
||||||
|
|
||||||
services.gebos.postgres = {
|
services.gebos.postgres = {
|
||||||
enable = true;
|
enable = true;
|
||||||
listenAddresses = [ "0.0.0.0" ];
|
listenAddresses = [ "0.0.0.0" ];
|
||||||
|
|||||||
@@ -9,8 +9,15 @@ let
|
|||||||
specialArgs = { inherit inputs; };
|
specialArgs = { inherit inputs; };
|
||||||
modules = [
|
modules = [
|
||||||
./common.nix
|
./common.nix
|
||||||
./placeholder-hardware.nix
|
|
||||||
inputs.sops-nix.nixosModules.sops
|
inputs.sops-nix.nixosModules.sops
|
||||||
|
inputs.disko.nixosModules.disko
|
||||||
|
# All three boxes are identical qemu guests, so they share one
|
||||||
|
# hardware-configuration.nix and one disko disk layout (single
|
||||||
|
# /dev/sda → GPT → LVM → ext4 root). disko derives fileSystems +
|
||||||
|
# bootloader devices from disk-config.nix. db-host additionally
|
||||||
|
# imports the /dev/sdb data disk from ./db-host.nix.
|
||||||
|
./hardware-configurations/hardware-configuration.nix
|
||||||
|
./hardware-configurations/disk-config.nix
|
||||||
modules.gebos-secrets
|
modules.gebos-secrets
|
||||||
modules.gebos-postgres
|
modules.gebos-postgres
|
||||||
modules.gebos-supabase
|
modules.gebos-supabase
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
{ lib, ... }:
|
||||||
|
|
||||||
|
# Second disk for db-host: the Postgres data directory lives on /dev/sdb, kept
|
||||||
|
# separate from the OS disk (/dev/sda). The whole disk is one GPT partition,
|
||||||
|
# ext4, mounted at /var/lib/postgresql — so the cluster data dir
|
||||||
|
# (/var/lib/postgresql/17, the upstream NixOS default) sits on this drive and
|
||||||
|
# survives an OS-disk rebuild.
|
||||||
|
{
|
||||||
|
disko.devices.disk.disk2 = {
|
||||||
|
device = lib.mkDefault "/dev/sdb";
|
||||||
|
type = "disk";
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
data = {
|
||||||
|
name = "data";
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "ext4";
|
||||||
|
mountpoint = "/var/lib/postgresql";
|
||||||
|
mountOptions = [ "defaults" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
|
disko.devices = {
|
||||||
|
disk.disk1 = {
|
||||||
|
device = lib.mkDefault "/dev/sda";
|
||||||
|
type = "disk";
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
boot = {
|
||||||
|
name = "boot";
|
||||||
|
size = "1M";
|
||||||
|
type = "EF02";
|
||||||
|
};
|
||||||
|
esp = {
|
||||||
|
name = "ESP";
|
||||||
|
size = "500M";
|
||||||
|
type = "EF00";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
root = {
|
||||||
|
name = "root";
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "lvm_pv";
|
||||||
|
vg = "pool";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
lvm_vg = {
|
||||||
|
pool = {
|
||||||
|
type = "lvm_vg";
|
||||||
|
lvs = {
|
||||||
|
root = {
|
||||||
|
size = "100%FREE";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "ext4";
|
||||||
|
mountpoint = "/";
|
||||||
|
mountOptions = [
|
||||||
|
"defaults"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports =
|
||||||
|
[ (modulesPath + "/profiles/qemu-guest.nix")
|
||||||
|
];
|
||||||
|
|
||||||
|
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
|
||||||
|
boot.initrd.kernelModules = [ "dm-snapshot" ];
|
||||||
|
boot.kernelModules = [ ];
|
||||||
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
|
}
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
{ lib, ... }:
|
|
||||||
|
|
||||||
# SKELETON PLACEHOLDER — not a real machine description.
|
|
||||||
#
|
|
||||||
# The three hosts don't have actual boxes yet, but `nix flake check` evaluates
|
|
||||||
# `system.build.toplevel` for every nixosConfiguration, which asserts a root
|
|
||||||
# filesystem and a boot device exist. This stub satisfies those assertions so
|
|
||||||
# the structure type-checks in CI.
|
|
||||||
#
|
|
||||||
# When a real machine is provisioned, generate its hardware-configuration.nix
|
|
||||||
# (`nixos-generate-config`) and import that from the host file instead of this
|
|
||||||
# placeholder (see the commented import in db-host.nix). Do NOT deploy a host
|
|
||||||
# that still relies on this file — the device paths below are fictional.
|
|
||||||
{
|
|
||||||
fileSystems."/" = {
|
|
||||||
device = "/dev/disk/by-label/nixos";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
|
|
||||||
boot.loader.grub = {
|
|
||||||
enable = true;
|
|
||||||
devices = [ "/dev/sda" ];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user