Anonymous function called without required argument 'lablgtk',

I recently upgraded to NixOS 19.03, but I need to use an older version of Unison. So I tried adding it to my overlay as unison-248. Unfortunately, I got the error message:

# nixos-rebuild switch
building Nix...
building the system configuration...
error: anonymous function at /home/amy/nix-overlays/unison-248/default.nix:1:1 called without required argument 'lablgtk', at /nix/store/cywy1rvnxk1v9sr3qr2qahk54k4ynmd4-nixos-19.03.172286.8ea36d73256/nixos/lib/customisation.nix:69:12
(use '--show-trace' to show detailed location information)

I understand that the nix expression for unison-248 needs the argument lablgtk, but I don’t know how to supply it. (I tried various things, but I didn’t really know what I was doing, and none of them worked, so I thought I’d ask for help here.)

Contents of /etc/nixos/configuration.nix:

{ config, pkgs, options, ... }:

  networking.hostName = "wombat9000"; # Define your hostname.

  imports =
    [ # Include the results of the hardware scan.


Contents of /home/amy/dotWombat/nixos/base.nix:

{ config, pkgs, options, ... }:

  . . .
  nixpkgs.overlays = [
    (import /home/amy/nix-overlays/default.nix)

  environment.systemPackages = import /home/amy/dotWombat/nixos/packages.nix pkgs;
  . . .

Contents of /home/amy/dotWombat/nixos/packages.nix:


with pkgs; [
  . . .
  . . .

Contents of /home/amy/nix-overlays/default.nix:

self: super: {
  hello-amy = self.callPackage ./hello-amy {};
  . . .

Contents of /home/amy/nix-overlays/unison-248/default.nix, which I copied from the NixOS/nixpkgs

{stdenv, fetchurl, ocaml, lablgtk, fontschumachermisc, xset, makeWrapper, ncurses
, enableX11 ? true}:

stdenv.mkDerivation (rec {

  name = "unison-2.48.4";
  src = fetchurl {
    url = "${name}.tar.gz";
    sha256 = "30aa53cd671d673580104f04be3cf81ac1e20a2e8baaf7274498739d59e99de8";

  buildInputs = [ ocaml makeWrapper ncurses ];

  preBuild = (if enableX11 then ''
    sed -i "s|\(OCAMLOPT=.*\)$|\1 -I $(echo "${lablgtk}"/lib/ocaml/*/site-lib/lablgtk2)|" Makefile.OCaml
  '' else "") + ''
  echo -e '\ninstall:\n\tcp $(FSMONITOR)$(EXEC_EXT) $(INSTALLDIR)' >> fsmonitor/linux/Makefile

  makeFlags = "INSTALLDIR=$(out)/bin/" + (if enableX11 then " UISTYLE=gtk2" else "")
    + (if ! ocaml.nativeCompilers then " NATIVE=false" else "");

  preInstall = "mkdir -p $out/bin";

  postInstall = if enableX11 then ''
    for i in $(cd $out/bin && ls); do
      wrapProgram $out/bin/$i \
        --run "[ -n \"\$DISPLAY\" ] && (${xset}/bin/xset q | grep -q \"${fontschumachermisc}\" || ${xset}/bin/xset +fp \"${fontschumachermisc}/lib/X11/fonts/misc\")"
  '' else "";

  dontStrip = !ocaml.nativeCompilers;

  meta = {
    homepage =;
    description = "Bidirectional file synchronizer";
    license = stdenv.lib.licenses.gpl3Plus;
    maintainers = with stdenv.lib.maintainers; [viric];
    platforms = with stdenv.lib.platforms; unix;


Not sure why you didn’t paste the part of the overlay that defines unison-248, but you’re probably using self.callPackage there too.

First you should be using super.callPackage instead, possibly to avoid potential problems in case callPackage gets overridden.

Second, the Nix file for unison you copied was called from ocaml-packages.nix, and the callPackage in there has a different scope of available packages, namely it has all ocaml packages in its scope (including lablgtk). So you need to use that one instead, which is super.ocamlPackages.callPackage.

1 Like

Thank you, that solved the issue I was having. :smile:

I meant to include the definition of unison-248, but I snipped the wrong line.