Skip to content

Commit 8e7576e

Browse files
authored
Merge pull request #647 from cachix/unlock-php
php: un-pin `phpPackages` from 8.2
2 parents 462eb20 + b4cd36f commit 8e7576e

File tree

2 files changed

+48
-26
lines changed

2 files changed

+48
-26
lines changed

nix/default.nix

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,30 @@
22
, nixpkgs
33
, gitignore-nix-src
44
, isFlakes ? false
5+
,
56
}:
67
let
78
overlay =
89
self: pkgs:
910
let
1011
inherit (pkgs) lib;
1112
tools = import ./call-tools.nix pkgs;
12-
run = pkgs.callPackage ./run.nix { inherit pkgs tools isFlakes gitignore-nix-src; };
13+
run = pkgs.callPackage ./run.nix {
14+
inherit
15+
pkgs
16+
tools
17+
isFlakes
18+
gitignore-nix-src
19+
;
20+
};
21+
22+
# Filter out any broken or missing packages from our tests.
23+
filterBrokenPackages = n: package: package != null && !(package.meta.broken or false);
1324
in
1425
{
1526
inherit tools run;
1627
# Flake style attributes
17-
packages = (lib.filterAttrs (_name: value: value != null) tools) // {
28+
packages = (lib.filterAttrs filterBrokenPackages tools) // {
1829
inherit (pkgs) pre-commit;
1930
};
2031
checks = self.packages // {
@@ -39,23 +50,31 @@ let
3950
specialArgs = { inherit pkgs; };
4051
};
4152
allHooks = config.config.hooks;
53+
54+
getEntry = n: v: v.entry;
55+
getPackage =
56+
f: n: h:
57+
f n h.package;
58+
4259
allEntryPoints = lib.pipe allHooks [
43-
(lib.filterAttrs (_name: value: value.package != null))
44-
(lib.mapAttrsToList (_: value: value.entry))
60+
(lib.filterAttrs (getPackage filterBrokenPackages))
61+
(lib.mapAttrsToList getEntry)
4562
];
4663
in
4764
pkgs.runCommand "all-tools-eval"
4865
{
4966
inherit allEntryPoints;
50-
} ''
51-
touch $out
52-
'';
67+
}
68+
''
69+
touch $out
70+
'';
5371
doc-check =
5472
let
5573
# We might add that it keeps rendering fast and robust,
5674
# and we want to teach `defaultText` which is more broadly applicable,
5775
# but the message is long enough.
58-
failPkgAttr = name: _v:
76+
failPkgAttr =
77+
name: _v:
5978
throw ''
6079
While generating documentation, we found that `pkgs` was used. To avoid rendering store paths in the documentation, this is forbidden.
6180
@@ -78,20 +97,21 @@ let
7897
_type = "pkgs";
7998
inherit lib;
8099
formats = lib.mapAttrs
81-
(formatName: formatFn:
82-
formatArgs:
83-
let
84-
result = formatFn formatArgs;
85-
stubs =
86-
lib.mapAttrs
87-
(name: _:
88-
throw "The attribute `(pkgs.formats.${lib.strings.escapeNixIdentifier formatName} x).${lib.strings.escapeNixIdentifier name}` is not supported during documentation generation. Please check with `--show-trace` to see which option leads to this `${lib.strings.escapeNixIdentifier name}` reference. Often it can be cut short with a `defaultText` argument to `lib.mkOption`, or by escaping an option `example` using `lib.literalExpression`."
100+
(
101+
formatName: formatFn: formatArgs:
102+
let
103+
result = formatFn formatArgs;
104+
stubs = lib.mapAttrs
105+
(
106+
name: _:
107+
throw "The attribute `(pkgs.formats.${lib.strings.escapeNixIdentifier formatName} x).${lib.strings.escapeNixIdentifier name}` is not supported during documentation generation. Please check with `--show-trace` to see which option leads to this `${lib.strings.escapeNixIdentifier name}` reference. Often it can be cut short with a `defaultText` argument to `lib.mkOption`, or by escaping an option `example` using `lib.literalExpression`."
89108
)
90109
result;
91-
in
92-
stubs // {
93-
inherit (result) type;
94-
}
110+
in
111+
stubs
112+
// {
113+
inherit (result) type;
114+
}
95115
)
96116
pkgs.formats;
97117
};
@@ -110,6 +130,8 @@ in
110130
import nixpkgs {
111131
overlays = [ overlay ];
112132
# broken is needed for hindent to build
113-
config = { allowBroken = true; };
133+
config = {
134+
allowBroken = true;
135+
};
114136
inherit system;
115137
}

nix/tools.nix

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
, proselint
7070
, python3Packages
7171
, pyright ? nodePackages.pyright
72-
, php82Packages
72+
, phpPackages
7373
, ripsecrets ? null
7474
, reuse
7575
, ruff ? null
@@ -203,14 +203,14 @@ in
203203
inherit (nodePackages) eslint markdownlint-cli prettier cspell;
204204
inherit (ocamlPackages) ocp-indent;
205205
inherit (python3Packages) autoflake black flake8 flynt isort mkdocs-linkcheck mypy openapi-spec-validator pre-commit-hooks pylint pyupgrade;
206-
inherit (php82Packages) php-cs-fixer psalm;
206+
inherit (phpPackages) php-cs-fixer psalm;
207207
# FIXME: workaround build failure
208-
phpstan = php82Packages.phpstan.overrideAttrs (old: {
208+
phpstan = phpPackages.phpstan.overrideAttrs (old: {
209209
composerStrictValidation = false;
210210
});
211211
# these two are for backwards compatibility
212-
phpcbf = php82Packages.php-codesniffer or php82Packages.phpcbf;
213-
phpcs = php82Packages.php-codesniffer or php82Packages.phpcs;
212+
phpcbf = phpPackages.php-codesniffer or phpPackages.phpcbf;
213+
phpcs = phpPackages.php-codesniffer or phpPackages.phpcs;
214214
lua-language-server = lua-language-server;
215215
purs-tidy = nodePackages.purs-tidy or null;
216216
cabal2nix-dir = callPackage ./cabal2nix-dir { };

0 commit comments

Comments
 (0)