Files
nix-config/modules/base/packages.nix
T
ryan4yin | 二花 6e0d44c50d feat(nixos): manage scattered trash dirs with trash-cli retention timer (#265)
* feat(nushell): add trash command using the home trash can

On a tmpfs root with persistent dirs bind-mounted in, `rm --trash`
scatters items into per-mount .Trash-$uid dirs that file managers never
show, and gio refuses to trash on those internal mounts.

Add a `trash` command implementing the freedesktop trash spec
'failsafe' mode: items are moved to ~/.local/share/Trash with
spec-compliant .trashinfo entries, so Thunar can list and restore them.

Also preserve ~/.local/share/Trash on idols-ai so the trash survives
reboots.

* feat(nixos): manage scattered trash dirs with trash-cli retention timer

Replace the hand-written nushell trash command with the established
trash-cli tooling. On a tmpfs root with persistent dirs bind-mounted
in, the trash crate (nushell rm --trash) scatters items into per-mount
.Trash-$uid dirs that file managers never show and nothing cleans up.

- add trash-cli to system packages: trash-list scans/trash-restore
  handles every mount point's trash dir
- daily systemd timer runs 'trash-empty 30 -f', purging items older
  than 30 days across the home trash and all mount points
- drop the hand-written trash.nu module
- note in preservation.nix: do NOT persist ~/.local/share/Trash; a
  bind-mounted trash dir breaks the trash crate's home-topdir match
  for files straight under $HOME (it would try /.Trash-$uid, EACCES)

* fix(nixos): order trash-empty after preservation.target

The scattered .Trash-$uid dirs live inside the preservation bind
mounts, which use DefaultDependencies=no and are therefore NOT ordered
after local-fs.target. Add preservation.target to After= so trash-empty
only runs once all those mounts are up.
2026-08-23 23:40:53 +08:00

92 lines
2.8 KiB
Nix

{ pkgs, ... }:
{
# Default editor: Helix (`hx`). Privileged edits (`sudoedit`, …) prefer `nvim --clean`
# via `SUDO_EDITOR`; invoke `nvim --clean` manually for other sensitive workflows.
environment.variables = {
EDITOR = "hx";
VISUAL = "hx";
SUDO_EDITOR = "nvim --clean";
};
environment.systemPackages = with pkgs; [
# core tools
nushell # nushell
fastfetch
helix # default $EDITOR (`hx`)
neovim # backup editor; `nvim --clean` for sensitive / privileged edits (`$SUDO_EDITOR`)
gnumake # Makefile
just # a command runner like gnumake, but simpler
git # used by nix flakes
git-lfs # used by huggingface models
# system monitoring
procs # a moreden ps
btop
# archives
zip
xz
zstd
unzipNLS
p7zip
# Text Processing
# Docs: https://github.com/learnbyexample/Command-line-text-processing
gnugrep # GNU grep, provides `grep`/`egrep`/`fgrep`
gawk # GNU awk, a pattern scanning and processing language
gnutar
gnused # GNU sed, very powerful(mainly for replacing text in files)
sad # CLI search and replace, just like sed, but with diff preview.
jq # A lightweight and flexible command-line JSON processor
yq-go # yaml processor https://github.com/mikefarah/yq
jc # converts the output of popular cli tools & file-types to JSON, YAML
# Interactively filter its input using fuzzy searching, not limit to filenames.
fzf
# search for files by name, faster than find
fd
findutils
# search for files by its content, replacement of grep
(ripgrep.override { withPCRE2 = true; })
duf # Disk Usage/Free Utility - a better 'df' alternative
dust # A more intuitive version of `du` in rust
gdu # disk usage analyzer(replacement of `du`)
ncdu # analyzer your disk usage Interactively, via TUI(replacement of `du`)
# networking tools
mtr # A network diagnostic tool(traceroute)
gping # ping, but with a graph(TUI)
dnsutils # `dig` + `nslookup`
ldns # replacement of `dig`, it provide the command `drill`
doggo # DNS client for humans
wget
curl
curlie # curl with httpie
httpie
aria2 # A lightweight multi-protocol & multi-source command-line download utility
socat # replacement of openbsd-netcat
nmap # A utility for network discovery and security auditing
ipcalc # it is a calculator for the IPv4/v6 addresses
iperf3 # network performance test
hyperfine # command-line benchmarking tool
tcpdump # network sniffer
# file transfer
rsync
croc # File transfer between computers securely and easily
# security
libargon2
openssl
# misc
file
which
tree
tealdeer # a very fast version of tldr
trash-cli # freedesktop trash can CLI: trash-list / trash-restore / trash-put / trash-empty
];
}