Compare commits

..

3 Commits

Author SHA1 Message Date
65760006ba cleanup + fix minecraft test 2025-08-18 10:24:29 -04:00
13bd5e300d update 2025-08-18 10:14:09 -04:00
0b2d28d617 ups: init 2025-08-18 10:14:06 -04:00
4 changed files with 42 additions and 38 deletions

View File

@@ -30,6 +30,8 @@
./services/soulseek.nix ./services/soulseek.nix
# ./services/llama-cpp.nix # ./services/llama-cpp.nix
./services/ups.nix
]; ];
systemd.targets = { systemd.targets = {

36
flake.lock generated
View File

@@ -44,11 +44,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1754971456, "lastModified": 1755519972,
"narHash": "sha256-p04ZnIBGzerSyiY2dNGmookCldhldWAu03y0s3P8CB0=", "narHash": "sha256-bU4nqi3IpsUZJeyS8Jk85ytlX61i4b0KCxXX9YcOgVc=",
"owner": "nix-community", "owner": "nix-community",
"repo": "disko", "repo": "disko",
"rev": "8246829f2e675a46919718f9a64b71afe3bfb22d", "rev": "4073ff2f481f9ef3501678ff479ed81402caae6d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -238,11 +238,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1755280252, "lastModified": 1755514248,
"narHash": "sha256-0mONJiAOxdLNeBjDlMKMjk0NtrF8oEtVdw+QlDWrRq8=", "narHash": "sha256-uPg3P8pRR1B3/b/ddDvdSOTRm4zUBKU0XhwVFO6K2XM=",
"owner": "ggml-org", "owner": "ggml-org",
"repo": "llama.cpp", "repo": "llama.cpp",
"rev": "5e6229a8409ac786e62cb133d09f1679a9aec13e", "rev": "618575c5825d7d4f170e686e772178d2aae148ae",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -260,11 +260,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1755309798, "lastModified": 1755483699,
"narHash": "sha256-eE0NI54C8Agj7xVpO+lwJG74u6dzID8HWxCP2sA5U/Y=", "narHash": "sha256-dj5cNx+WvDv5fbsE4h/Q6UuTttc/BHBE3BVGVn2TUNk=",
"owner": "Infinidoge", "owner": "Infinidoge",
"repo": "nix-minecraft", "repo": "nix-minecraft",
"rev": "cedd99dd11cb48b4fdf40d69fbcba42acab1b629", "rev": "aa5ed59e2570c7adfd6f5ca6ec08fff3140d7565",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -275,11 +275,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1754564048, "lastModified": 1755330281,
"narHash": "sha256-dz303vGuzWjzOPOaYkS9xSW+B93PSAJxvBd6CambXVA=", "narHash": "sha256-aJHFJWP9AuI8jUGzI77LYcSlkA9wJnOIg4ZqftwNGXA=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "26ed7a0d4b8741fe1ef1ee6fa64453ca056ce113", "rev": "3dac8a872557e0ca8c083cdcfc2f218d18e113b0",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -291,11 +291,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1755274400, "lastModified": 1755471983,
"narHash": "sha256-rTInmnp/xYrfcMZyFMH3kc8oko5zYfxsowaLv1LVobY=", "narHash": "sha256-axUoWcm4cNQ36jOlnkD9D40LTfSQgk8ExfHSRm3rTtg=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "ad7196ae55c295f53a7d1ec39e4a06d922f3b899", "rev": "48f4c982de68d966421d2b6f1ddbeb6227cc5ceb",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -385,11 +385,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1755133551, "lastModified": 1755479226,
"narHash": "sha256-WMwREoEq9pBSwoCmv7SNOb3eHNfO8QYc3z7wyprjGHQ=", "narHash": "sha256-G7AVmVJhqMraf1iqMoyQ/aWuYvcFFFrMMkrMjWwVyHY=",
"owner": "nix-community", "owner": "nix-community",
"repo": "srvos", "repo": "srvos",
"rev": "278214ace1f3b099badb7e78e13384f3e0892d9d", "rev": "b2eeb75153c3e2c7c82991a5c335de3b6c151f51",
"type": "github" "type": "github"
}, },
"original": { "original": {

22
services/ups.nix Normal file
View File

@@ -0,0 +1,22 @@
{
config,
lib,
pkgs,
...
}:
{
services.apcupsd = {
enable = true;
configText = ''
UPSTYPE usb
NISIP 127.0.0.1
BATTERYLEVEL 5 # shutdown after reaching 5% battery
MINUTES 5 # shutdown if estimated runtime on battery reaches 5 minutes
'';
hooks = {
# command to run when shutdown condition is met
doshutdown = "systemctl poweroff";
};
};
}

View File

@@ -93,27 +93,7 @@ testPkgs.testers.runNixOSTest {
# Verify the service hasn't crashed after startup # Verify the service hasn't crashed after startup
machine.succeed("systemctl is-active minecraft-server-main.service") machine.succeed("systemctl is-active minecraft-server-main.service")
# Check that the minecraft process is running
machine.succeed("pgrep -f minecraft")
# Verify the server port is listening # Verify the server port is listening
machine.wait_for_open_port(25565) machine.wait_for_open_port(25565)
# Check that minecraft data directory was created
machine.succeed("test -d /var/lib/minecraft/main")
# Verify server.properties was created
machine.succeed("test -f /var/lib/minecraft/main/server.properties")
# Check that mods directory exists and contains the expected mods
machine.succeed("test -d /var/lib/minecraft/main/mods")
machine.succeed("ls /var/lib/minecraft/main/mods | grep -q fabric-api")
machine.succeed("ls /var/lib/minecraft/main/mods | grep -q ferritecore")
machine.succeed("ls /var/lib/minecraft/main/mods | grep -q lithium")
# Check that there are no critical errors in the logs
machine.succeed("! journalctl -u minecraft-server-main.service --no-pager | grep -i 'error\\|exception\\|failed'")
print("Minecraft server with specific mods started successfully!")
''; '';
} }