KaiHa / nix-debian

Packaging of the nix package manager for Debian
17 stars 3 forks source link

move nix store path to /var/lib/nix? #17

Closed thkoch2001 closed 5 years ago

thkoch2001 commented 5 years ago

I know I've seen this discussion somewhere before but can't find it anymore. Maybe you know? Still we should think about it once before including nix into Debian since it would be hard to change it afterwards.

The Debian policy requires to follow the FHS: https://www.debian.org/doc/debian-policy/ch-opersys.html#file-system-hierarchy I know that other packages go to great lengths (e.g. cfengine) to follow the policy and people might object against a package that does not follow it.

From the FHS I would expect to find the nix-store under /var/lib/nix.

On the other hand I believe that it was argued that many nix programs might act strange if the nix-store were somewhere else then at /nix.

KaiHa commented 5 years ago

Thomas Koch notifications@github.com writes:

I know I've seen this discussion somewhere before but can't find it anymore. Maybe you know? Still we should think about it once before including nix into Debian since it would be hard to change it afterwards.

AFIAK are retained dependencies the problem. These have the absolute paths (including /nix/store). Changing the nix-store path would make it impossible to use substitutes (section 5.5.3 of [1]) from the official Nix channels. In other words the user must compile everything himself and can not use binaries downloaded from the Nix channels.

In section 6.1 of the PHD thesis [1] (found here [2]) it is mentioned explicitly:

Finally, sharing is especially important in Nix because derivation outputs are typically not relocatable, since most outputs contain references to their own output path or to other paths in the Nix store. Any user can have a private Nix store, e.g., /home/alice/nix/store. However, pre-built binaries assume a particular location for the Nix store; almost always, this is /nix/store. Since the location of the Nix store is often stored in outputs, pre-built binaries are simply not applicable to a Nix store in another location in the file system. In fact, this is precisely why the location of the Nix store is part of the store path computation (page 94): different hashes are computed for the same store derivations in different Nix stores to prevent any possible mix-up through the substitute mechanism.

The Debian policy requires to follow the FHS: https://www.debian.org/doc/debian-policy/ch-opersys.html#file-system-hierarchy I know that other packages go to great lengths (e.g. cfengine) to follow the policy and people might object against a package that does not follow it.

At least snapd seems to have an exemption from the non-standard-toplevel-dir rule.

From the FHS I would expect to find the nix-store under /var/lib/nix.

On the other hand I believe that it was argued that many nix programs might act strange if the nix-store were somewhere else then at /nix.

I would prefer to have the nix-store at /nix/store, because loosing the ability to use substitutes would spoil the party for me and -- I assume -- many other users.

[1] https://nixos.org/~eelco/pubs/phd-thesis.pdf [2] https://nixos.org/~eelco/pubs/ [3] https://lintian.debian.org/full/vorlon@debian.org.html#snapd_2.30-5

thkoch2001 commented 5 years ago

Thank you. In any case we should document this in the packages README.Debian. I now also found the statement I remembered in the nix manual:

Warning: It is best not to change the Nix store from its default, since doing so makes it impossible to use pre-built binaries from the standard Nixpkgs channels — that is, all packages will need to be built from source.

https://nixos.org/nix/manual/#sec-building-source

KaiHa commented 5 years ago

Added comment in the README