Problem with packaging Ada Libraries

I am trying to package some Ada libraries to contribute to the ecosystem on NixOS.

I was starting out with Prettier-Ada, since it only needed one other package (VSS) that is also not in nixpkgs yet.

This is my VSS default.nix for nixpkgs

{ stdenv
, lib
, fetchFromGitHub
, gnat
, gprbuild
}:
stdenv.mkDerivation rec {
  pname = "vss";
  version = "0.0.1";
  src = fetchFromGitHub {
    owner = "AdaCore";
    repo = "VSS";
    rev = "v24.0.0"; 
    sha256 = "sha256-Tgu+0vlfgM6uZo5SwQk6nV67YCGI6VOOj32pHlOtjU0=";
  };

  nativeBuildInputs = [
    gnat
    gprbuild
  ];

  buildPhase = '' 
    make build-libs-static
  '';
  installPhase = '' 
    PREFIX=$out DESTDIR= make install-libs-static
  '';
}

I ran nix-build $NIXPKGS -A gnatPackages.vss and it builds and I can see it in my nix store path.


If I try to now to package prettier-ada, which takes in the vss package and gnatcoll-core package I get the following error

error: builder for '/nix/store/fh1qd7p368330cf9b2l48yx0zygcmdrk-prettier-ada-0.0.1.drv' failed with exit code 2;
       last 25 log lines:
       > Running phase: unpackPhase
       > unpacking source archive /nix/store/qh420a79mbwww846kbm2xjbmj2w8xdan-source
       > source root is source
       > Running phase: patchPhase
       > Running phase: updateAutotoolsGnuConfigScriptsPhase
       > Running phase: configurePhase
       > no configure script, doing nothing
       > Running phase: buildPhase
       > gprbuild \
       >   -v \
       >   -k \
       >   -XLIBRARY_TYPE=static \
       >        -XPRETTIER_ADA_LIBRARY_TYPE=static \
       >   -XPRETTIER_ADA_BUILD_MODE=prod \
       >       -P prettier_ada.gpr \
       >  -p \
       >   -j0 ; \
       >
       >
       > ==============Messages for file: /build/source/prettier_ada.gpr
       >      6. with "gnatcoll_core";
       >              |
       >         >>> imported project file "gnatcoll_core" not found
       > gprbuild: "prettier_ada.gpr" processing failed
       > make: *** [Makefile:13: lib] Error 5
       For full logs, run 'nix log /nix/store/fh1qd7p368330cf9b2l48yx0zygcmdrk-prettier-ada-0.0.1.drv'.

It seems to not find gnatcoll-core and I am assuming also vss

This is prettier-ada’s default.nix

{ stdenv
, lib
, fetchFromGitHub
, gnat
, gprbuild
, gnatcoll-core
, vss
}:
stdenv.mkDerivation rec {
  pname = "prettier-ada";
  version = "0.0.1";
  src = fetchFromGitHub {
    owner = "AdaCore";
    repo = "prettier-ada";
    rev = "8fc0463fd3ed92d1e49e72e51d19cf2e43dd5f04";
    sha256 = "sha256-cEUbcdry8XhUyM8RsgxefFdLa/Kmb9sKgV1hQ/zKTpY=";
  };

  nativeBuildInputs = [
    gnat
    gprbuild
  ];

  buildInputs = [
    gnatcoll-core
    vss
  ];

  buildPhase = '' 
    LIBRARY_TYPE=static BUILD_MODE=prod make lib
  '';

  installPhase = ''
    PREFIX=$out LIBRARY_TYPE=static BUILD_MODE=prod make install
  '';
}

I am not sure if I am missing something in the install step for packaging correctly or something else.

I was able to figure this out. I needed use tagged version which didn’t need the required libraries.