[Nix-dev] Configuring Packages installed with `nix-env` is impossible?

Bit Shift bitshift at bigmacintosh.net
Mon Jul 21 20:53:02 CEST 2014


On 21/07/2014 05:30, Roger Qiu wrote:
> Hello,
>
> The NixOS manual specifies 2 ways of installing packages, the
> declarative style through configuration.nix + nixos-rebuild switch, or
> the per-user style via `nix-env -i`.
>
> While you can configure the package options inside configuration.nix,
> how does one configure packages when they are installed on a per-user style.
>
> For example if I install NGINX or PHP with `nix-env -i nginx` or
> `nix-env -i php`, I get NGINX and PHP on my particular `~/.nix-profile`.
>
> How do I change the configuration inside nginx.conf or php.ini or
> php-fpm.ini?
>
> There doesn't seem to be any way to do so. The `~/.nix-profile` is
> read-only.
>
> What if there was a per-user configuration.nix which was able to
> actually configure the packages, or maybe the options could be specified
> on the command line as part of `nix-env`.
>
> Otherwise, there doesn't seem to be any way of effectively using
> complicated packages on a per-user basis such NGINX, Apache, PHP and
> every other package that requires configuration.
>
> Thanks,
> Roger
>

nix-env -i (or preferably -iA for no ambiguity) will use the function 
you define for the packageOverrides attr in ~/.nixpkgs/config.nix and 
install the new/changed derivations it results in.

It's already explained in [1], so I'll refrain from trying to rephrase 
it myself and probably distort some of the meaning.

-B

[1]: 
https://nixos.org/wiki/Nix_Modifying_Packages#Overriding_Existing_Packages



More information about the nix-dev mailing list