Cachix

Cachix

  • Cachix is a binary cache service for the Nix package manager
  • allows you to store pre-built Nix packages in a cache, and then use the cache to install those packages, rather than building them from source.
  • can significantly speed up the process of installing packages and system builds

cache the output environment of flake.nix

    settings = {
      max-jobs = 8;
      trusted-users = [ "${config.user.name}" "root" "@admin" "@wheel" ];
      trusted-substituters = [
        "https://cache.nixos.org"
        "https://nix-community.cachix.org"
        "https://domain.cachix.org"
      ];
      trusted-public-keys = [
        "cache.nixos.org-1:0000000000000000000000000000000000000000="
        "nix-community.cachix.org-1:00000000000000000000000000000="
        "domain.cachix.org-1:000000000000000000000000000000000000000000000="
      ];
    };
  • nix flake archive --json | jq -r '.path,(.inputs|to_entries[].value.path)' | cachix push {cache_name}

Notes mentioning this note