Linux Is Best on Nostr: Tested and it works on NixOS. Now, watch NixOS Development change something, so this ...
Tested and it works on NixOS.
Now, watch NixOS Development change something, so this stops working in the future.
# ----------------------------------------
# 🗑️ Weekly Garbage Collection.
# ----------------------------------------
# Cleans unused packages every Monday at 4 PM, waiting 24+ hours after updates to avoid issues.
#
# ✅ What it does:
# • Runs: "nix-collect-garbage -d".
# • Deletes unused system generations and packages.
# • Frees up disk space safely.
#
# ⚠️ What it doesn't do:
# • ❌ Won't remove your currently active or booted system configuration.
# • ❌ Doesn't reboot your machine.
# 📝 Tip: Adjust the times below to fit your schedule or preferences.
# Enable automatic garbage collection in Nix.
# This cleans up unused packages and old system generations regularly.
nix.gc = {
automatic = true;
dates = "Mon *-*-* 16:00"; # Monday, 4:00 PM - Change if you want a different day and time.
};
# Timer for running Nix's built-in automatic garbage collection
systemd.timers.nix-gc.timerConfig = {
WakeSystem = true;
Persistent = true;
};
# Custom service to wipe ALL old system generations manually.
# This is a more thorough cleanup, safely removing all old system snapshots.
systemd.services.nix-gc-wipe = {
description = "Wipe all old system generations";
serviceConfig = {
Type = "oneshot";
Environment = "PATH=/run/current-system/sw/bin";
ExecStart = "/bin/sh -c 'nix-env --delete-generations old --profile /nix/var/nix/profiles/system && nix-collect-garbage -d'";
};
};
# Timer to run the custom wipe service every Monday at 4:15 PM
systemd.timers.nix-gc-wipe = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = "Mon *-*-* 16:15:00"; # Monday, 4:15 PM - Change if you want a different day and time.
WakeSystem = true;
Persistent = true;
};
};
Published at
2025-06-03 02:00:43Event JSON
{
"id": "26330e732f8a350e1b4c8b945a7c61b7e512891d3fdba930a0bf8bf06a20107f",
"pubkey": "2ebda027be8c8c3589adfccd694604e48e083a4cbe7d50dfa5619508ee36ab00",
"created_at": 1748916043,
"kind": 1,
"tags": [
[
"proxy",
"https://mk.absturztau.be/notes/a8jfrpbb4ak700be",
"activitypub"
],
[
"client",
"Mostr",
"31990:6be38f8c63df7dbf84db7ec4a6e6fbbd8d19dca3b980efad18585c46f04b26f9:mostr",
"wss://relay.mostr.pub"
]
],
"content": "Tested and it works on NixOS. \n\nNow, watch NixOS Development change something, so this stops working in the future. \n\n\n# ----------------------------------------\n# 🗑️ Weekly Garbage Collection.\n# ----------------------------------------\n\n# Cleans unused packages every Monday at 4 PM, waiting 24+ hours after updates to avoid issues.\n#\n# ✅ What it does:\n# • Runs: \"nix-collect-garbage -d\".\n# • Deletes unused system generations and packages.\n# • Frees up disk space safely.\n#\n# ⚠️ What it doesn't do:\n# • ❌ Won't remove your currently active or booted system configuration.\n# • ❌ Doesn't reboot your machine.\n\n# 📝 Tip: Adjust the times below to fit your schedule or preferences.\n\n\n# Enable automatic garbage collection in Nix.\n# This cleans up unused packages and old system generations regularly.\nnix.gc = {\n automatic = true;\n dates = \"Mon *-*-* 16:00\"; # Monday, 4:00 PM - Change if you want a different day and time.\n};\n\n# Timer for running Nix's built-in automatic garbage collection\nsystemd.timers.nix-gc.timerConfig = {\n WakeSystem = true;\n Persistent = true;\n};\n\n# Custom service to wipe ALL old system generations manually.\n# This is a more thorough cleanup, safely removing all old system snapshots.\nsystemd.services.nix-gc-wipe = {\n description = \"Wipe all old system generations\";\n serviceConfig = {\n Type = \"oneshot\";\n Environment = \"PATH=/run/current-system/sw/bin\";\n ExecStart = \"/bin/sh -c 'nix-env --delete-generations old --profile /nix/var/nix/profiles/system \u0026\u0026 nix-collect-garbage -d'\";\n };\n};\n\n# Timer to run the custom wipe service every Monday at 4:15 PM\nsystemd.timers.nix-gc-wipe = {\n wantedBy = [ \"timers.target\" ];\n timerConfig = {\n OnCalendar = \"Mon *-*-* 16:15:00\"; # Monday, 4:15 PM - Change if you want a different day and time.\n WakeSystem = true;\n Persistent = true;\n };\n};\n",
"sig": "38fbb7910aa956066ab8a720f8f47b002cd2faf819cfaf76089fa958adbadc675de794e16fd75653a11a519370ca41195bf73b51e2de5269084ec595fff28875"
}