Skip to content

Instantly share code, notes, and snippets.

@zopsicle
Last active June 14, 2022 09:54
Show Gist options
  • Save zopsicle/2254ce3b9e4f4c2b6318f17e26d94887 to your computer and use it in GitHub Desktop.
Save zopsicle/2254ce3b9e4f4c2b6318f17e26d94887 to your computer and use it in GitHub Desktop.
Nix shell for PHP development
nix-shell --run 'composer install'
let
tarball = fetchTarball {
url = "https://releases.nixos.org/nixpkgs/nixpkgs-22.05pre369766.3e242938104/nixexprs.tar.xz";
sha256 = "1lk15ww5m4njd51286ypawpdrz25499sp01fhiil9byzjnp4xm0f";
};
in
import tarball { }
let
nixpkgs = import ./nixpkgs.nix;
# Configure which PHP version and extensions you want.
php = nixpkgs.php81.withExtensions phpExtensions;
phpExtensions = { all, ... }: [
all.curl
all.filter
all.mbstring
all.openssl
];
in
nixpkgs.mkShell {
nativeBuildInputs = [
php
php.packages.composer
# Can also include other tools:
nixpkgs.cucumber # if using cucumber
nixpkgs.perl # if using prove
nixpkgs.firefox # if using firefox in CI for testing? idk
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment