[Nix-dev] Nix expression writing conventions
Marc Weber
marco-oweber at gmx.de
Thu Jul 29 17:09:29 CEST 2010
Excerpts from Sander van der Burg - EWI's message of Thu Jul 29 16:52:29 +0200 2010:
> I noticed that we have several conventions to deal with package names
> and version numbers inside Nix expressions for various reasons. For
> instance, some expressions explicitly write the name and version
> number everywhere, without referring to attributes, e.g.:
>
> {stdenv, fetchurl, gettext}:
>
> stdenv.mkDerivation {
> name = "hello-1.0";
> src = fetchurl {
> url = mirror://gnu/hello/hello-1.0.tar.gz;
> sha256 = "123456789abcdefgh";
> };
> buildInputs = [ gettext ];
> }
For exactly this case we could introduce a
stdenv.mkDerivation {
name = "hello-1.0";
src = fetchurl { url = mirror://gnu/hello/hello-1.0.tar.gz;
nameVersionMustMatchUrlVersion = true;
}
option which gets the name "hello-1.0" from src and compares it against
the name of the derivation. It could be set the default.
Even an external tool could run that check easily.
There are many ways .. which is best?
My opinion is: Unless we know we should not spend too much effort on it :)
Marc Weber
More information about the nix-dev
mailing list