Commit 94aa7d4
authored
[flakes] generate flake.nix file for php-related packages (#639)
## Summary
For `flake.nix`:
- we now also include the php "Definitions" and change the `buildInputs`
list so that it uses the `php` packages from `Definitions` instead of
from `nixpkgs` (if Definitions exist)
TODO for future PR:
- [ ] look into whether `buildInputs` should be `packages` in
`flake.nix`
## How was it tested?
in `examples/testdata/php/php-extensions`, started `devbox shell` with
`DEVBOX_FEATURE_FLAKES=0` and `DEVBOX_FEATURE_FLAKES=1`. Inspected the
generated `flake.nix` files.
```
❯ cat .devbox/gen/flake/flake.nix
{
description = "A devbox shell";
inputs = {
nixpkgs.url = "https://github.com/nixos/nixpkgs/archive/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62.tar.gz";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
php81 = pkgs.php81.withExtensions ({ enabled, all }: enabled ++ (with all; [ ds ]));
php81Packages.composer = php81.packages.composer;
in {
devShell = pkgs.mkShell {
shellHook =
''
# We're technically no longer in a Nix shell after this hook because we
# exec a devbox shell.
export IN_NIX_SHELL=0
export DEVBOX_SHELL_ENABLED=1
# Undo the effects of "nix-shell --pure" on SSL certs.
# See https://github.com/NixOS/nixpkgs/blob/dae204faa0243b4d0c0234a5f5f83a2549ecb5b7/pkgs/stdenv/generic/setup.sh#L677-L685
if [ "$NIX_SSL_CERT_FILE" = "/no-cert-file.crt" ]; then
unset NIX_SSL_CERT_FILE
fi
if [ "$SSL_CERT_FILE" = "/no-cert-file.crt" ]; then
unset SSL_CERT_FILE
fi
# Append the parent shell's PATH so that we retain access to
# non-Nix programs, while still preferring the Nix ones.
export "PATH=$PATH:$PARENT_PATH"
'';
buildInputs = with pkgs; [
php81
php81Packages.composer
php81Extensions.ds
];
};
}
);
}
```1 parent a9ee3cd commit 94aa7d4
1 file changed
+5
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
| |||
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
41 | | - | |
| 44 | + | |
42 | 45 | | |
43 | | - | |
| 46 | + | |
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
| |||
0 commit comments