repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
RSX.mdMarkdown139 lines7.1 KiBsource raw download

rsx — rsync, dressed#

rsx fits the x-family naming; rxs is an equivalent spelling. Installed in ~/.local/bin, using the existing ricefx theme palette, animated wordmark and shimmering progress bar. Only Python's standard library and rsync are required; without ricefx there is a static Rosé Pine fallback.

rsx ~/Documents/ /mnt/backup/Documents/
rsx preview ~/Documents/ /mnt/backup/Documents/
rsx mirror -n ~/Documents/ /mnt/backup/Documents/
rsx mirror ~/Documents/ /mnt/backup/Documents/
rsx -z -e 'ssh -p 2222' ./project/ user@host:~/project/
rsx --exclude='.git/' --exclude='node_modules/' ./project/ /mnt/backup/
rsx --command mirror ./project/ /mnt/backup/project/
rsx-cheat

copy is the default. It copies/updates files, replacing changed destination files and retaining destination-only files. mirror additionally supplies --delete-delay --itemize-changes: extra destination files are deleted. Neither mode asks for confirmation. Use rsx mirror -n ... to inspect a mirror first.

preview supplies --dry-run --itemize-changes. It runs rsync to inspect the paths but does not transfer or delete files. It can contact an SSH server, so normal SSH authentication and known-host handling still apply. --command prints the invocation without running rsync or contacting a host.

The defaults are --archive --human-readable --partial --info=progress2 --stats. The child environment defaults RSYNC_PARTIAL_DIR to .rsync-partial, without overriding an existing setting. This stages interrupted data separately from completed destination files. Repeating a remote delta transfer can reuse the saved data. Local rsync defaults to whole-file transfer; use --no-whole-file when local delta reuse is wanted. Explicit --partial-dir, --no-partial, and --inplace retain their rsync meanings. These choices follow the official rsync manual.

Archive mode preserves symlinks, permissions, modification times, owners and groups as privileges allow, and special files. It does not imply hard links, ACLs or extended attributes; add -HAX when needed. Rsync is a one-way copy tool, not a two-way conflict resolver.

A trailing slash is significant: src/ copies the contents; src copies the directory. The wrapper preserves arguments exactly, including spaces, multiple sources, SSH paths, options and --. To transfer a local directory with a reserved mode name, use ./copy, ./preview, etc., or put it after --.

Wrapper flags --plain and --command must precede the mode and all rsync arguments. All remaining options are parsed by rsync, so existing recipes work:

rsx --plain --bwlimit=10m ./source/ ./destination/
rsx raw -av --inplace ./source/ ./destination/
rsx raw --help

raw executes rsync directly with no injected flags or environment defaults. --plain, NO_COLOR, RICEFX_OFF, RSX_PLAIN, redirected stdout/stderr, and quiet mode bypass rendering while retaining normal copy defaults. In plain mode stdout/stderr and exit status belong directly to rsync. In themed mode only stdout is rendered; stderr and stdin remain attached for errors and SSH prompts. Native progress percentages can change as rsync discovers more files.

rsx-cheat is discovered by xcheats. Zsh completion uses the existing rsync completer after removing wrapper words. New shells load it from ~/.dotfiles/completions/_rsx; to register it in an already open shell:

autoload -Uz _rsx
compdef _rsx rsx rxs

Verification suite: python3 ~/.dotfiles/scripts/tests/rsx.test.py. All file transfers and deletion checks in that suite use an isolated temporary directory.

Cloud folders — Google Drive and pCloud#

~/GDrive is an rclone mount (systemctl --user enable --now rclone-gdrive), and ~/pCloudDrive is mounted by the pCloud Drive app. Both are FUSE filesystems that reject the POSIX metadata rsync tries to preserve, so rsx handles them:

rsx cloud ~/Documents/Notes/ ~/GDrive/Notes/     # ask for it by name
rsx ~/Documents/Notes/ ~/GDrive/Notes/           # or let it be detected
rsx --cloud mirror -n ~/Documents/Notes/ ~/GDrive/Notes/
rsx --no-cloud ~/Documents/Notes/ ~/GDrive/Notes/    # plain rsync behaviour

Any of those adds --copy-links --no-perms --omit-dir-times, plus --no-owner --no-group, which only matter under sudo. Detection reads /proc/self/mountinfo and matches an argument that points into a mount of type fuse.rclone, fuse.google-drive-ocamlfuse, fuse.onedriver, fuse.s3fs, fuse.mega, fuse.dropbox, or a plain fuse mount whose source is pCloud, Dropbox, MEGA or Insync. fuse.gocryptfs and sshfs are deliberately absent: they keep POSIX metadata perfectly well. Remote (user@host:) arguments are never matched. When detection fires, rsx says so on stderr before rsync starts.

The flags sit ahead of your arguments, so a later rsync flag still wins: rsx cloud --perms SRC/ DEST/ preserves permissions again. --copy-links has no rsync opposite — use --no-cloud (or rsx raw) to get none of it.

flag why
--copy-links neither mount can store a symlink. Without it rsync fails that entry with Input/output error (Drive) or Function not implemented (pCloud) and exits 23, having copied everything else.
--no-perms the mounts publish their own modes (644/755, from --umask on the rclone unit). A 640 source file is re-chmoded on every run, forever, showing up as .f...p..... in --itemize-changes.
--omit-dir-times directory mtimes do not stick, so each run re-writes them (.d..t......).

Verified on both mounts: with those three flags a second run itemises nothing and exits 0. Modification times of regular files are preserved (truncated to the second), so ordinary size+mtime comparison works and unchanged files are not re-uploaded — no need for --checksum or --size-only.

Check the mount before writing — detection cannot fire on a path that is not a mount, and an unmounted ~/GDrive looks exactly like an ordinary directory:

mountpoint -q ~/GDrive && rsx cloud SRC/ ~/GDrive/DEST/

Anything written to ~/GDrive while the unit is stopped is an ordinary local file. It never reaches Google Drive, and starting the mount hides it underneath the mountpoint until the mount is stopped again.

Verify an upload with rclone check -L SRC gdrive:DEST. The -L matters: rsx cloud uploads what each symlink points at, and without it rclone refuses to follow the local symlink and reports the uploaded file as a difference.

Both mounts cache writes: rclone stages them in ~/.cache/rclone (--vfs-cache-mode=full) and the pCloud app in its own cache, so rsync can finish before the upload does. Keep the source until the cache drains, and prefer rclone check over trusting a finished copy.

rsx mirror into a cloud folder deletes destination-only files there as well — preview with rsx mirror -n SRC/ ~/GDrive/DEST/ first (detection covers mirror and preview too).

For many files, hash verification, bandwidth limits or no mount at all, use rclone directly: rclone copy SRC gdrive:DEST -P. The card is rclone-cheat (rclone-cheat rsx for the bridge between the two tools).