NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.46k stars 13.65k forks source link

Change all packages from "name" to "pname"+"version", remove all uses of meta.version and meta.tag #103997

Open nh2 opened 3 years ago

nh2 commented 3 years ago

It seems like there isn't a tracking issue about this long-term effort yet (e.g. to mention in commit messages and to make it sprintable).

Nixpkgs moved to an explicit versioning scheme, with the plan to change all packages like so:

-name = "mypackage-1.2.3";
+pname = "mypackage";
+version = "1.2.3";

See the sprint checkbox list for the remaining packages: https://github.com/NixOS/nixpkgs/issues/103997#issuecomment-728752185

This obviates meta.version and meta.tag; they should be removed (as discussed in #12156).

Tangentially related: Where to put unstable versions / package names (see #68518).

Details on what's right and what isn't

Note that the following pattern is not good because it still uses name:

let
  pname = "mypackage";
  version = "1.2.3";
in
  mkDerivation {
    name = "${pname}-${version}";
  }

In the new approach, pname and version have to be given directly to mkDerivation.

You can use mkDerivation rec to be able to re-use e.g. version in src or other fields:

mkDerivation rec {
  pname = "mypackage";
  version = "1.2.3";

  src = {
    ... expression using `version` variable here ...
  };
}

Automation

You can link big treewide efforts/PRs here (tick merged ones):

Tasks

SuperSandro2000 commented 1 year ago

Yes, one FOD and one not FOD.

AndersonTorres commented 1 year ago

Now we can continue, I think :)

Stunkymonkey commented 1 year ago

I have a question about "environments" they ususally tend to not have any version. what should happen to pkgs/misc/my-env/default.nix ? what about patches?

AndersonTorres commented 1 year ago

I think they are not to be versioned at all.