Skip to content

Instantly share code, notes, and snippets.

@Aleksanaa
Last active December 20, 2023 17:05
Show Gist options
  • Save Aleksanaa/458f4b9f9e638d9c75a60c80885054e8 to your computer and use it in GitHub Desktop.
Save Aleksanaa/458f4b9f9e638d9c75a60c80885054e8 to your computer and use it in GitHub Desktop.
Disable built-in flake registry in Nix

If you think flake registry is a crap, just add this to your system configuration:

{ inputs, ... }:

{
  nix = {
    settings.flake-registry = builtins.toFile "global-registry.json" (
      builtins.toJSON { "flakes" = [ ]; "version" = 2; }
    );
    registry = (
      {
        pkgs.flake = inputs.self; # recommended
      } // lib.mapAttrs (names: flakes: { flake = flakes; }) inputs
    );
  };
}

Then next time you can use any items of inputs in /etc/nixos/flake.nix (and they are pinned to the same version in the flake.lock).

It's recommended to add a registry pointing to your overlayed packages (with your own packages merged) so that you can easily access them from the command line. You also have to point legacyPackages to your final nixpkgs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment