nix-dotfiles/utils/attic-push.bash
ahuston-0 b5f47c5638
Some checks failed
Check flake.lock / Check health of `flake.lock` (pull_request) Successful in 10s
Check Nix formatting / Perform Nix format checks (pull_request) Successful in 2m25s
Check Nix flake / Perform Nix flake checks (ubuntu-latest) (pull_request) Successful in 6m51s
Check flake.lock / Check health of `flake.lock` (push) Successful in 8s
Check Nix flake / Perform Nix flake checks (ubuntu-latest) (push) Has been cancelled
Check Nix formatting / Perform Nix format checks (push) Has been cancelled
move action cache to nayeonie.com
Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
2025-02-27 01:01:13 -05:00

23 lines
620 B
Bash
Executable File

#!/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 2G
nix_paths=$(nix path-info --json --all --closure-size \
| jq 'map_values(.closureSize | select(. < 2e9)) | to_entries | sort_by(.value)' \
| jq 'map(.key) | join("\n")' | sed -E -e 's/\\n/\n/g;s/^"//g;s/"$//g')
readarray -t nix_path_array < <(echo "$nix_paths")
batchsize=1000
for((i=0; i < ${#nix_path_array[@]}; i+=batchsize))
do
part=( "${nix_path_array[@]:i:batchsize}" )
attic push nix-cache "${part[@]}"
done