-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
flake.nix
109 lines (100 loc) · 2.85 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
{
description = "PHP/Composer/SymfonyCLi/GithubCLi/git/sqlite/make";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nix-phps.url = "github:fossar/nix-phps";
# Shim to make flake.nix work with stable Nix.
flake-compat.url = "github:nix-community/flake-compat";
systems.url = "github:nix-systems/default";
};
outputs =
inputs@{
self,
flake-parts,
systems,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = import systems;
imports = [
./src/imports/formatter.nix
./src/imports/overlay.nix
./src/imports/templates.nix
];
flake = {
overlays.default = import ./src/overlay inputs;
};
perSystem =
{
self',
pkgs,
lib,
...
}:
let
buildPhpFromComposer = pkgs.callPackage ./src/build-support/build-php-from-composer.nix { };
phps =
lib.mapAttrs
# To fix: Why using this while it is already in use in the overlay?
(
name: value:
buildPhpFromComposer {
php = value;
src = self;
}
)
(lib.filterAttrs (k: v: lib.isDerivation v) (inputs.self.overlays.default null pkgs));
envPackages = [
pkgs.symfony-cli
pkgs.sqlite
];
packages =
lib.foldlAttrs
(
carry: name: php:
carry
// {
"${name}" = php;
"env-${name}" = pkgs.buildEnv {
name = "env-${name}";
paths = [
php
php.packages.composer
] ++ envPackages;
};
}
)
{
"default" = self'.packages.env-php81;
"env-default" = self'.packages.env-php81;
}
phps;
devShells =
lib.foldlAttrs
(
carry: name: php:
{
"${name}" = pkgs.mkShellNoCC {
name = "${name}";
buildInputs = [
php
php.packages.composer
];
};
"env-${name}" = self'.devShells."${name}".overrideAttrs (oldAttrs: {
buildInputs = oldAttrs.buildInputs ++ envPackages;
});
}
// carry
)
{
"default" = self'.devShells.env-php81;
"env-default" = self'.devShells.env-php81;
}
phps;
in
{
inherit packages devShells;
};
};
}