Merge pull request #5 from drupol/php/add-php-dev-environment

feat: add PHP environment
This commit is contained in:
Luc Perkins 2022-10-21 22:08:42 +02:00 committed by GitHub
commit f89d066e0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 90 additions and 0 deletions

View file

@ -45,6 +45,7 @@ Once your preferred template has been initialized, you can use the provided shel
| [Node.js][node] | [`node`](./node/) |
| [OCaml] | [`ocaml`](./ocaml/) |
| [Open Policy Agent][opa] | [`opa`](./opa) |
| [PHP] | [`php`](./php/) |
| [Protobuf] | [`protobuf`](./protobuf/) |
| [Ruby] | [`ruby`](./ruby/) |
| [Rust] | [`rust`](./rust/) |
@ -170,6 +171,11 @@ The sections below list what each template includes. In all cases, you're free t
- [Open Policy Agent][opa] 0.43.0
- [Conftest] 0.34.0
### [`php`](./php/)
- [PHP][php] 8.1.10
- [Composer][composer] 2.4.2
### [`protobuf`](./protobuf/)
- The [Buf CLI][buf] 1.7.0
@ -222,6 +228,7 @@ All of the templates have only the root [flake](./flake.nix) as a flake input. T
[cargo-deny]: https://crates.io/crates/cargo-deny
[clippy]: https://github.com/rust-lang/rust-clippy
[clojure]: https://clojure.org
[composer]: https://getcomposer.org/
[conftest]: https://www.conftest.dev
[cross]: https://github.com/cross-rs/cross
[cue]: https://cuelang.org
@ -284,6 +291,7 @@ All of the templates have only the root [flake](./flake.nix) as a flake input. T
[packer]: https://packer.io
[pip]: https://pypi.org/project/pip
[phoenix]: https://phoenixframework.org
[php]: https://php.net/
[pnpm]: https://pnpm.io
[protobuf]: https://developers.google.com/protocol-buffers
[python]: https://python.org

View file

@ -90,6 +90,11 @@
description = "Open Policy Agent development environment";
};
php = {
path = ./php;
description = "PHP development environment";
};
protobuf = {
path = ./protobuf;
description = "Protobuf development environment";

1
php/.envrc Normal file
View file

@ -0,0 +1 @@
use flake .

42
php/flake.lock Normal file
View file

@ -0,0 +1,42 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1664349153,
"narHash": "sha256-F6ZAHd9qR2lp49L1NiBFZ1NVJdTne56+dkI62glOj/w=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "467132e5ab10f122fbe313ebcc31eeaca65fae42",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

34
php/flake.nix Normal file
View file

@ -0,0 +1,34 @@
{
description = "A Nix-flake-based PHP development environment";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [
(self: super: rec {
php = super.php;
composer = super.phpPackages.composer;
})
];
pkgs = import nixpkgs { inherit overlays system; };
in
{
devShell = pkgs.mkShell {
buildInputs = with pkgs; [ composer php ];
shellHook = ''
echo "`${pkgs.php}/bin/php --version`"
'';
};
});
}