racket-nix/build-racket-package.nix

59 lines
1.2 KiB
Nix

{
lib,
racket,
racketInstallHook,
stdenv,
wrapGAppsHook3,
}: lib.extendMkDerivation {
constructDrv = stdenv.mkDerivation;
excludeDrvArgNames = [
"dependencies"
];
extendDrvArgs = finalAttrs:
{
pname,
version,
nativeBuildInputs ? [],
propagatedBuildInputs ? [],
dependencies ? [],
tetheredInstallation ? false,
doMainSetup ? tetheredInstallation,
buildDocs ? tetheredInstallation,
...
} @ attrs: {
name = "racket${racket.version}-" + pname + "-" + version;
strictDeps = true;
dontConfigure = true;
dontBuild = true;
racketTetheredInstallation = tetheredInstallation;
racketDoMainSetup = doMainSetup;
racketBuildDocs = buildDocs;
nativeBuildInputs = [
racket
racketInstallHook
wrapGAppsHook3
] ++ nativeBuildInputs;
propagatedBuildInputs = [racket] ++ dependencies ++ propagatedBuildInputs;
dontWrapGApps = true;
preFixup = ''
find $out/bin -type f -executable -print0 |
while IFS= read -r -d ''' f; do
if test "$(file --brief --mime-type "$f")" = application/x-executable; then
wrapGApp "$f"
fi
done
'';
};
}