Skip to content

Instantly share code, notes, and snippets.

@drupol
Created March 22, 2024 10:36
Show Gist options
  • Save drupol/488fb532e3e4c925ccb7e9ab294b27ec to your computer and use it in GitHub Desktop.
Save drupol/488fb532e3e4c925ccb7e9ab294b27ec to your computer and use it in GitHub Desktop.
flake.nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
};
outputs = inputs @ { self, flake-parts, ... }: flake-parts.lib.mkFlake { inherit inputs; } {
systems = import inputs.systems;
perSystem = { config, self', inputs', pkgs, system, lib, ... }: let
scriptPhp81 = pkgs.writeShellApplication {
name = "run-tests-with-php81";
runtimeInputs = [
(pkgs.php81.withExtensions ({ enabled, all }: enabled ++ [ all.imagick ]))
pkgs.phpPackages.composer
pkgs.phpunit
];
text = ''
composer install
phpunit
'';
};
scriptPhp82 = pkgs.writeShellApplication {
name = "run-tests-with-php82";
runtimeInputs = [
pkgs.php82
pkgs.phpPackages.composer
];
text = ''
composer install
php --version
'';
};
in {
devShells.default = pkgs.mkShell {
name = "collection-dev-env";
packages = [
scriptPhp81
scriptPhp82
pkgs.phpunit
];
};
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment