-
Notifications
You must be signed in to change notification settings - Fork 59
/
flake.nix
68 lines (60 loc) · 1.76 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
64
65
66
67
68
{
description = "PHP development environments";
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
# This function creates a PHP interpreter with the proper required
# extensions by reading the composer.json and infering the extensions to
# enable.
php = pkgs.api.buildPhpFromComposer {
src = ./.;
php = pkgs.php82;
};
in
{
_module.args.pkgs = import self.inputs.nixpkgs {
inherit system;
overlays = [
inputs.nix-shell.overlays.default
];
};
apps = {
build-phar = {
type = "app";
program = lib.getExe self'.packages.build-phar-script;
};
};
devShells.default = pkgs.mkShellNoCC {
name = "php-devshell";
buildInputs = [
php
php.packages.box
php.packages.composer
self'.packages.build-phar-script
];
};
packages = {
build-phar-script = pkgs.writeShellApplication {
name = "build-phar-script";
runtimeInputs = [
php
php.packages.box
php.packages.composer
];
text = ''
rm -rf vendor
composer validate --strict
composer install --no-dev
box compile --no-interaction
'';
};
};
};
};
}