svanderburg / composer2nix

Generate Nix expressions to build PHP composer packages
MIT License
88 stars 25 forks source link

How to add extensions? #15

Closed danwdart closed 3 years ago

danwdart commented 3 years ago

Hey, how can add/enable extensions to the CLI setup, e.g. xdebug?

Thanks

wmertens commented 3 years ago

You need to edit the default.nix and pass a php that has the extension enabled, e.g.

{ pkgs ? import <nixpkgs> { inherit system; }, system ? builtins.currentSystem
, noDev ? false }:

let
  composerEnv = import ./composer-env.nix rec {
    inherit (pkgs) stdenv writeTextFile fetchurl unzip;
    php =
      pkgs.php.withExtensions ({ enabled, all }: enabled ++ [ all.mailparse ]);
    phpPackages = php.packages;
  };
in import ./php-packages.nix {
  inherit composerEnv noDev;
  inherit (pkgs) fetchurl fetchgit fetchhg fetchsvn;
}

Not ideal to edit generated files :(

danwdart commented 3 years ago

Thanks! Maybe such things can be integrated into the generator.