Intent To Ship: Deprecating Usage Of Flake Registry Entries In `flake.nix` Inputs

by ADMIN 82 views

Deprecation of Flake Registry Entries: A Step Towards Predictable Nix User Experience

As part of our ongoing efforts to improve the Determinate Nix user experience, we are announcing our intent to deprecate the usage of shorthand flake registry entries as flake.nix input URLs. This change aims to eliminate user confusion and surprising behavior around global and local registries during flake input resolution.

Why Deprecate Flake Registry Entries?

The flake registry provides an essential UX affordance for using Nix flakes and remote sources in command-line uses. However, we have observed a pattern of confusion when using automatic flake inputs and local registries. Specifically, users' flake inputs resolving and locking inconsistently depending on the configuration of the host system. This unpredictability can lead to frustrating experiences and hinder the adoption of Nix.

The Goal: Predictable User Experience

Our goal is to make the user experience of Nix more predictable. By deprecating the usage of shorthand flake registry entries, we aim to provide a more consistent and reliable experience for users. This change will enable users to better understand how their flake inputs are resolved and locked, reducing the likelihood of unexpected behavior.

What's Happening Next?

We will start by simply printing a warning when flake inputs use entries from the registry. This will give users a chance to adapt to the new behavior and update their flake inputs accordingly. As part of this process, we're interested in hearing from Determinate Nix users who depend on using registries for lock inputs.

Examples of Deprecated Behavior


The following examples illustrate the deprecated behavior:

Implicit nixpkgs Input

{
  outputs = { nixpkgs, ... }: {
    packages.aarch64-darwin.hello = nixpkgs.legacyPackages.aarch64-darwin.hello;
  };
}

In this example, the flake uses an implicit nixpkgs input, which is resolved through the registry.

Explicit nixpkgs Input with Registry URL

{
  inputs.nixpkgs.url = "nixpkgs/nixos-24.11";
  outputs = { nixpkgs, ... }: {
    packages.aarch64-darwin.hello = nixpkgs.legacyPackages.aarch64-darwin.hello;
  };
}

In this example, the flake uses nixpkgs and defines a corresponding input, but uses a registry URL.

What to Do


To update your flake inputs, replace the registry format with a fully qualified flakeref. For example:

{
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
  outputs = { nixpkgs, ... }: {
    packages.aarch64-darwin.hello = nixpkgs.legacyPackages.aarch64-darwin.hello;
  };
}

By making this change, you will ensure that your flake inputs are resolved and locked consistently, providing a more predictable user experience.

Conclusion

Q: What is the flake registry, and why is it being deprecated?

A: The flake registry is a feature in Nix that provides an essential UX affordance for using Nix flakes and remote sources in command-line uses. However, we have observed a pattern of confusion when using automatic flake inputs and local registries. Specifically, users' flake inputs resolving and locking inconsistently depending on the configuration of the host system. This unpredictability can lead to frustrating experiences and hinder the adoption of Nix.

Q: What is the goal of deprecating flake registry entries?

A: Our goal is to make the user experience of Nix more predictable. By deprecating the usage of shorthand flake registry entries, we aim to provide a more consistent and reliable experience for users. This change will enable users to better understand how their flake inputs are resolved and locked, reducing the likelihood of unexpected behavior.

Q: What will happen to the flake registry after it is deprecated?

A: The flake registry will not be deprecated entirely. It will still be used for command-line incantations, like nix run. However, the usage of shorthand flake registry entries as flake.nix input URLs will be deprecated.

Q: How will users be affected by the deprecation of flake registry entries?

A: Users who depend on using registries for lock inputs will need to update their flake inputs to use fully qualified flakerefs. This change will provide a more predictable and reliable experience for users.

Q: What is a fully qualified flakeref, and how do I use it?

A: A fully qualified flakeref is a URL that specifies the location of a flake input. For example: github:NixOS/nixpkgs/nixos-24.11. To use a fully qualified flakeref, you need to update your flake inputs to use the new format.

Q: How can I update my flake inputs to use fully qualified flakerefs?

A: To update your flake inputs, you need to replace the registry format with a fully qualified flakeref. For example:

{
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
  outputs = { nixpkgs, ... }: {
    packages.aarch64-darwin.hello = nixpkgs.legacyPackages.aarch64-darwin.hello;
  };
}

Q: What if I'm using a flake input that is not a fully qualified flakeref?

A: If you're using a flake input that is not a fully qualified flakeref, you will need to update it to use the new format. You can do this by replacing the registry format with a fully qualified flakeref.

Q: How can I get help with updating my flake inputs?

A: If you need help with updating your flake inputs, you can reach out to the Determinate Nix community for support. We're here to help you make transition to using fully qualified flakerefs.

Q: What is the timeline for the deprecation of flake registry entries?

A: We will start by simply printing a warning when flake inputs use entries from the registry. This will give users a chance to adapt to the new behavior and update their flake inputs accordingly. The exact timeline for the deprecation of flake registry entries will be announced in the future.