-
-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support old PHP versions #482
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
lib, | ||
pkgs, | ||
externals, | ||
inputs, | ||
... | ||
}: { | ||
type = "pure"; | ||
|
@@ -36,26 +37,30 @@ | |
|
||
inherit (pkgs.callPackage ../../semver.nix {}) satisfies; | ||
|
||
# php with required extensions | ||
php = | ||
if satisfies pkgs.php81.version subsystemAttrs.phpSemver | ||
phpPackages = l.attrValues inputs.phps.packages.x86_64-linux; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably does not make much difference, maybe passing |
||
phpPackage = let | ||
matchingVersions = l.filter (phpAttrs: satisfies phpAttrs.version subsystemAttrs.phpSemver) phpPackages; | ||
in | ||
if matchingVersions == [] | ||
then | ||
pkgs.php81.withExtensions ( | ||
{ | ||
all, | ||
enabled, | ||
}: | ||
l.unique (enabled | ||
++ (l.attrValues (l.filterAttrs (e: _: l.elem e subsystemAttrs.phpExtensions) all))) | ||
) | ||
else | ||
l.abort '' | ||
Error: incompatible php versions. | ||
Package "${defaultPackageName}" defines required php version: | ||
"php": "${subsystemAttrs.phpSemver}" | ||
Using php version "${pkgs.php81.version}" from attribute "pkgs.php81". | ||
''; | ||
composer = php.packages.composer; | ||
No matching php version was found in known versions: ${toString (l.map (attrs: attrs.version) phpPackages)}. | ||
'' | ||
else l.head matchingVersions; | ||
|
||
# php with required extensions | ||
php = phpPackage.withExtensions ( | ||
{ | ||
all, | ||
enabled, | ||
}: | ||
l.unique (enabled | ||
++ (l.attrValues (l.filterAttrs (e: _: l.elem e subsystemAttrs.phpExtensions) all))) | ||
); | ||
composer = phpPackage.packages.composer; | ||
|
||
# packages to export | ||
packages = | ||
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -2,6 +2,7 @@ | |||||||
lib, | ||||||||
pkgs, | ||||||||
externals, | ||||||||
inputs, | ||||||||
... | ||||||||
}: { | ||||||||
type = "pure"; | ||||||||
|
@@ -36,26 +37,30 @@ | |||||||
|
||||||||
inherit (pkgs.callPackage ../../semver.nix {}) satisfies; | ||||||||
|
||||||||
# php with required extensions | ||||||||
php = | ||||||||
if satisfies pkgs.php81.version subsystemAttrs.phpSemver | ||||||||
phpPackages = l.attrValues inputs.phps.packages.x86_64-linux; | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
phpPackage = let | ||||||||
matchingVersions = l.filter (phpAttrs: satisfies phpAttrs.version subsystemAttrs.phpSemver) phpPackages; | ||||||||
in | ||||||||
if matchingVersions == [] | ||||||||
then | ||||||||
pkgs.php81.withExtensions ( | ||||||||
{ | ||||||||
all, | ||||||||
enabled, | ||||||||
}: | ||||||||
l.unique (enabled | ||||||||
++ (l.attrValues (l.filterAttrs (e: _: l.elem e subsystemAttrs.phpExtensions) all))) | ||||||||
) | ||||||||
else | ||||||||
l.abort '' | ||||||||
Error: incompatible php versions. | ||||||||
Package "${defaultPackageName}" defines required php version: | ||||||||
"php": "${subsystemAttrs.phpSemver}" | ||||||||
Using php version "${pkgs.php81.version}" from attribute "pkgs.php81". | ||||||||
''; | ||||||||
composer = php.packages.composer; | ||||||||
No matching php version was found in known versions: ${toString (l.map (attrs: attrs.version) phpPackages)}. | ||||||||
'' | ||||||||
else l.head matchingVersions; | ||||||||
|
||||||||
# php with required extensions | ||||||||
php = phpPackage.withExtensions ( | ||||||||
{ | ||||||||
all, | ||||||||
enabled, | ||||||||
}: | ||||||||
l.unique (enabled | ||||||||
++ (l.attrValues (l.filterAttrs (e: _: l.elem e subsystemAttrs.phpExtensions) all))) | ||||||||
); | ||||||||
composer = phpPackage.packages.composer; | ||||||||
|
||||||||
# packages to export | ||||||||
packages = | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For my own understanding, what does import do here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of treating
inputs.php
like a flake, it treats it as a path and imports it. Currently we have a failing CI tests, because under some circumstances inputs.php is a path and not a flake. This is buggy behavior in our backward compat mechanism which I don't intend to fix anymore in favor of the upcoming v1 API changes.