Compare commits
2 Commits
feat/remot
...
feat/temp-
| Author | SHA1 | Date | |
|---|---|---|---|
| 7a3885a036 | |||
| 44b8121edb |
Submodule assets/compose updated: d3f2e3b7b9...dab158da0a
@@ -65,15 +65,14 @@
|
||||
./hosts/lazyworkhorse/configuration.nix
|
||||
./hosts/lazyworkhorse/hardware-configuration.nix
|
||||
./modules/nixos/filesystem/hoardingcow-mount.nix
|
||||
./modules/nixos/filesystem/poup-16t-disk.nix
|
||||
./modules/nixos/services/docker_manager.nix
|
||||
./modules/nixos/services/open_code_server.nix
|
||||
./modules/nixos/services/ollama_init_custom_models.nix
|
||||
./modules/nixos/services/openclaw_node.nix
|
||||
./modules/nixos/services/remote-builder.nix
|
||||
./modules/nixos/security/ai-worker-restricted.nix
|
||||
./users/gortium.nix
|
||||
./users/ai-worker.nix
|
||||
./users/builder.nix
|
||||
];
|
||||
};
|
||||
|
||||
@@ -102,9 +101,7 @@
|
||||
}
|
||||
nixos-raspberrypi.nixosModules.raspberry-pi-5.base
|
||||
nixos-uconsole.nixosModules.uconsole-cm5
|
||||
./modules/nixos/services/remote-builder.nix
|
||||
./hosts/uConsole/configuration.nix
|
||||
./users/builder.nix
|
||||
./hosts/uConsole/hardware-configuration.nix
|
||||
];
|
||||
};
|
||||
|
||||
@@ -8,6 +8,14 @@
|
||||
# NAS Mounting
|
||||
hoardingcow-mount.enable = true;
|
||||
|
||||
# 16TB btrfs storage disk (WD Red Pro — Poup_16T — LUKS2 + btrfs + btrbk snapshots)
|
||||
# ⚠ SETUP REQUIRED: Connect the disk, get the LUKS UUID with 'blkid /dev/sdb',
|
||||
# then set gortium.poup16t.luksUuid here and deploy.
|
||||
# gortium.poup16t = {
|
||||
# enable = true;
|
||||
# luksUuid = "REPLACE_ME_WITH_REAL_UUID";
|
||||
# };
|
||||
|
||||
# Flakesss
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" "flake-self-attrs" ];
|
||||
nix.settings.trusted-users = [ "root" "gortium" ];
|
||||
@@ -573,23 +581,5 @@
|
||||
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
|
||||
system.stateVersion = "25.05"; # Did you read the comment?
|
||||
|
||||
|
||||
# ============================================================
|
||||
# Remote builder — dispatches aarch64-linux builds to uConsole
|
||||
# ============================================================
|
||||
services.remoteBuilder = {
|
||||
enable = true;
|
||||
machines = [
|
||||
{
|
||||
hostName = "192.168.1.120";
|
||||
port = 22;
|
||||
sshUser = "builder";
|
||||
sshKey = "/etc/ssh/builder_key";
|
||||
systems = [ "aarch64-linux" ];
|
||||
maxJobs = 4;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -168,23 +168,4 @@
|
||||
# Reticulum uses its own encryption and doesn't need open ports
|
||||
# for basic mesh operations (peer-to-peer discovery).
|
||||
# For TCP interfaces, open additional ports as needed.
|
||||
|
||||
# ============================================================
|
||||
# Remote builder — dispatches x86_64-linux builds to server
|
||||
# ============================================================
|
||||
services.remoteBuilder = {
|
||||
enable = true;
|
||||
machines = [
|
||||
{
|
||||
hostName = "lazyworkhorse.net";
|
||||
port = 2424;
|
||||
sshUser = "builder";
|
||||
sshKey = "/etc/ssh/builder_key";
|
||||
systems = [ "x86_64-linux" ];
|
||||
maxJobs = 36;
|
||||
supportedFeatures = [ "benchmark" "big-parallel" "nixos-test" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -9,13 +9,6 @@
|
||||
ai-worker = {
|
||||
main = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAXeGtPPcsP2IYRQNvII41NVWhJsarEk8c4qxs/a5sXf";
|
||||
};
|
||||
|
||||
builder = {
|
||||
# Same key on both hosts for bidirectional remote building.
|
||||
# Generate with: ssh-keygen -t ed25519 -f /etc/ssh/builder_key -N ""
|
||||
# Replace the placeholder below with the public key (builder_key.pub).
|
||||
main = "PLACEHOLDER_ADD_BUILDER_PUBKEY_HERE";
|
||||
};
|
||||
};
|
||||
|
||||
hosts = {
|
||||
|
||||
121
modules/nixos/filesystem/poup-16t-disk.nix
Normal file
121
modules/nixos/filesystem/poup-16t-disk.nix
Normal file
@@ -0,0 +1,121 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.gortium.poup16t;
|
||||
luksName = cfg.luksName;
|
||||
in
|
||||
with lib;
|
||||
|
||||
{
|
||||
options.gortium.poup16t = {
|
||||
enable = mkEnableOption "Poup_16T storage disk (btrfs + LUKS + btrbk snapshots)";
|
||||
|
||||
luksUuid = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
UUID of the LUKS partition on the 16TB disk (WD Red Pro).
|
||||
|
||||
Find this by running as root when the disk is connected:
|
||||
blkid /dev/sdb # or wherever the disk appears
|
||||
lsblk -o NAME,SIZE,FSTYPE,UUID
|
||||
|
||||
Since btrfs is inside LUKS, the FS UUID is hidden — use the
|
||||
LUKS partition UUID from blkid (it'll show TYPE=\"crypto_LUKS\").
|
||||
'';
|
||||
example = "00000000-0000-0000-0000-000000000000";
|
||||
};
|
||||
|
||||
luksName = mkOption {
|
||||
type = types.str;
|
||||
default = "poup_16t";
|
||||
description = "Name for the LUKS /dev/mapper/ mapping";
|
||||
};
|
||||
|
||||
mountPoint = mkOption {
|
||||
type = types.str;
|
||||
default = "/mnt/Poup_16T";
|
||||
description = "Mount point for the 16TB data disk";
|
||||
};
|
||||
|
||||
btrfsOptions = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ "defaults" "noatime" "compress=zstd:3" "nofail" ];
|
||||
description = "Mount options for the btrfs filesystem. 'nofail' ensures boot succeeds when disk is disconnected.";
|
||||
};
|
||||
|
||||
btrbk = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable btrbk snapshot management on this volume";
|
||||
};
|
||||
|
||||
schedule = mkOption {
|
||||
type = types.str;
|
||||
default = "daily";
|
||||
description = "systemd calendar event for btrbk (e.g. 'daily', 'hourly', '*-*-* 00:00:00')";
|
||||
};
|
||||
|
||||
preserveMin = mkOption {
|
||||
type = types.str;
|
||||
default = "2d";
|
||||
description = "btrbk snapshot_preserve_min — minimum age before pruning";
|
||||
};
|
||||
|
||||
preserve = mkOption {
|
||||
type = types.str;
|
||||
default = "14d 4w 3m";
|
||||
description = "btrbk snapshot_preserve — retention policy (daily, weekly, monthly)";
|
||||
};
|
||||
|
||||
snapshotDir = mkOption {
|
||||
type = types.str;
|
||||
default = ".snapshots";
|
||||
description = "Directory name for snapshots relative to volume root";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# Enable btrfs kernel support (no DKMS needed — it's in-tree)
|
||||
boot.supportedFilesystems = [ "btrfs" ];
|
||||
|
||||
# Install btrfs administration tools
|
||||
environment.systemPackages = with pkgs; [
|
||||
btrfs-progs # mkfs.btrfs, btrfs, fsck, balance, scrub
|
||||
btrbk # Snapshot management + rotation
|
||||
];
|
||||
|
||||
# LUKS2 unlock at boot (uses keyfile or prompts if unavailable)
|
||||
# Since the disk may be disconnected, initrd times out gracefully (~30s)
|
||||
boot.initrd.luks.devices.${luksName} = {
|
||||
device = "/dev/disk/by-uuid/${cfg.luksUuid}";
|
||||
preLVM = false;
|
||||
allowDiscards = true;
|
||||
};
|
||||
|
||||
# Mount the unlocked mapper device as btrfs
|
||||
fileSystems.${cfg.mountPoint} = {
|
||||
device = "/dev/mapper/${luksName}";
|
||||
fsType = "btrfs";
|
||||
options = cfg.btrfsOptions;
|
||||
};
|
||||
|
||||
# btrbk — automated snapshot creation and rotation
|
||||
services.btrbk = mkIf cfg.btrbk.enable {
|
||||
instances.poup16t = {
|
||||
onCalendar = cfg.btrbk.schedule;
|
||||
settings = {
|
||||
snapshot_preserve_min = cfg.btrbk.preserveMin;
|
||||
snapshot_preserve = cfg.btrbk.preserve;
|
||||
|
||||
volume.${cfg.mountPoint} = {
|
||||
snapshot_create = "always";
|
||||
snapshot_dir = cfg.btrbk.snapshotDir;
|
||||
subvolume = ".";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.services.remoteBuilder;
|
||||
in {
|
||||
options.services.remoteBuilder = {
|
||||
enable = lib.mkEnableOption "remote Nix build machine";
|
||||
|
||||
machines = lib.mkOption {
|
||||
type = lib.types.listOf (lib.types.submodule {
|
||||
options = {
|
||||
hostName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Hostname or IP of the remote build machine.";
|
||||
};
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 22;
|
||||
description = "SSH port.";
|
||||
};
|
||||
sshUser = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "builder";
|
||||
description = "SSH user on the remote build machine.";
|
||||
};
|
||||
sshKey = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Path to SSH private key for the builder.";
|
||||
};
|
||||
systems = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ "aarch64-linux" ];
|
||||
description = "System types the remote builder can build for.";
|
||||
};
|
||||
maxJobs = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 4;
|
||||
description = "Max parallel jobs on the remote builder.";
|
||||
};
|
||||
supportedFeatures = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ "benchmark" "big-parallel" "nixos-test" ];
|
||||
description = "Features the remote builder supports.";
|
||||
};
|
||||
};
|
||||
});
|
||||
default = [];
|
||||
description = "List of remote Nix build machines.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
nix.distributedBuilds = true;
|
||||
nix.buildMachines = map (m: {
|
||||
hostName = m.hostName;
|
||||
sshUser = m.sshUser;
|
||||
sshKey = m.sshKey;
|
||||
systems = m.systems;
|
||||
maxJobs = m.maxJobs;
|
||||
supportedFeatures = m.supportedFeatures;
|
||||
}) cfg.machines;
|
||||
|
||||
# SSH config for port + key (nix.buildMachines has no port option)
|
||||
programs.ssh.extraConfig = lib.concatStringsSep "\n" (map (m: ''
|
||||
Host ${m.hostName}
|
||||
HostName ${m.hostName}
|
||||
Port ${toString m.port}
|
||||
User ${m.sshUser}
|
||||
IdentityFile ${m.sshKey}
|
||||
StrictHostKeyChecking no
|
||||
UserKnownHostsFile /dev/null
|
||||
'') cfg.machines);
|
||||
};
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{ config, lib, pkgs, keys, ... }: {
|
||||
users.users.builder = {
|
||||
isSystemUser = true;
|
||||
group = "builder";
|
||||
home = "/var/empty";
|
||||
createHome = false;
|
||||
shell = pkgs.nologin;
|
||||
openssh.authorizedKeys.keys = with keys; [
|
||||
users.builder.main
|
||||
];
|
||||
};
|
||||
users.groups.builder = {};
|
||||
}
|
||||
Reference in New Issue
Block a user