From c7411635f741ce0c07bef90815c8cea92ab963e1 Mon Sep 17 00:00:00 2001 From: ahuston-0 Date: Sun, 26 Jan 2025 12:00:51 -0500 Subject: [PATCH] add optional attic push Signed-off-by: ahuston-0 --- .github/workflows/flake-health-checks.yml | 2 ++ utils/attic-push.bash | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100755 utils/attic-push.bash diff --git a/.github/workflows/flake-health-checks.yml b/.github/workflows/flake-health-checks.yml index d7445a7..dcd7145 100644 --- a/.github/workflows/flake-health-checks.yml +++ b/.github/workflows/flake-health-checks.yml @@ -21,5 +21,7 @@ jobs: endpoint: ${{ secrets.ATTIC_ENDPOINT }} cache: ${{ secrets.ATTIC_CACHE }} token: ${{ secrets.ATTIC_TOKEN }} + skip-push: "true" - uses: actions/checkout@v4 - run: nix flake check --accept-flake-config + - run: nix ./utils/attic-push.bash diff --git a/utils/attic-push.bash b/utils/attic-push.bash new file mode 100755 index 0000000..a98efb5 --- /dev/null +++ b/utils/attic-push.bash @@ -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