Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nixos versions to replace channels? #6

Open
FRidh opened this issue Oct 18, 2020 · 5 comments
Open

Add nixos versions to replace channels? #6

FRidh opened this issue Oct 18, 2020 · 5 comments

Comments

@FRidh
Copy link
Member

FRidh commented Oct 18, 2020

The idea of flakes is to also replace channels. In a flake, one can choose what nixpkgs url to use. When not working with a local flake, one can invoke e.g.

nix shell nixpkgs#hello

If one wants a version from 20.09, one needs to use

$ nix shell nixpkgs#hello --override-input nixpkgs github:nixos/nixpkgs/nixos-20.09

It would be convenient if there would be registry entries for all stable versions so one could write

nix shell nixos-20.09#hello

We do need to draw a line here because we can't add all branches of whatever project. Also, it's not bad having to learn to use override-input. And, it prevents users from relying specifically on nixos-20.09 in a flake.nix where maybe they should not.

I do not know whether we should add the stable versions or not, but I can imagine here the convenience outweighs the disadvantages.

@aszlig
Copy link
Member

aszlig commented Oct 24, 2020

If one wants a version from 20.09, one needs to use

$ nix shell nixpkgs#hello --override-input nixpkgs github:nixos/nixpkgs/nixos-20.09

Why not use this instead?

$ nix shell nixpkgs/nixos-20.09#hello

But in general, I agree that just writing nixos-20.09#hello is much shorter :-)

@FRidh
Copy link
Member Author

FRidh commented Oct 25, 2020

$ nix shell nixpkgs/nixos-20.09#hello

I did not imagine this to work, actually! It was my impression nixpkgs in the global registry would point to a certain branch already.

From the registry file

      "from": {
        "id": "nixpkgs",
        "type": "indirect"
      },
      "to": {
        "owner": "NixOS",
        "repo": "nixpkgs",
        "type": "github"
      }

it seems no branch is selected. I was under the impression at least a channel was chosen.

Checking what nixpkgs resolves to

$ nix flake info nixpkgs
Resolved URL:  github:NixOS/nixpkgs
Locked URL:    github:NixOS/nixpkgs/d82188bf90f70880229a746b6dfd666a53f85b50
Description:   A collection of packages for the Nix package manager
Path:          /nix/store/1gzaxqrpydlwbbvnak4z5h5vkmp449i3-source
Revision:      d82188bf90f70880229a746b6dfd666a53f85b50
Last modified: 2020-10-25 09:52:22

$ nix flake info nixpkgs/nixos-20.09
Resolved URL:  github:NixOS/nixpkgs/nixos-20.09
Locked URL:    github:NixOS/nixpkgs/95d26c9a9f2a102e25cf318a648de44537f42e09
Description:   A collection of packages for the Nix package manager
Path:          /nix/store/wgzfnwgrrj8ach2kc971yw1vvr0fvsqs-source
Revision:      95d26c9a9f2a102e25cf318a648de44537f42e09
Last modified: 2020-10-24 10:37:53

Bare nixpkgs corresponds to master, that's something to keep in mind :)

@asymmetric
Copy link

asymmetric commented Mar 8, 2021

Independentlty of the appropriate invocation syntax, I do agree that the registry could ship with current stable + nixos-unstable as sensible defaults - and make do with the custom entries, e.g. github:edolstra and github:DavHau.

@gytis-ivaskevicius
Copy link

This sounds neat but here is a little idea to consider:

Maybe it is worth renaming nixos-unstable to nixos-rolling or something along those lines just to make it more newbie-friendly?
Especially now with flakes, it is so obvious that one can just rollback channel by simply git restore flake.lock. There is no need to even know about --rollback flag

Just a thought, possibly RFC material, but yeah, might be worth considering

@zimbatm
Copy link
Member

zimbatm commented Apr 9, 2023

One hiccup is that Nix considers that keys with a dot must be a path, and doesn't look them up even if they are in the registry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants