local util = dofile('common.lua')
local sthunk = function(...) local a = {...} return function() return util.exec(a) end end

return {
	mbedtls = { 
		libs = {'mbedtls', 'mbedcrypto', 'mbedx509'};
		osvars = {
			linux_nixos = { -- lacks a *.pc on nixos systems
				-- prefix = sthunk('nix', 'path-info', 'nixos.mbedtls');
				prefix = os.getenv("parsav_pkg_mbedtls_prefix");
			}
		};
		vars = { builddir = '/library', srcincdir = '/include' };
	};
	mongoose = { vars = { builddir = '' } };
	mjson = { vars = { builddir = '', srcincdir = '/src' } };
	libpq = {
		osvars = {
			linux_nixos = {
				prefix = os.getenv("parsav_pkg_libpq_libdir");
				incdir = os.getenv("parsav_pkg_libpq_incdir");
				-- prefix = sthunk('nix', 'path-info', 'nixos.postgresql.lib');
				-- incdir = function()
				-- 	local a = {'nix', 'path-info', 'nixos.postgresql'}
				-- 	return (util.exec(a)) .. '/include';
				-- end;
			};
		};
		vars = {pcname = 'postgresql';}
	};
	libc = {
		libs = {'c'}; -- libc.so probably does not need explicit mention, but
		osvars = {
			linux = { override = 'glibc'; };
			linux_nixos = {
				prefix = os.getenv("parsav_pkg_glibc_prefix");
				-- prefix = sthunk('nix', 'path-info', 'nixos.glibc');
				override = 'glibc';
			};
		}
	};
}
