Help creating a derivation for nixpkgs

Hello, to be honest this is the first time i get involved so much with a Linux OS and i would like to contribute to nixpks, the problem is my lack of experience with the nix lenguage and some concepts yet, i’m facing a problem when trying to create a package for phillbush/xnotify here is how i’m doing it:

{ lib, stdenv, fetchFromGitHub, libX11, libXinerama, libXft, Imlib2 }:

stdenv.mkDerivation {
  pname = "xnotify";
  version = "unstable-2021-12-22";

  src = fetchFromGitHub {
    owner = "phillbush";
    repo = "xnotify";
    rev = "cacfb959effd61f932faf87c4e5bf37c9d2ef2ea";
    sha256 = "1hvgfrcpzp7q6jn808f7jj824360mlfhym60w02ylh99p582hc3c";
  };

  buildInputs = [
    libX11 libXinerama libXft Imlib2
  ];
  makeFlags = [
    "PREFIX=$(out)"
  ];

  meta = with lib; {
    description = "xnotify - popup a notification on the screen";
    longDescription = ''
      xnotify is a notification launcher for X, it receives a notification
      specification from standard input and shows a notification on the screen.
      The notification disappears automatically after a given number of seconds
      or after a mouse click is operated on it.
    '';
    homepage = "https://github.com/phillbush/xnotify";
    license = licenses.mit;
    platforms = platforms.linux;
    maintainers = with maintainers; [];
  };
}

when trying to run: nix-build -A xnotify i got the following message:

error: anonymous function at /home/MyUser/Dev/nixpkgs/pkgs/applications/misc/xnotify/default.nix:1:1 called without required argument 'Imlib2'

       at /home/MyUser/Dev/nixpkgs/lib/customisation.nix:69:16:

           68|     let
           69|       result = f origArgs;
             |                ^
           70|

Let’s follow the error. Where is Imlib2 defined? Could it be a capitalization, upper/lowercase issue?

I don’t think it could be a typo.

Where is Imlib2 define?

if I’ve to guess i would say it’s inside nixpkgs/lib

My usual tactic in these situations is to search for “imlib2” in all of nixpkgs and see how other derivations do it: Search · imlib2 · GitHub. Maybe you can try to copy how those derivations make it work?

2 Likes

Try with lowercase imlib2 instead.

2 Likes