Help on derivation for a vala app

Hi

I am trying to package a vala app named swaysettings (GitHub - ErikReider/SwaySettings)
I created a derivation but if fails with the following error error: Package 'accountsservice' not found in specified Vala API directories or GObject-Introspection GIR directories

Here is the derivation:

{ pkgs }:

with pkgs;

stdenv.mkDerivation rec {
  pname = "sway-settings";
  version = "0.0";
  src = fetchFromGitHub {
  owner = "ErikReider";
  repo = "SwaySettings";
  rev = "master";
  hash = "sha256-EVGY4LbiH+RB56sYGOkYCdOc01LqbJIg9mJjgvFd4oY=";
  };

  nativeBuildInputs = [ meson vala pkg-config gettext ninja ];
  buildInputs = [ glib gtk3 libhandy json-glib libgee pantheon.granite libxml2 accountsservice gobject-introspection appstream-glib desktop-file-utils ];

  meta = with lib; {
    description = "Sway settings utility";
    platforms = platforms.linux;
  };
}

I don’t know how to use vala exactly but I don’t understand why it does not find the accountsservice vapi as it logs no error about finding it when calling meson.

Generally, Vala API is stored in share/vapi subdirectory of the dev output of a package. That is also the case with accountsservice. You would then add as a dependency gobject-introspection package, whose setup hook collects packages from inputs and adds their share directories to XDG_DATA_DIRS environment variable, which will allow Vala to find the API. You also did that so that should be fine.

In fact your expression seems to work for me (after updating the hash to sha256-2bbB+37t6chbdnOSpIolAsy7aD9i1UizWqkcF8Frfsk= to match latest master), adding python3 to nativeBuildInputs and

  postPatch = ''
    patchShebangs build-aux/meson/postinstall.py
  '';

I found another issue too, it was related to the fact that 21.11 is using a very old accountsservice package (0.6.55) When switching to 22.05, it works. thanks for the reply :slight_smile: