Just a simple flake to provide the CMS Kirby as a Nix module, including packages for the latest versions of Kirby 3, 4, and 5.
Note
Kirby is not free to use. To use Kirby in production, you need to purchase a license.
- Creates a system user and group for each instance
- Mounts the package from your nix-store into the root directory (e.g.
/var/www/<name>/kirby) as read-only - Preconfigures the
services.nginx.virtualHosts.<hostName>entry for each instance - Preconfigures and starts a dedicated PHP-FPM pool for each instance
Add Kirby to your flake inputs and ensure you're following your own nixpkgs.
Note
This flake should work with any recent NixOS version and system.
However, it has only been tested with NixOS 25.05 on x86_64-linux at this point.
# flake.nix
inputs = {
nixpkgs.url = "github:NixOs/nixpkgs/<your-version>";
kirby-cms = {
url = "github:277292/kirby-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
};Load the module and overlay:
# flake.nix
outputs = {self, nixpkgs, kirby-cms, ...}: {
nixosConfigurations.joes-server = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
# Kirby CMS module
kirby-cms.nixosModules.kirby
# Overlay to make Kirby packages available
({config, pkgs, ...}: {
nixpkgs.overlays = [kirby-cms.overlays.kirby];
# Explicitly allow Kirby, as it is unfree
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) ["kirby"];
})
];
};
};# configuration.nix
{config, pkgs, ...}: {
# Ensure that a default package is set and/or specify one per instance.
kirby-cms.default.package = pkgs.kirby4;
kirby-cms.sites = {
"getKirby.com" = {};
example2 = {};
};
# Ensure that nginx is enabled.
services.nginx.enable = true;
};This will create two Kirby instances in /var/www/getKirby.com and /var/www/example2 using Kirby 4.
To disable SSL and ACME (e.g. for local development):
# configuration.nix
{config, lib, ...}: let cfg = config.kirby-cms; in {
kirby-cms = {...};
services.nginx.virtualHosts."${cfg.sites.<name>.hostName}" = {
forceSSL = lib.mkForce false;
enableACME = lib.mkForce false;
};
}kirby-cms.default.root = "/var/www"
kirby-cms.default.timezone = "UTC"
kirby-cms.default.package = null
kirby-cms.sites.<name>.enable = true
kirby-cms.sites.<name>.hostName = <name>
kirby-cms.sites.<name>.serverAliases = []
kirby-cms.sites.<name>.root = "${cfg.default.root}/<name>"
kirby-cms.sites.<name>.timezone = cfg.default.timezone
kirby-cms.sites.<name>.package = cfg.default.package
For more description and examples, see the flake.nix
nix run nixpkgs#nix-prefetch-github -- getKirby kirby --rev 5.1.0-rc.1
kirby-cms.default.packages = pkgs.kirby_fetch {
version = "5.1.0-rc.1";
rev = "29b38b4b6cf08ddcbff7b879297ee84060609916";
sha256 = "sha256-yeHSKM+n77AfdaE0TdAgIZObs/rP59g+bdS4s5VeSfU=";
phpPackage = pkgs.php84;
};This flake is only a wrapper for integrating Kirby CMS into Nix.
I am not affiliated with the Kirby project, and this repository is not endorsed by or connected to the creators of Kirby. For licensing, usage terms, and commercial support, see getkirby.com.
Feel free to open an issue or submit a pull request if you encounter a problem or have an idea for improvement — contributions related to this flake are very welcome.