-
Notifications
You must be signed in to change notification settings - Fork 2
Description
We currently use docker images to cache our complete Nix (development) shell. We've gathered quite a few dependencies now, making the docker image ~20 GB. This didn't really used to be a problem -- our internet connections are fast enough to upload/download these images once a month when we update. Unfortunately, 5 years after GH's acquisition, we've officially entered the second stage of enshittification making this process take the better part of a day. To work around this, we could move /nix to local directories.
As a start, we should not build the complete shell in Dockerfile anymore:
bittide-hardware/.github/docker/Dockerfile
Lines 43 to 44 in ef7f8b7
| RUN \ | |
| nix develop -j$(nproc) --extra-experimental-features "nix-command flakes" --command bash -c "echo OK" |
Instead relying on "booting" the Nix environment with the lines above:
bittide-hardware/.github/docker/Dockerfile
Lines 37 to 41 in ef7f8b7
| RUN \ | |
| nix profile --extra-experimental-features "nix-command flakes" install nixpkgs#cachix | |
| RUN \ | |
| USER=root cachix use bittide-hardware |
We should then, in the Dockerfile still, move /nix to /docker_nix. Next, /nix should be bound to a path on the host:
volumes:
- /cache/${{ runner.name}}/nix:/nix
Every job should then have a "setup nix" job that checks whether /nix is empty. If it is, /docker_nix should be copied into it.
(Other ideas welcome..)