Why does postInstall change the GSettings path but preFixup doesn't?

So, I wrote a gist: https://gist.github.com/jjramsey/47b21d06bda230bb52ee6e8a2e9d79ff

The gist of this gist, if you're interested

I created the gist because it packages a commit of Workrave that does some things better than the official “stable” release and even the “rc1” release. Not only does it have Wayland support for compositors other than Mutter, as the “rc1” release does, but it supports an updated version of the idle-notify protocol that allows Workrave to not treat the presence of an idle inhibitor (which may be invoked to keep the screen from blanking while passively watching a video) in the same way that it treats keyboard and mouse movement.

Part of the gist involves running glib-compile-schemas on the GSettings schemas after they’ve been installed. The schema path is supposed to be the output of ${glib.makeSchemaPath "$out" "${pname}-${version}"}. Now the way I ended up doing this is with this phase:

  preFixup = ''
    glib-compile-schemas ${glib.makeSchemaPath "$out" "${pname}-${version}"}
  '';

However, before I tried preFixup, I used the more “obvious” postInstall attribute, but that

  1. causes the schemas to be copied to $out/share/glib-2.0/schemas instead, and
  2. causes the desired schema path, ${glib.makeSchemaPath "$out" "${pname}-${version}"}, not to be created.

Why does it do that? What am I missing here? And more generally, what guidance is there on using preFixup versus postInstall?

The glib setup hook appends to postInstallHooks (after any user-defined postInstall script) and moves share/glib-2.0/schemas to its final location.

But have you tried this instead of mucking about with hooks?

  cmakeFlags = [ "-DGSETTINGS_COMPILE:BOOL=ON" ];
2 Likes

I could never remember this syntax, but thankfully there’s also a nixpkgs lib function to ease that:

(lib.cmakeBool "GSETTINGS_COMPILE" true)
1 Like

I would have done that if I’d known that I could. Thanks for the tip!