[Nix-dev] Confused about packages

Marc Weber marco-oweber at gmx.de
Tue May 19 11:24:43 CEST 2015


Excerpts from Roger Qiu's message of Tue May 19 05:56:30 +0000 2015:
> Wouldn't it be better for version numbers to always exist?
You're totally right that the

  mkDerivation {
    name ="name-<version>"
  }

version should always exist. Thus if you find cases just create a topic
branch, fix, and submit once in a while.

I was quite surprised that "mysql" in all-packages.nix started pointing
to mariadb which broke my ruby overlay because headers were not found.

Thus what can you do?

there is builtins.compareVersions function, and there are "nixos" module
assertions - thus you could ensure this way that compareVersion
pkgs.mysql equals "5.0" or so - or you could just add a constraint
mysql.name = "mysql-5.0" which would fail building.

You always "know" the version as long as you're using the same nixpkgs
revision - but sometimes you have to update - and then adding such nixos
assertios would be close to what you want. Just grep nixpkgs/nixos for
assertions to see samples.

However usually upgrades "just happen to work fine" - in the end testing
for versions doesn't protect you from mal functioning (eg a dependency
could have changed) - thus what you really want is writing tests.

There are some samples in the nixpgks repository as well.

Marc Weber


More information about the nix-dev mailing list