fh icon indicating copy to clipboard operation
fh copied to clipboard

question: how do I reference github:NixOS/nixpkgs/nixos-23.11 in Flakehub?

Open a-h opened this issue 1 year ago • 3 comments

When using a standard Github flake reference, I can use the nixos-23.11 tag:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
  };
}

However, nix flake init --template "github:DeterminateSystems/zero-to-nix#go-dev" produces this:

{
  inputs = {
    nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2305.491812.tar.gz";
  };
}

I don't know what version that is, I have to look at the flake.lock to find that it's 5550a85a087c04ddcace7f892b0bdc9d8bb080c8 and I can't find a way to view the information in the Flakehub website. Playing with the URL like this: https://flakehub.com/flake/NixOS/nixpkgs/0.2305.491812 just gives me a 404.

For a few months, I've been replacing the flakehub link with github:NixOS/nixpkgs/nixos-23.11, because I don't know how to use the tag I want with flakehub.

So I thought that other people are probably doing the same.

Does flakehub support the use of nixos-23.11 style tags or is that not the concept? How should users think about it?

Thanks!

a-h avatar Mar 23 '24 10:03 a-h

Playing with the URL like this: https://flakehub.com/flake/NixOS/nixpkgs/0.2305.491812 just gives me a 404.

That's because we have a hidden git revision in the URL.

Does flakehub support the use of nixos-23.11 style tags or is that not the concept? How should users think about it?

Yes it does -- 0.2305.XXXXX is basically nixos-23.05. So, to get nixos-23.11, you'd use 0.2311. You can see a list of all releases here: https://flakehub.com/flake/NixOS/nixpkgs/releases

cole-h avatar Mar 23 '24 23:03 cole-h

Thanks, that makes sense.

I noticed the releases, but there's 400+ of them. I scrolled through lots of pages, but didn't see anything that looked like 23.11 on its own.

nixpkgs has tags of both 23.11 and nixos-23.11. 23.11 hasn't been updated for 4 months, https://github.com/NixOS/nixpkgs/tree/23.11 while nixos-23.11 gets security updates and bugfixes, so I was also concerned I'd end up with 23.11 rather than nixos-23.11.

From reading the semantic version docs, I think I want: https://api.flakehub.com/f/NixOS/nixpkgs/~0.2311.tar.gz although, I did expect it to be 23.11.

But... the UI doesn't provide a human readable version at any of the following URLs for me to check it:

  • https://flakehub.com/NixOS/nixpkgs/~0.2311
  • https://flakehub.com/flake/NixOS/nixpkgs/~0.2311
  • https://flakehub.com/flake/NixOS/nixpkgs/23.11
  • https://flakehub.com/flake/NixOS/nixpkgs/0.2311
  • https://flakehub.com/flake/NixOS/nixpkgs/0.2311.0+rev-56528ee42526794d413d6f244648aaee4a7b56c0
  • https://flakehub.com/flake/NixOS/nixpkgs/0.2311+rev-56528ee42526794d413d6f244648aaee4a7b56c0

Any pointer on the correct human URL?

Thanks!

a-h avatar Mar 24 '24 09:03 a-h

We have special handling for Nixpkgs. When using 0.2311.0 (or 0.2311.1, or 0.2311.6500) as a flake input, it will use semver version resolution to get the latest version of nixos-23.11 (not the 23.11 tag) that is "compatible" (i.e. 0.2311.6500 cannot resolve to 0.2311.6499, but it could resolve to 0.2311.6501 or 0.2311.6502, or....).

The "human readable" version will be any of them with the fully specified version (i.e. the latest at the time of writing is https://flakehub.com/flake/NixOS/nixpkgs/0.2311.556903+rev-56528ee42526794d413d6f244648aaee4a7b56c0). The reason https://flakehub.com/flake/NixOS/nixpkgs/0.2311+rev-56528ee42526794d413d6f244648aaee4a7b56c0 wasn't working was because you were missing the exact "patch" version 556903.

The newest versions should be on the very first page at the top, but to get to the FlakeHub page of a specific version, you'd need to look at the flake.lock file and find the locked URL, and copy the version portion, i.e.:

        "url": "https://api.flakehub.com/f/pinned/nix-community/fenix/0.1.1727%2Brev-66fc1883c34c42df188b83272445aedb26bb64b5/018cc416-f0ae-724d-989f-aa4ded05d885/source.tar.gz"

would become

https://flakehub.com/flake/nix-community/fenix/0.1.1727%2Brev-66fc1883c34c42df188b83272445aedb26bb64b5

cole-h avatar Mar 25 '24 15:03 cole-h