add optional attic push
Some checks failed
Some checks failed
Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
This commit is contained in:
22
utils/attic-push.bash
Executable file
22
utils/attic-push.bash
Executable file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env nix
|
||||
#! nix shell nixpkgs#bash nixpkgs#jq nixpkgs#gnused nixpkgs#nixVersions.latest nixpkgs#attic-client --command bash
|
||||
|
||||
set -x
|
||||
set -v
|
||||
set -e
|
||||
|
||||
# retrieve all paths under 100M
|
||||
nix_paths=$(nix path-info --json --all --closure-size \
|
||||
| jq 'map_values(.closureSize | select(. < 1e8)) | to_entries | sort_by(.value)' \
|
||||
| jq 'map(.key) | join("\n")' | sed 's/\\n/\n/g')
|
||||
|
||||
readarray -t nix_path_array < <(echo "$nix_paths")
|
||||
|
||||
batchsize=10
|
||||
|
||||
for((i=0; i < ${#nix_path_array[@]}; i+=batchsize))
|
||||
do
|
||||
part=( "${nix_path_array[@]:i:batchsize}" )
|
||||
|
||||
attic push "${part[@]}"
|
||||
done
|
Reference in New Issue
Block a user