Skip to content

Commit

Permalink
fix: add withExtensions attribute to avoid deleting existing defaul…
Browse files Browse the repository at this point in the history
…t set of extensions.
  • Loading branch information
drupol committed Jun 30, 2022
1 parent 01b94a1 commit 9439ba2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ flake:
php = (nix-shell.api.makePhp system {
php = "php81";
extensions = [ "pcov" "xdebug" ];
withExtensions = [ "pcov" "xdebug" ];
withoutExtensions = [ "sodium" ];
extraConfig = ''
memory_limit=-1
Expand Down
7 changes: 4 additions & 3 deletions src/phps.nix
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ let
{
php
, extensions ? [ ]
, withExtensions ? [ ]
, withoutExtensions ? [ ]
, extraConfig ? ""
, extraConfigFile ? "${builtins.getEnv "PWD"}/.user.ini"
Expand All @@ -140,9 +141,9 @@ let
pkgs = import ./pkgs.nix nixpkgs system;
nixphps = import ./nixphps.nix nix-phps system;

withExtensions = builtins.filter
withExtensionsFiltered = builtins.filter
(x: !builtins.elem x withoutExtensions)
(pkgs.lib.unique (if extensions == [] then phpMatrix."${php}".extensions or [] else extensions));
(pkgs.lib.unique (phpMatrix."${php}".extensions) ++ withExtensions);

phpDrv = if builtins.isString php then (nixphps."${php}" or pkgs."${php}") else php;
in
Expand All @@ -154,7 +155,7 @@ let
(
builtins.filter
(ext: if builtins.isString ext then all ? "${ext}" else ext)
withExtensions
withExtensionsFiltered
)
);
});
Expand Down

0 comments on commit 9439ba2

Please sign in to comment.