Skip to content

Commit 94aa7d4

Browse files
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

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

internal/impl/tmpl/flake.nix.tmpl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
outputs = { self, nixpkgs, flake-utils }:
1111
flake-utils.lib.eachDefaultSystem (system:
1212
let pkgs = nixpkgs.legacyPackages.${system};
13+
{{- range .Definitions}}
14+
{{.}}
15+
{{- end }}
1316

1417
in {
1518
devShell = pkgs.mkShell {
@@ -38,9 +41,9 @@
3841
{{- end }}
3942
'';
4043

41-
buildInputs = [
44+
buildInputs = with pkgs; [
4245
{{- range .DevPackages}}
43-
pkgs.{{.}}
46+
{{.}}
4447
{{end -}}
4548
];
4649
};

0 commit comments

Comments
 (0)