How to Install PmWiki on NixOS Latest

PmWiki is a free and open-source wiki software application which can be installed on NixOS Latest. This guide will take you through the steps to download and install PmWiki on NixOS Latest.

Requirements

  • NixOS Latest Installed
  • Superuser access

Steps

  1. Update the package manager:
sudo nix-channel --update
  1. Install Apache web server and PHP using the following command:
sudo nix-env -iA nixos.httpd nixos.php
  1. Now, download the PmWiki package from the PmWiki official website using the following command:
curl -L https://www.pmwiki.org/pub/pmwiki/pmwiki-latest.tgz | tar zx
  1. Move the extracted files to the Apache default location /var/www/html using the following commands:
sudo rm -rf /var/www/html/*
sudo mv pmwiki-*/pmwiki/* /var/www/html/
  1. Run the following command to set the correct permissions:
sudo chown -R apache:apache /var/www/html/
  1. Create a new VirtualHost configuration file to serve PmWiki. This file should be saved at /etc/nixos/pmwiki.nix. Open this file using your favorite text editor, and then copy and paste the following configuration:
{ config, pkgs, ... }:

{
  services.httpd = {
    enable = true;
    adminAddr = "[email protected]";
    virtualHosts."yourdomain.com" = {
      documentRoot = "/var/www/html";
      serverAliases = [ "yourdomain.com" ];
      locations."/pmwiki" = {
        root = "/var/www/html";
        directoryIndex = [ "pmwiki.php" ];
      };
      locations."/pub" = {
        root = "/var/www";
        directoryIndex = [ "pmwiki.php" ];
      };
    };
  };
}

Note: Replace the "yourdomain.com" and "[email protected]" placeholders with your respective domain and email.

  1. Save and close the file, then run the following command to update NixOS configuration:
sudo nixos-rebuild switch
  1. Finally, start the Apache web server with the following command:
sudo systemctl start httpd
  1. Open up your web browser, and browse to http://yourdomain.com/pmwiki. You should now be able to see the PmWiki installation page. Follow the prompts to complete the installation process.

Congratulations! You have successfully installed PmWiki on NixOS Latest.