[Nix-dev] Compiling Thunar from git

Sergey Mironov grrwlf at gmail.com
Tue Mar 18 10:38:41 CET 2014


> I actually started with copying Thunar from nixpkgs, and
> https://nixos.org/wiki/Howto_develop_software_on_nixos#Example_1:_Using_nix-shell_to_Initialize_a_Development_Shell
> I have made a small change in Thunar source and I wanted to test it, and it
> seems appropriate to do it with git HEAD.
>
> Sergey, I have used your .nix file, and it is still breaking make when in
> nix-shell.
> However, when using nix-build, it is working until the point when Thunar.1
> should be generated. I have added docbook_xsl to buildInputs, but it seems
> that it is not in xml catalog.
>
> xsltproc -nonet
> http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
> Thunar.xml
> I/O error : Attempt to load network entity
> http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
>
> Why is it working for nix-build and not for nix-shell, and how to manage xml
> catalog inside build envirioment?


I've reproduced the xslt situatiuon ("upstream error" I talked about
earlier was actually my machine's problem). It is a typical 'impurity'
we are trying to eliminate here in NixOS. According to NixOS idea,
build outputs of an expression should depend on it's build inputs
only. Thunar's build system, in contrast, tries to add a new
dependency - the mysterious docbook.xsl taken somewhere from the
Internet. I think, the best solution will be to patch the build
system, for example, provide it with pre-build man pages. I am not
skilled in docbook cooking so I will not post the recipe. But
probably, you don't need the docs for your task. Below is the
expression which is able to build thunar without docs. It simply
removes the docs/ folder from the SUBDIRS list.

For the nix-shell - I don't know for sure. Looks like it still can't
emulate precisely enough nix build environment. The problem lies
somewhere near gcc (AFAIK NixOS uses it's own patched version) and
NIX_CFLAGS_COMPILE environment variable.

Regards,
Sergey

PS

nix-shell --pure thunar.nix  is in fact able to start the 'good'
shell. Typing configurePhase && buildPhase from there allows me to
build my expression.

--

# thunar.nix

let
  pkgs = import <nixpkgs> {};
  inherit (pkgs) xfce;
  inherit (xfce) thunar;
  stdenv = pkgs.stdenv;
in rec {
  thunarEnv = stdenv.mkDerivation rec {

    name = "thunar-999";

    src = ./.;

    buildInputs = with pkgs; [
      pkgconfig intltool
      gtk dbus_glib libstartup_notification libnotify libexif pcre udev
      xfce.exo xfce.libxfce4util xfce.xfconf xfce.xfce4panel
      xfce.xfce4_dev_tools
      git
      gtk_doc
    ];

    configureFlags = [
      "--enable-maintainer-mode"
      ];

    preConfigure = ''
      sed -i '/docs/d' ./Makefile.am
      ./autogen.sh
    '';

  };

}


More information about the nix-dev mailing list