add attic back in #1

Merged
ahuston-0 merged 22 commits from feature/attic into main 2025-01-26 13:28:26 -05:00
2 changed files with 24 additions and 0 deletions
Showing only changes of commit c7411635f7 - Show all commits

View File

@ -21,5 +21,7 @@ jobs:
endpoint: ${{ secrets.ATTIC_ENDPOINT }} endpoint: ${{ secrets.ATTIC_ENDPOINT }}
cache: ${{ secrets.ATTIC_CACHE }} cache: ${{ secrets.ATTIC_CACHE }}
token: ${{ secrets.ATTIC_TOKEN }} token: ${{ secrets.ATTIC_TOKEN }}
skip-push: "true"
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- run: nix flake check --accept-flake-config - run: nix flake check --accept-flake-config
- run: nix ./utils/attic-push.bash

22
utils/attic-push.bash Executable file
View 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