Dokuwiki plugin

Hello,

I’m a bit stuck and hoping someone can assist. I’ve been following this ‘install’ guide: https://nixos.wiki/wiki/Dokuwiki.

I have Dokuwiki working well, however I can’t get plugins to work. I’ve followed the example provided on the page above.

Here’s what I have:

let
  dokuwiki-plugin-markdowku = pkgs.stdenv.mkDerivation {
    name = "markdowku";
    src = pkgs.fetchzip {
      url = "https://github.com/Medieninformatik-Regensburg/dokuwiki-plugin-markdowku/archive/refs/heads/master.zip";
      sha256 = "sha256-uzREhVl4iuXa5s9vXkGHmlBa/vcVxF6XSEePGnS8j7U=";
    };
    sourceRoot = ".";
    installPhase = "mkdir -p $out; cp -R dokuwiki-plugin-markdowku-master/* $out/";
  };

Here’s the error I get:

Running phase: unpackPhase
unpacking source archive /nix/store/yl7baylj38hjwnkjr63zcjpfv30jgcd3-source
source root is .
Running phase: patchPhase
Running phase: updateAutotoolsGnuConfigScriptsPhase
Running phase: configurePhase
no configure script, doing nothing
Running phase: buildPhase
no Makefile or custom buildPhase, doing nothing
Running phase: installPhase
cp: missing destination file operand after '/nix/store/ynapjz34l7p1kmaigvydgd8c3z2a9ffs-markdowku/'
Try 'cp --help' for more information.
error: build of '/nix/store/zzzb6yy70kz3f7s8ylpp83np9n7xk5pg-markdowku.drv' on 'ssh://neil@x86_64-linux-1.zw3rk.com' failed: builder for '/nix/store/zzzb6yy70kz3f7s8ylpp83np9n7xk5pg-markdowku.drv' failed with exit code 1;
       last 10 log lines:
       > source root is .
       > Running phase: patchPhase
       > Running phase: updateAutotoolsGnuConfigScriptsPhase
       > Running phase: configurePhase
       > no configure script, doing nothing
       > Running phase: buildPhase
       > no Makefile or custom buildPhase, doing nothing
       > Running phase: installPhase
       > cp: missing destination file operand after '/nix/store/ynapjz34l7p1kmaigvydgd8c3z2a9ffs-markdowku/'
       > Try 'cp --help' for more information.
       For full logs, run 'nix log /nix/store/zzzb6yy70kz3f7s8ylpp83np9n7xk5pg-markdowku.drv'.

I’ve played about with a few different parameters but these make no change to the outcome.
Thank you.

The error sounds like dokuwiki-plugin-markdowku-master/* expands to an empty list.

You can check the contents of the directory by running ls -la before running cp in the installPhase. Alternately, you can pass --keep-failed flag to nix-build to preserve the contents of build sandbox (the path will be printed near the end of the build output).

Also, if you just want unpacked zipball, you do not need to use mkDerivation at all, fetchzip already does this. (Or in this case fetchFromGitHub would be even cleaner. And do not forget to use commit id instead of master, or the hash will break when the projects adds more changes.)

1 Like

Thank you, that’s helped a great deal.

I’ve taken your advice and used pkgs.fetchFromGitHub. The issue I’m now having is, I can’t find any good documentation for pkgs.fetchFromGitHub.

The code I have now at least grabs the plugin and deploys the site. However the site is unhappy because the plugin folder is called source.

Plugin installed incorrectly. Rename plugin directory 'source' to 'markdowku'.

How would I go about renaming the output to match what the site expects. Sorry for the questions, I just can’t seem to find anything useful online!

fetchFromGitHub is documented in the Nixpkgs manual.

How are you installing it the package?

Generally, fetchzip (which fetchFromGitHub uses internally, when sufficient) extracts directly to a store path so the directory name would be something like kl9kzssrd4ba3gdbbf87k6jqi0v3ss7s-source.

You can change it using the name argument but the hash prefix will still remain:

1 Like

I’ll have a look at that link thank you.
The hash prefix is going to cause an issue for Dokuwiki. It’s expecting the output plugin folder to have the name of the plugin.

Here’s what I have so far:

{pkgs, ...}:
let 
  dokuwiki-plugin-markdowku = pkgs.fetchFromGitHub {
    owner = "Medieninformatik-Regensburg";
    repo = "dokuwiki-plugin-markdowku";
    rev = "a871977d62bdec71df0acca66a7c7c307e550f6f";
    sha256 = "sha256-uzREhVl4iuXa5s9vXkGHmlBa/vcVxF6XSEePGnS8j7U=";
  };
in {
  networking.firewall.allowedTCPPorts = [ 80 443 ];

  services.dokuwiki.sites."mywiki" = {
    enable = true;
    package = pkgs.dokuwiki;
    plugins = [ dokuwiki-plugin-markdowku ];
    settings = {
      title = "Wiki";
      useacl = true;
      superuser = "admin";
      userewrite = true;
    };
  };
}

Thank you for all your help.

I had to re-read your last post (it’s been a long day).

I can confirm declaring the name works perfectly!