From 3572510177797b82671a559227eca338b282bc51 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 15 Aug 2025 17:04:14 +0100 Subject: [PATCH] Add `composer2nix` to all PHP dev shells --- CHANGELOG.md | 1 + flake.lock | 17 +++++++++++++++++ flake.nix | 14 +++++++++++++- modules/php74.nix | 2 +- modules/php81.nix | 4 ++-- modules/php82.nix | 4 ++-- modules/php83.nix | 4 ++-- modules/php84.nix | 4 ++-- 8 files changed, 40 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f16488..1b642a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), - Add `php84` dev shell. - Add `go` dev shell. +- Add `composer2nix` to all PHP dev shells. ### Changed diff --git a/flake.lock b/flake.lock index 2656b32..cfe66a7 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,21 @@ { "nodes": { + "composer2nix": { + "flake": false, + "locked": { + "lastModified": 1646178110, + "narHash": "sha256-P3acfGwHYjjZQcviPiOT7T7qzzP/drc2mibzrsrNP18=", + "owner": "svanderburg", + "repo": "composer2nix", + "rev": "299caca4aac42d7639a42eb4dde951c010f6e91c", + "type": "github" + }, + "original": { + "owner": "svanderburg", + "repo": "composer2nix", + "type": "github" + } + }, "devshell": { "inputs": { "nixpkgs": [ @@ -89,6 +105,7 @@ }, "root": { "inputs": { + "composer2nix": "composer2nix", "devshell": "devshell", "flake-parts": "flake-parts", "import-tree": "import-tree", diff --git a/flake.nix b/flake.nix index 64dfdc1..f4361f1 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,8 @@ { inputs = { + composer2nix.flake = false; + composer2nix.url = "github:svanderburg/composer2nix"; + devshell.inputs.nixpkgs.follows = "nixpkgs"; devshell.url = "github:numtide/devshell"; @@ -19,7 +22,16 @@ systems = [ "x86_64-linux" ]; _module.args = { - commonPhpPackages = pkgs: with pkgs; [ phpactor ]; + commonPhpPackages = + pkgs: system: + with pkgs; + let + composer2nix = import inputs.composer2nix { inherit system pkgs; }; + in + [ + composer2nix + phpactor + ]; }; imports = [ diff --git a/modules/php74.nix b/modules/php74.nix index da91b6d..e08a343 100644 --- a/modules/php74.nix +++ b/modules/php74.nix @@ -14,7 +14,7 @@ packages = [ php phpPackages.composer - ] ++ commonPhpPackages pkgs; + ] ++ commonPhpPackages pkgs system; shellHook = '' composer -V diff --git a/modules/php81.nix b/modules/php81.nix index 93f9cac..3ceaadc 100644 --- a/modules/php81.nix +++ b/modules/php81.nix @@ -2,13 +2,13 @@ { perSystem = - { pkgs, ... }: + { pkgs, system, ... }: { devShells.php81 = pkgs.mkShell { packages = with pkgs; [ php81 php81Packages.composer - ] ++ commonPhpPackages pkgs; + ] ++ commonPhpPackages pkgs system; shellHook = '' composer -V diff --git a/modules/php82.nix b/modules/php82.nix index 0c86fbc..0d8b902 100644 --- a/modules/php82.nix +++ b/modules/php82.nix @@ -2,13 +2,13 @@ { perSystem = - { pkgs, ... }: + { pkgs, system, ... }: { devShells.php82 = pkgs.mkShell { packages = with pkgs; [ php82 php82Packages.composer - ] ++ commonPhpPackages pkgs; + ] ++ commonPhpPackages pkgs system; shellHook = '' composer -V diff --git a/modules/php83.nix b/modules/php83.nix index 671e769..f625041 100644 --- a/modules/php83.nix +++ b/modules/php83.nix @@ -2,13 +2,13 @@ { perSystem = - { pkgs, ... }: + { pkgs, system, ... }: { devShells.php83 = pkgs.mkShell { packages = with pkgs; [ php83 php83Packages.composer - ] ++ commonPhpPackages pkgs; + ] ++ commonPhpPackages pkgs system; shellHook = '' composer -V diff --git a/modules/php84.nix b/modules/php84.nix index 639b78b..af94cb6 100644 --- a/modules/php84.nix +++ b/modules/php84.nix @@ -2,13 +2,13 @@ { perSystem = - { pkgs, ... }: + { pkgs, system, ... }: { devShells.php84 = pkgs.mkShell { packages = with pkgs; [ php84 php84Packages.composer - ] ++ commonPhpPackages pkgs; + ] ++ commonPhpPackages pkgs system; shellHook = '' composer -V