{ "uuid": [ { "value": "52049b70-5092-41ea-a749-5fde0d95b39e" } ], "langcode": [ { "value": "en" } ], "type": [ { "target_id": "daily_email", "target_type": "node_type", "target_uuid": "8bde1f2f-eef9-4f2d-ae9c-96921f8193d7" } ], "revision_timestamp": [ { "value": "2025-05-11T09:00:04+00:00" } ], "revision_uid": [ { "target_type": "user", "target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849" } ], "revision_log": [], "status": [ { "value": true } ], "uid": [ { "target_type": "user", "target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849" } ], "title": [ { "value": "Running Drupal on devenv" } ], "created": [ { "value": "2024-12-09T00:00:00+00:00" } ], "changed": [ { "value": "2025-05-11T09:00:04+00:00" } ], "promote": [ { "value": false } ], "sticky": [ { "value": false } ], "default_langcode": [ { "value": true } ], "revision_translation_affected": [ { "value": true } ], "path": [ { "alias": "\/daily\/2024\/12\/09\/drupal-devenv", "langcode": "en" } ], "body": [ { "value": "\n

I recently said that I've been using devenv to run Drupal applications locally<\/a>.<\/p>\n\n

Here's the devenv.nix<\/code> file I used for my recent talk for the Drupal London meetup<\/a>:<\/p>\n\n

{ pkgs, ... }:\n\nlet\n  drupal.root = \"web\";\nin\n{\n  packages = [ pkgs.git ];\n\n  dotenv.disableHint = true;\n\n  languages = {\n    php = {\n      enable = true;\n      version = \"8.2\";\n\n      ini = ''\n        memory_limit = 256M\n      '';\n\n      fpm.pools.web = {\n        listen = \"127.0.0.1:9000\";\n\n        settings = {\n          \"pm\" = \"dynamic\";\n          \"pm.max_children\" = 75;\n          \"pm.max_requests\" = 500;\n          \"pm.max_spare_servers\" = 20;\n          \"pm.min_spare_servers\" = 5;\n          \"pm.start_servers\" = 10;\n        };\n      };\n    };\n  };\n\n  processes = { };\n\n  services = {\n    caddy = {\n      enable = true;\n\n      config = ''\n        {\n          http_port 8080\n        }\n\n        localhost:8080 {\n          root * ${drupal.root}\n          encode gzip\n          php_fastcgi localhost:9000\n          file_server\n        }\n      '';\n    };\n\n    mysql = {\n      enable = true;\n      initialDatabases = [ { name = \"drupal_london\"; } ];\n    };\n  };\n\n  enterShell = ''\n    if [[ ! -d vendor ]]; then\n      composer install\n    fi\n  '';\n\n  enterTest = ''\n    phpunit --testdox\n  '';\n}\n<\/code><\/pre>\n\n

It installs the required version of PHP for this project, creates a web server (Caddy) and configures MariaDB with a default database.<\/p>\n\n

I've also added commands to run composer install<\/code> to download dependencies when entering the shell and phpunit<\/code> for tests.<\/p>\n\n

With this approach, there's no need for containers as everything is run locally and I can view the site at http:\/\/localhost:8080<\/a> (or whatever port is defined).<\/p>\n\n

All of my current development projects are using this approach and I think it'll be my default method for future projects.<\/p>\n\n ", "format": "full_html", "processed": "\n

I recently said that I've been using devenv to run Drupal applications locally<\/a>.<\/p>\n\n

Here's the devenv.nix<\/code> file I used for my recent talk for the Drupal London meetup<\/a>:<\/p>\n\n

{ pkgs, ... }:\n\nlet\n  drupal.root = \"web\";\nin\n{\n  packages = [ pkgs.git ];\n\n  dotenv.disableHint = true;\n\n  languages = {\n    php = {\n      enable = true;\n      version = \"8.2\";\n\n      ini = ''\n        memory_limit = 256M\n      '';\n\n      fpm.pools.web = {\n        listen = \"127.0.0.1:9000\";\n\n        settings = {\n          \"pm\" = \"dynamic\";\n          \"pm.max_children\" = 75;\n          \"pm.max_requests\" = 500;\n          \"pm.max_spare_servers\" = 20;\n          \"pm.min_spare_servers\" = 5;\n          \"pm.start_servers\" = 10;\n        };\n      };\n    };\n  };\n\n  processes = { };\n\n  services = {\n    caddy = {\n      enable = true;\n\n      config = ''\n        {\n          http_port 8080\n        }\n\n        localhost:8080 {\n          root * ${drupal.root}\n          encode gzip\n          php_fastcgi localhost:9000\n          file_server\n        }\n      '';\n    };\n\n    mysql = {\n      enable = true;\n      initialDatabases = [ { name = \"drupal_london\"; } ];\n    };\n  };\n\n  enterShell = ''\n    if [[ ! -d vendor ]]; then\n      composer install\n    fi\n  '';\n\n  enterTest = ''\n    phpunit --testdox\n  '';\n}\n<\/code><\/pre>\n\n

It installs the required version of PHP for this project, creates a web server (Caddy) and configures MariaDB with a default database.<\/p>\n\n

I've also added commands to run composer install<\/code> to download dependencies when entering the shell and phpunit<\/code> for tests.<\/p>\n\n

With this approach, there's no need for containers as everything is run locally and I can view the site at http:\/\/localhost:8080<\/a> (or whatever port is defined).<\/p>\n\n

All of my current development projects are using this approach and I think it'll be my default method for future projects.<\/p>\n\n ", "summary": null } ] }