Skip to content

Regression: Nix flake ignores local registry #15441

@tobiasBora

Description

@tobiasBora

Describe the bug

I used to be able to specify in a flake nixpkgs.url = "flake:nixpkgs"; to mean that I should follow the system registry nixpkgs. This was really practical for small local projects, or when deploying a flake to multiple machines where the PATH to a flake differs between machines.

Sadly it seems like this is buggy now. This actually tries to fetch the latest version on github instead of using my local version.

Steps To Reproduce

Create flake.nix with

{
  description = "A very basic flake";

  inputs = {
    flake-parts.url = "github:hercules-ci/flake-parts";
    nixpkgs.url = "github:nixos/nixpkgs/c97c47f2bac4fa59e2cbdeba289686ae615f8ed4";
  };
  
  outputs = { flake-parts, ... } @ inputs: flake-parts.lib.mkFlake { inherit inputs; } {
    perSystem = { config, self', inputs', pkgs, system, ... }: {
      devShells.default = pkgs.mkShell {
        nativeBuildInputs = with pkgs; [
          nodejs_22
          playwright-driver.browsers
        ];

        shellHook = ''
          export PLAYWRIGHT_BROWSERS_PATH=${pkgs.playwright-driver.browsers}
          export PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true;
          export PLAYWRIGHT_NODEJS_PATH=${pkgs.nodejs_22}/bin/node
          playwright_chromium_revision="$(${pkgs.jq}/bin/jq --raw-output '.browsers[] | select(.name == "chromium").revision' ${pkgs.playwright-driver}/browsers.json)"
          export PLAYWRIGHT_LAUNCH_OPTIONS_EXECUTABLE_PATH=${pkgs.playwright-driver.browsers}/chromium-$playwright_chromium_revision/chrome-linux/chrome
          echo "Using $PLAYWRIGHT_LAUNCH_OPTIONS_EXECUTABLE_PATH"
        '';
      };
    };
    # Declared systems that your flake supports. These will be enumerated in perSystem
    systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
  };
}

and run nix develop

Expected behavior

It should use my machine nixpkgs version while I see it trying to download a very recent version.

Metadata

❯ nix-env --version
nix-env (Nix) 2.31.2

Additional context

See also discussion in https://discourse.nixos.org/t/flake-does-not-follow-local-nixpkgs-anymore-even-with-flake-nixpkgs/76052

Checklist


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions