feat: add PHP environment

This commit is contained in:
Pol Dellaiera 2022-09-28 09:34:13 +02:00
parent b2377c6844
commit 28752cf318
5 changed files with 90 additions and 0 deletions

1
php/.envrc Normal file
View file

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

42
php/flake.lock generated 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`"
'';
};
});
}