Skip to content
Discussion options

You must be logged in to vote

From what I see in your custom phpfpm definition, phpVersion lets you conditionally define the package used for the service. This looks like an implementation detail that is better off kept alongside the service usage. For example, you can achieve the same goal with phpfpm defined in services-flake:

{ config,}:
let
  finalPkgs = if config ? pkgs then config.pkgs else pkgs;
  phpPackageFor = version: finalPkgs.buildEnv {
    name = "phpEnv";
    paths = if version == "php74" then [
      php
      php.packages.composer
      finalPkgs.mysql-client
    ] ++ lib.optional (finalPkgs ? drush) finalPkgs.drush
    else [
      php
      php.packages.composer
      php.packages.phpstan
      php.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by freelock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #569 on August 11, 2025 09:44.