-
Notifications
You must be signed in to change notification settings - Fork 0
/
devenv.nix
66 lines (61 loc) · 1.7 KB
/
devenv.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
64
65
66
{pkgs, ...}: let
phpunwrapped = pkgs.php81.unwrapped.dev.overrideAttrs (attrs: {
configureFlags = attrs.configureFlags ++ ["--enable-zts"];
preConfigure =
''
for i in main/build-defs.h.in scripts/php-config.in; do
substituteInPlace $i \
--replace '@CONFIGURE_COMMAND@' '(omitted)' \
--replace '@PHP_LDFLAGS@' ""
done
export EXTENSION_DIR=$out/lib/php/extensions
for i in $(find . -type f -name "*.m4"); do
substituteInPlace $i \
--replace 'test -x "$PKG_CONFIG"' 'type -P "$PKG_CONFIG" >/dev/null'
done
./buildconf --copy --force
if test -f $src/genfiles; then
./genfiles
fi
''
+ pkgs.lib.optionalString pkgs.stdenv.isDarwin ''
substituteInPlace configure --replace "-lstdc++" "-lc++"
'';
});
extPhlash =
"./target/debug/libphlash_css"
+ (
if pkgs.stdenv.isDarwin
then ".dylib"
else ".so"
);
in {
packages = [pkgs.git phpunwrapped];
env.LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
enterShell = ''
rustc --version
'';
languages.rust.enable = true;
languages.nix.enable = true;
languages.php = {
enable = true;
package = phpunwrapped.buildEnv {
extensions = {
enabled,
all,
}:
enabled
++ (with all; [
dom
mbstring
tokenizer
readline
]);
extraConfig = "memory_limit = -1";
};
};
scripts.repl.exec = "php -dextension=${extPhlash} -a $@";
pre-commit.hooks.shellcheck.enable = true;
pre-commit.hooks.alejandra.enable = true;
pre-commit.hooks.rustfmt.enable = true;
}