nixos: add daily Rust target sweep
This commit is contained in:
@@ -112,6 +112,8 @@ Recommended sequence:
|
||||
Machine-specific note:
|
||||
|
||||
- Project-local `.worktrees/*/target` directories are common cleanup wins on this machine and are easy to miss with the old hard-coded workflow.
|
||||
- `cargo-sweep` is installed through the NixOS `code.nix` package set, but stale manually-installed binaries under `~/.cargo/bin` can shadow `/run/current-system/sw/bin/cargo-sweep`. If `cargo sweep` fails with a missing loader or `No such file or directory`, run `type -a cargo-sweep` and remove the stale `~/.cargo/bin/cargo-sweep` entry.
|
||||
- `nixos/imalison.nix` defines a daily user timer, `cargo-sweep-rust-targets.timer`, that runs `cargo-sweep sweep -r --hidden --maxsize 15GB` across `/home/imalison/Projects`, `/home/imalison/org`, and `/home/imalison/dotfiles`.
|
||||
|
||||
## Step 4: Investigation with `ncdu` and `du`
|
||||
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
{pkgs, ...}: let
|
||||
session = import ./session-variables.nix;
|
||||
cargoSweepRustTargets = pkgs.writeShellApplication {
|
||||
name = "cargo-sweep-rust-targets";
|
||||
runtimeInputs = [pkgs.cargo-sweep];
|
||||
text = ''
|
||||
for root in /home/imalison/Projects /home/imalison/org /home/imalison/dotfiles; do
|
||||
if [[ -d "$root" ]]; then
|
||||
cargo-sweep sweep -r --hidden --maxsize 15GB "$root"
|
||||
fi
|
||||
done
|
||||
'';
|
||||
};
|
||||
in {
|
||||
home-manager.users.imalison = {
|
||||
imports = [
|
||||
@@ -52,6 +63,33 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.services.cargo-sweep-rust-targets = {
|
||||
Unit = {
|
||||
Description = "Sweep Rust target directories";
|
||||
};
|
||||
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${cargoSweepRustTargets}/bin/cargo-sweep-rust-targets";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.timers.cargo-sweep-rust-targets = {
|
||||
Unit = {
|
||||
Description = "Sweep Rust target directories daily";
|
||||
};
|
||||
|
||||
Timer = {
|
||||
OnCalendar = "daily";
|
||||
Persistent = true;
|
||||
RandomizedDelaySec = "2h";
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = ["timers.target"];
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.services.hyprpaper = let
|
||||
hyprpaperConf = pkgs.writeText "hyprpaper.conf" ''
|
||||
ipc = true
|
||||
|
||||
Reference in New Issue
Block a user