<p>What is the leanest and most minimal local environment for software development?</p>
<p>I think if you use Linux, the most minimal approach is to install the packages you need, such as PHP and MySQL directly in your operating system.</p>
<p>There's no overhead or complexity added by tools like containers so things will run as quick and efficiently as possible.</p>
<p>This is great if you only work on one project and you can easily keep your installation in sync with production.</p>
<p>But what if you work on multiple projects or with a team of Developers?</p>
<p>You need a way for everyone to have the same software and package versions, and to be able to configure them for each project.</p>
<p>These are the reasons why tools like Vagrant, Docker and Podman became popular, as they made it possible for environments to be easily repeatable and customisable.</p>
<h2 id="what-about-nix%3F">What about Nix?</h2>
<p>Another tool that can be used to install software is Nix - a package manager with over 100,000 software packages.</p>
<p>I can use it to install the required software for each project and share the files with any team members so they have the same configuration.</p>
<p>This is the <code>flake.nix</code> file that I've been testing with a Drupal codebase:</p>
<p>This installs PHP 8.2, Composer and MariaDB, and nothing else.</p>
<p>It also generates a <code>flake.lock</code> file so everyone gets exactly the same package versions.</p>
<p>The downside is that, if everyone isn't using NixOS which handles services, I need to configure the database server for each project, running commands like <code>mysql_install_db</code> and <code>mysqld</code> before creating the database and user to put in the <code>settings.php</code> file.</p>
<p>It's not complicated but <a href="/daily/2024/11/11/could-nix-and-devenv-replace-docker-compose">devenv is a great option</a> if you want something more fully featured and opinionated that does more out of the box.</p>
<p>Once the database server is running and Drupal is installed, I can run <code>drush runserver</code> to run the website - no need for Apache, Caddy or Nginx.</p>
<p>If you want to see another example, see the <a href="https://code.oliverdavies.uk/opdavies/oliverdavies.uk/src/commit/4350852406e9556b63a1df448f225abbd7883651/flake.nix">flake.nix file for this website</a>.</p>
format:full_html
processed:|
<p>What is the leanest and most minimal local environment for software development?</p>
<p>I think if you use Linux, the most minimal approach is to install the packages you need, such as PHP and MySQL directly in your operating system.</p>
<p>There's no overhead or complexity added by tools like containers so things will run as quick and efficiently as possible.</p>
<p>This is great if you only work on one project and you can easily keep your installation in sync with production.</p>
<p>But what if you work on multiple projects or with a team of Developers?</p>
<p>You need a way for everyone to have the same software and package versions, and to be able to configure them for each project.</p>
<p>These are the reasons why tools like Vagrant, Docker and Podman became popular, as they made it possible for environments to be easily repeatable and customisable.</p>
<h2 id="what-about-nix%3F">What about Nix?</h2>
<p>Another tool that can be used to install software is Nix - a package manager with over 100,000 software packages.</p>
<p>I can use it to install the required software for each project and share the files with any team members so they have the same configuration.</p>
<p>This is the <code>flake.nix</code> file that I've been testing with a Drupal codebase:</p>
<p>This installs PHP 8.2, Composer and MariaDB, and nothing else.</p>
<p>It also generates a <code>flake.lock</code> file so everyone gets exactly the same package versions.</p>
<p>The downside is that, if everyone isn't using NixOS which handles services, I need to configure the database server for each project, running commands like <code>mysql_install_db</code> and <code>mysqld</code> before creating the database and user to put in the <code>settings.php</code> file.</p>
<p>It's not complicated but <a href="/daily/2024/11/11/could-nix-and-devenv-replace-docker-compose">devenv is a great option</a> if you want something more fully featured and opinionated that does more out of the box.</p>
<p>Once the database server is running and Drupal is installed, I can run <code>drush runserver</code> to run the website - no need for Apache, Caddy or Nginx.</p>
<p>If you want to see another example, see the <a href="https://code.oliverdavies.uk/opdavies/oliverdavies.uk/src/commit/4350852406e9556b63a1df448f225abbd7883651/flake.nix">flake.nix file for this website</a>.</p>