Skip to content

Ditch docker images in favor of local cache #1131

@martijnbastiaan

Description

@martijnbastiaan

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:

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:

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..)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions