From c39ad5181eb83be20e808256509f72f202e22a8b Mon Sep 17 00:00:00 2001 From: Nick Date: Tue, 11 Nov 2025 21:18:29 -0600 Subject: [PATCH] feat: added midnight miner --- modules/nixos/default.nix | 1 + modules/nixos/guests/midnight/default.nix | 32 ++++++++++++++++++++--- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 649eb9a..394574d 100755 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -78,6 +78,7 @@ in caddy logrotate microvm + midnight # opencloud sambaEris postgresEris diff --git a/modules/nixos/guests/midnight/default.nix b/modules/nixos/guests/midnight/default.nix index a63396f..6a991ea 100644 --- a/modules/nixos/guests/midnight/default.nix +++ b/modules/nixos/guests/midnight/default.nix @@ -1,10 +1,34 @@ { flake, + config, pkgs, ... }: let inherit (flake.config.people) user0; + inherit (flake.config.machines) devices; + + mars = devices.mars.name; + ceres = devices.ceres.name; + eris = devices.eris.name; + deimos = devices.deimos.name; + + hostname = config.networking.hostName; + + deviceLogic = + var0: var1: var2: var3: + if hostname == ceres then + var0 + else if hostname == eris then + var1 + else if hostname == mars then + var2 + else if hostname == deimos then + var3 + else + var0; + + macOctet = deviceLogic "57" "58" "59" "60"; in { microvm = { @@ -13,8 +37,8 @@ in autostart = true; config = let - macAddress = "02:00:00:00:00:57"; - workers = 45; + macAddress = "02:00:00:00:00:${macOctet}"; + workers = deviceLogic 45 4 6 6; in { environment.systemPackages = [ @@ -36,7 +60,7 @@ in { type = "tap"; id = "vm-miner"; - mac = "02:00:00:00:57:57"; + mac = "02:00:00:00:57:${macOctet}"; } { type = "user"; @@ -44,7 +68,7 @@ in mac = macAddress; } ]; - mem = 52100; + mem = deviceLogic 52100 5120 22000 1024; shares = [ { mountPoint = "/nix/.ro-store";