Unable to locate "pckg" installation in configure phase during nix-build

Hello, I am new in Nix and I have a little struggle in building my own package.

I am making a package of a software (Slurm) and it needs Munge during the installPhase.
Indeed, the repo of Slurm has a configure file which is used by nix-build and this configuration file needs Munge.
So I put Munge in the buildInputs has shown in the code below, but during the configure phase the script fails with an error “unable to locate Munge.” This error come from the configure script.
So it looks like that the configure file does not have access to Munge.

If you have an idea what is the problem, I will be very glad.


# slurm/default.nix

stdenv.mkDerivation rec {
  pname = "slurm-${version}";
  version = "24.05";

  src = fetchFromGitHub {
    owner = "SchedMD";
    repo = "slurm";
    rev = "3499918bc530f6503fa295ebdab7e10b5934660d";
    sha256 = "8eLjecDqPEqNSzg66ZQBLSeBOlqPJbfUOeO7Sc9wo78=";

  buildInputs = [ perl munge ];

# default.nix
{ pkgs ? import (fetchTarball {
  url = "https://github.com/NixOS/nixpkgs/archive/24.05.tar.gz";
  sha256 = "0d643wp3l77hv2pmg2fi7vyxn4rwy0iyr8djcw1h5x72315ck9ik";
}) {} }:

rec {

  slurm = pkgs.callPackage ./slurm { };


Looking at the source of the configure script, it uses some custom macro:

The macro incorrectly assumes one of hardcoded paths, which do not really exist on Nix:

The macro also allows to specify the path explicitly using a configure flag:

configureFlags = [

But that still makes narrow-minded assumptions that the directory contains include/munge.h and a library in lib or lib64 subdirectory. And while this is currently true for munge in Nixpkgs, it is not guaranteed – Nix packages can be split into multiple outputs, and then the lib and include would be in different directories.

You should ask slurm to use pkg-config as recommended by munge docs to make sure it works long-term. It will also be more portable.

Edit: Curiously, pkg-config files are not installed by our package, fix here: munge: Fix installation paths by jtojnar · Pull Request #319401 · NixOS/nixpkgs · GitHub

Also, we do appear to have slurm packaged: nixpkgs/pkgs/servers/computing/slurm/default.nix at 3feb437dd7ff5c432c62a741dd3de0cff3a23f89 · NixOS/nixpkgs · GitHub


Thanks for your answer.
Adding the flag makes work the build. Looking also for your others advice.