How to install PostgreSQL Extension

I would like to install the following PostgreSQL Extension quantile.
Neither it is installed by default:

~ psql -c "create extension quantile"                                                   
ERROR:  extension "quantile" is not available
DETAIL:  Could not open extension control file "/nix/store/8h3q6yf1zg3rs5hsb7r9zvqvcvhry6v6-postgresql-and-plugins-16.1/share/postgresql/extension/quantile.control": No such file or directory.
HINT:  The extension must first be installed on the system where PostgreSQL is running.

nor can I install it using pgxn:

~ pgxn install quantile
pgxn: command not found

And building on my own is not so easy either:

➜  quantile git:(master) make install
...
quantile.c:14:10: fatal error: 'postgres.h' file not found
#include "postgres.h"

How to install additional extensions?

Voilà the homepage of quantile:

Here the NixOs configuration of PostGres:

services.postgresql = {
     authentication = pkgs.lib.mkOverride 10 ''
       local all all trust
       host all all 127.0.0.1/32 trust
       host all all ::1/128 trust
     '';
     enable = true;
     enableTCPIP = false;
     extraPlugins = with pkgs.postgresql_16.pkgs; [ pg_repack ];
     package = pkgs.postgresql_16;
   };

You need to package it, and add it to the extraPlugins.

Thanks for your help.
How do I package it?
What shall be packaged?

I am not proficient in this sub-ecosystem. Therefore I can’t say anything about the specifics about how to package the extension, though you might take inspiration from other PostgreSQL extensions that are already packaged.