nix-community / cache-nix-action

Cache Nix store in GitHub Actions to speed up workflows [maintainer=@deemp]
MIT License
29 stars 6 forks source link

Stabilize cache size on `macOS` runners. #1

Closed deemp closed 11 months ago

deemp commented 12 months ago

Problem

Code

Restore

Save

N.B.

Logs are printed when a script finishes.

Example 1

Initial cache size: 39 MB (src)

Installing findutils (src) takes almost a minute.

Mon, 03 Jul 2023 15:06:58 GMT  [START] Installing cross-platform GNU findutils.
Mon, 03 Jul 2023 15:06:58 GMT  
Mon, 03 Jul 2023 15:06:58 GMT  
Mon, 03 Jul 2023 15:06:58 GMT  nix profile install nixpkgs#findutils 2> /Users/runner/work/nix-cache/logs
Mon, 03 Jul 2023 15:06:58 GMT  
Mon, 03 Jul 2023 15:06:58 GMT  cat /Users/runner/work/nix-cache/logs
Mon, 03 Jul 2023 15:07:47 GMT
Mon, 03 Jul 2023 15:07:47 GMT  
Mon, 03 Jul 2023 15:07:47 GMT  
Mon, 03 Jul 2023 15:07:47 GMT  [FINISH] Installing cross-platform GNU findutils.

Final cache size: 112 MB (src)

Example 2

With verbose logs https://github.com/deemp/cache-nix-too/actions/runs/5447637002/jobs/9909864274#step:4:126

Nixos/nix

Now also tracked in https://github.com/NixOS/nix/issues/8641

deemp commented 11 months ago

Another approach is to cache the full store. It's implemented here