Skip to content

Commit f224ad4

Browse files
committed
Update README.
1 parent 82c900d commit f224ad4

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

Diff for: README.md

+52-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ Import the input:
126126

127127
```nix
128128
inputs = {
129-
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
129+
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
130130
flake-utils.url = "github:numtide/flake-utils";
131131
phps.url = "github:loophp/nix-shell";
132132
};
@@ -146,6 +146,57 @@ or
146146
phps.packages.${system}.env-php81-nts
147147
```
148148

149+
You may also use the API to build your own custom version of PHP in your own
150+
flake:
151+
152+
```nix
153+
{
154+
description = "A very basic flake";
155+
156+
inputs = {
157+
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
158+
flake-utils.url = "github:numtide/flake-utils";
159+
nix-shell.url = "github:loophp/nix-shell";
160+
};
161+
162+
outputs = { self, nixpkgs, flake-utils, nix-shell }:
163+
flake-utils.lib.eachDefaultSystem
164+
(system:
165+
let
166+
pkgs = import nixpkgs {
167+
inherit system;
168+
};
169+
170+
php = (nix-shell.api.makePhp system {
171+
php = "php81";
172+
extensions = [ "pcov" "xdebug" ];
173+
withoutExtensions = [ "sodium" ];
174+
extraConfig = ''
175+
memory_limit=-1
176+
'';
177+
flags = {
178+
apxs2Support = false;
179+
ztsSupport = false;
180+
};
181+
});
182+
in
183+
{
184+
devShells = {
185+
default = pkgs.mkShellNoCC {
186+
name = "PHP project";
187+
188+
buildInputs = [
189+
php
190+
php.packages.composer
191+
pkgs.mailhog
192+
];
193+
};
194+
};
195+
}
196+
);
197+
}
198+
```
199+
149200
### Customize PHP
150201

151202
To customize the PHP configuration, you can do it like this:

0 commit comments

Comments
 (0)