1
0
Files
nix-shared/pkgs/tb-scripts/default.nix
Timo Bingmann e81f3efde8 tb-scripts: add ,split-1G utility for splitting large files
Add a new utility script for splitting files into 1GB chunks:

,split-1G - File splitting wrapper
- Splits one or more files into 1GB chunks with numeric suffixes
- Uses split(1) with --bytes=1G for consistent chunk sizes
- Generates 5-digit numeric suffixes (.00000, .00001, etc) for up to 99,999 parts
- Outputs verbose progress information during splitting
- Fails fast with set -e to catch errors during multi-file operations
- Added to tb-scripts package with coreutils as runtime dependency

This is useful for preparing large files for upload to services with file
size limits, or for splitting backups/archives into manageable pieces.

Example usage:
  ,split-1G large-backup.tar.gz
  # Creates: large-backup.tar.gz.00000, large-backup.tar.gz.00001, ...

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-11 00:58:12 -08:00

30 lines
757 B
Nix

{ pkgs }:
pkgs.symlinkJoin {
name = "tb-scripts";
meta = {
description = "Custom utility scripts for TB - available on all systems";
maintainers = [ ];
};
paths = [
(pkgs.writeShellApplication {
name = ",jq_reformat";
runtimeInputs = [ pkgs.jq ];
text = builtins.readFile ./jq_reformat.sh;
})
(pkgs.writers.writePython3Bin ",rename_lower" {
libraries = [ ];
} (builtins.readFile ./rename_lower.py))
(pkgs.writeShellApplication {
name = ",zipdir";
runtimeInputs = [ pkgs.zip ];
text = builtins.readFile ./zipdir;
})
(pkgs.writeShellApplication {
name = ",split-1G";
runtimeInputs = [ pkgs.coreutils ];
text = builtins.readFile ./split-1G;
})
];
}