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.
/etc/nixos/hardware-configuration.nix
/home/amy/dotWombat/nixos/wombat9000.nix
/home/amy/dotWombat/nixos/R.nix
/home/amy/dotWombat/nixos/python3.nix
/home/amy/dotWombat/nixos/base.nix
];
}
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:
pkgs:
with pkgs; [
. . .
unison-248
. . .
]
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
GitHub:
{stdenv, fetchurl, ocaml, lablgtk, fontschumachermisc, xset, makeWrapper, ncurses
, enableX11 ? true}:
stdenv.mkDerivation (rec {
name = "unison-2.48.4";
src = fetchurl {
url = "http://www.seas.upenn.edu/~bcpierce/unison/download/releases/stable/${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\")"
done
'' else "";
dontStrip = !ocaml.nativeCompilers;
meta = {
homepage = http://www.cis.upenn.edu/~bcpierce/unison/;
description = "Bidirectional file synchronizer";
license = stdenv.lib.licenses.gpl3Plus;
maintainers = with stdenv.lib.maintainers; [viric];
platforms = with stdenv.lib.platforms; unix;
};
})