-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
63 lines (53 loc) · 1.61 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{
description = "PHP development";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nix-shell.url = "github:loophp/nix-shell";
systems.url = "github:nix-systems/default";
};
outputs = inputs@{ self, flake-parts, systems, ... }: flake-parts.lib.mkFlake { inherit inputs; } {
systems = import systems;
perSystem = { config, self', inputs', pkgs, system, lib, ... }:
let
php = pkgs.api.buildPhpFromComposer {
src = inputs.self;
php = pkgs.php83;
};
in
{
_module.args.pkgs = import self.inputs.nixpkgs {
inherit system;
overlays = [
inputs.nix-shell.overlays.default
];
config.allowUnfree = true;
};
devShells.default = pkgs.mkShellNoCC {
name = "php-devshell";
buildInputs = [
php
php.packages.composer
php.packages.psalm
pkgs.nodePackages.intelephense
# Auto reload tool
pkgs.watchexec
# Valgrind profile Gui
pkgs.graphviz
pkgs.kcachegrind
];
shellHook = ''
if ! test -d .nix-shell; then
mkdir .nix-shell
fi
export NIX_SHELL_DIR=$PWD/.nix-shell
# phpunit
export PHPUNIT_COVERAGE_PATH=$NIX_SHELL_DIR/phpunit_coverage
# XDEBUG
export XDEBUG_OUTPUT_DIR=$NIX_SHELL_DIR/xdebug
mkdir -p $XDEBUG_OUTPUT_DIR
export XDEBUG_CONFIG="output_dir=$XDEBUG_OUTPUT_DIR"
'';
};
};
};
}