Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nix Composable Derivation Options

I'm trying to understand what options are available for me in my configuration.nix for particular programs, by searching the pkgs sub-folder of nixpkgs's source tree, picking out the module's definitions to understand the available options. However, I'm running into a troublesome case for PHP - it's a special derivation, a composable derivation. I'm not able to see what options I have available with PHP - something that would be tremendously helpful for enabling special modules like mcrypt, gd, etc. Any help with this would be greatly appreciated!

like image 383
Athan Clark Avatar asked May 14 '14 16:05

Athan Clark


People also ask

What is a Nix derivation?

Derivations are the building blocks of a Nix system, from a file system view point. The Nix language is used to describe such derivations.

What is Nixpkg?

Overview of Nixpkgs. The Nix Packages collection (Nixpkgs) is a set of thousands of packages for the Nix package manager, released under a permissive MIT/X11 license. Packages are available for several platforms, and can be used with the Nix package manager on most GNU/Linux distributions as well as NixOS.

What is Nix Darwin?

Nix (and nixpkgs) is all you need to install packages. What nix-darwin adds is configuration and service management using the same mechanism as NixOS and it's mostly intended for users that use or know NixOS and want to have some of the same features on a mac.

What is nix shell?

Description. The command nix-shell will build the dependencies of the specified derivation, but not the derivation itself. It will then start an interactive shell in which all environment variables defined by the derivation path have been set to their corresponding values, and the script $stdenv/setup has been sourced.


1 Answers

It took me a while to figure this out but the right way to use composeDerivation for setting the php package build features is this:

  # config.nix   {    packageOverrides = pkgs: rec {       php = pkgs.php.merge {         cfg = {           imapSupport = false;           intlSupport = false;           fpmSupport = false;         };       };    };   } 

This overrides the default values in cfg specified in php/default.nix (imapSupport, intlSupport and fpmSupport get turned off). You can either place that file in ~/.nixpkgs/config.nix to be active system-wide or use it in another nix file like so to customize the global nixpkgs:

pkgs = import <nixpkgs> { config = (import ./config.nix);  }; 
like image 63
as. Avatar answered Oct 05 '22 12:10

as.