Compare commits

..

No commits in common. "23d4592783c0fc2991375912b8b1b890ddd7bf81" and "b8b5084352287158eb9011d9b6d9eb57d27e13f5" have entirely different histories.

2 changed files with 21 additions and 17 deletions

View file

@ -17,10 +17,8 @@
BAT_PCT=`${pkgs.acpi}/bin/acpi -b | ${pkgs.gnugrep}/bin/grep -P -o '[0-9]+(?=%)'` BAT_PCT=`${pkgs.acpi}/bin/acpi -b | ${pkgs.gnugrep}/bin/grep -P -o '[0-9]+(?=%)'`
BAT_STA=`${pkgs.acpi}/bin/acpi -b | ${pkgs.gnugrep}/bin/grep -P -o '\w+(?=,)'` BAT_STA=`${pkgs.acpi}/bin/acpi -b | ${pkgs.gnugrep}/bin/grep -P -o '\w+(?=,)'`
echo "`date` battery status:$BAT_STA percentage:$BAT_PCT" echo "`date` battery status:$BAT_STA percentage:$BAT_PCT"
export DISPLAY=:0 test $BAT_PCT -le 30 && test $BAT_PCT -gt 15 && test $BAT_STA = "Discharging" && DISPLAY=:0.0 ${pkgs.libnotify}/bin/notify-send "Low Battery" "Battery remaining: $BAT_PCT%."
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus test $BAT_PCT -le 15 && test $BAT_STA = "Discharging" && DISPLAY=:0.0 ${pkgs.libnotify}/bin/notify-send -u critical "Low Battery" "Shutdown at 10%."
test $BAT_PCT -le 30 && test $BAT_PCT -gt 15 && test $BAT_STA = "Discharging" && ${pkgs.libnotify}/bin/notify-send "Low Battery" "Battery remaining: $BAT_PCT%."
test $BAT_PCT -le 15 && test $BAT_STA = "Discharging" && ${pkgs.libnotify}/bin/notify-send -u critical "Low Battery" "Shutdown at 10%."
''} > /tmp/cron.batt.log 2>&1" ''} > /tmp/cron.batt.log 2>&1"
]; ];
}; };

View file

@ -2,9 +2,9 @@
ram-allocation-mb = 12288; ram-allocation-mb = 12288;
rcon-pass = "howdy"; rcon-pass = "howdy";
modpack = let modpack = let
commit = "506050af820a4cf370c6f2021c5991d665ba902a"; commit = "918b281754d4c289a3567cca083774087b2a2ec0";
in pkgs.fetchPackwizModpack { in pkgs.fetchPackwizModpack {
packHash = ""; packHash = "sha256-HmTDQac9FCQXBPWiZIxu9zmHyl2vqMVQpZpDHp+2lBA=";
url = "https://git.satr14.my.id/satr14/server-modpack/raw/commit/${commit}/pack.toml"; url = "https://git.satr14.my.id/satr14/server-modpack/raw/commit/${commit}/pack.toml";
}; };
@ -38,17 +38,23 @@ in {
jvmOpts = let flags = [ jvmOpts = let flags = [
"-Xms${toString ram-allocation-mb}M" "-Xms${toString ram-allocation-mb}M"
"-Xmx${toString ram-allocation-mb}M" "-Xmx${toString ram-allocation-mb}M"
"-XX:+UseZGC" # Use ZGC (requires Java v25+, 8+ CPU cores, 10GB+ RAM) # Exposes SIMD instructions (requires full JDK, useful with performance mods)
"-XX:+UseCompactObjectHeaders" # Use compact object headers (requires Java v16+, saves a couple of bits per object) "--add-modules=jdk.incubator.vector"
"--add-modules=jdk.incubator.vector" # Exposes SIMD instructions (requires full JDK, useful with performance mods) # ZGC flags (requires Java v25+, 8+ CPU cores, 10GB+ RAM)
"-XX:+UseLargePages" # Large pages support (requires hugepages configured on the system) "-XX:+UseZGC"
"-XX:+AlwaysPreTouch" # Pre-allocates memory on startup, OS claims it immediately for JVM instead of negotiating it "-XX:+UseLargePages"
"-XX:+DisableExplicitGC" # Disables mods from manually invoking the GC "-XX:+AlwaysPreTouch"
"-XX:+PerfDisableSharedMem" # Disables constant /tmp writes for JVM metrics "-XX:+DisableExplicitGC"
"-XX:ZAllocationSpikeTolerance=5" # Helps when server is active with many players (causes unnecessary GC load at idle) "-XX:+PerfDisableSharedMem"
"-XX:SoftMaxHeapSize=${toString (ram-allocation-mb - 2048)}M" # Leave 2GB headroom for off-heap memory (native code, mods, and ZGC overhead) "-XX:+UseCompactObjectHeaders"
"-XX:ZAllocationSpikeTolerance=5"
"-XX:SoftMaxHeapSize=${toString (ram-allocation-mb - 2048)}M"
# High MSPT due to ZGC pauses
"-XX:ZUncommitDelay=300"
"-XX:ZCollectionInterval=5"
]; in lib.concatStringsSep " " flags; ]; in lib.concatStringsSep " " flags;
# extraStartPost = let gamerules = { # extraStartPost = let gamerules = {