Prerequisites
Note
The Drupal for NixOS project is an attempt to bring Drupal deployment and hosting capabilities to NixOS.
It is primarily intended as a Drupal deployment solution onto a hosted NixOS system, whether that system is native, virtualized, or otherwise installed using something like nix-infect.
Therefore, support for running, testing, or auditing this project on a non-Linux and non-NixOS system is limited.
Deploying To NixOS
In order to deploy an existing Drupal code base to NixOS, you will need all of the following:
- a git repository containing a Drupal codebase built with composer
- a target server running NixOS, either natively or in emulation
- the ability to write nix configuration files into the target server, either via SSH, git, vim, or some other means
- Optional: some sort of local development tool, like
ddev,lando, ordrupal-flake
Using these tools, you can construct a simple workflow that enables you (or anyone else) to develop the website locally, commit changes to a repository, and then deploy those changes up to a NixOS server.
Testing Your Deployment
Optionally, it is possible to run your nix code on another NixOS computer, or a nix-capable system to determine how it will look and behave before you deploy it to your NixOS server.
You will need one of the following:
- A laptop running NixOS
- A Linux laptop1 (most major distributions) with virtualisation support and the nix package manager installed
- A MacOS computer2 with the ability to run virtualisation, either with and
nix-darwin,docker, VMWare or a similar solution - A Windows computer3 with Windows Subsystem for Linux,
docker, or some other virtualisation solution
Keep in mind that all non-Linux solutions must utilize virtualisation to run NixOS.
-
Notes about Linux virtualisation
The nix package manager is capable of running NixOS virtual machines natively on most Linux machines with minimal effort. You can also use it to spin off arbitrary virtual machines or installable ISOs of your final project.
-
Notes about MacOSX virtualisation
There are currently two ways to run and build NixOS on an MacOS machine, both involve virtualisation at some level.
Requirements for Nix-powered virtualisation on MacOSX
It is possible to virtualise NixOS using only the nix package manager. It does, however, come with some extra setup in the form of a tool called
nix-darwin.Here is a guide to help you understand the process of building a bespoke NixOS virtual machine with
nix-darwin. This will enable you to build an operating system directly from MacOS that you can then install anywhere you like.Virtualising NixOS with nix-darwin
Requirements for non nix-powered virtualisation on MacOSX
- A virtualisation program (VMWare, VirtualBox, etc.)
You can still use any existing virtualisation platform, in order to run a NixOS machine capable of running this project.
The tradeoff is that you will need to figure out how to extract your final configuration as a file, or extract an installable ISO at the end. ↩
-
Notes about Windows virtualisation
Currently, the only known way to run NixOS on windows is as a virtual machine, or with a tool like WSL (Windows Subsystem Linux).