As a poor-man’s alternative to an up-to-date binary cache, I’ve set up a user service that regularly fetches the latest versions of flakes I use often and builds them, so the results are already present in my nix cache:
So for example:
bjackman.nix-warmups = [
"github:bjackman/limmat-kernel-nix/master#devShells.${pkgs.stdenv.hostPlatform.system}.kernel"
"github:bjackman/boxen/master#devShells.${pkgs.stdenv.hostPlatform.system}.default"
];
That’s where I set it up for a couple of devShells that I use a lot, which can take a few minutes to build if the dependencies have updated.
Well, I wanna do this for my actual NixOS and Home Manager configs.
For NixOS systems I just did this:
bjackman.nix-warmups = [
"github:bjackman/boxen/master#nixosConfigurations.${pkgs.stdenv.hostPlatform.system}.${osConfig.networking.hostName}"
];
That happens to work fine but the equivalent for standalone Home Manager setups (i.e. where I’m using a heathen distro):
bjackman.nix-warmups = [
# Doesn't work!
"github:bjackman/boxen/master#homeConfigurations.${config.home.username}"
];
This doesn’t work because not all of my NixOS configurations are defined in the flake that way, some are defined as $user@host for example.
Obviously just defining this individually for each host is not that bad, but I’m curious about this.
Is there any way to figure out the flake ref for the configuration that’s currently being built?