Skip to content

Commit

Permalink
racket: fix failure to find executable
Browse files Browse the repository at this point in the history
Fix #377763.
  • Loading branch information
rc-zb committed Feb 4, 2025
1 parent 9f953c1 commit 3a8ef07
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 20 deletions.
9 changes: 9 additions & 0 deletions pkgs/development/interpreters/racket/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ minimal.overrideAttrs (
wrapGAppsHook3
];

patches = prevAttrs.patches or [ ] ++ [
/*
Hardcode variant detection because nixpkgs wraps the Racket binary making it
fail to detect its variant at runtime.
https://github.com/NixOS/nixpkgs/issues/114993#issuecomment-812951247
*/
./patches/force-cs-variant.patch
];

preBuild =
let
libPaths = makeLibPaths finalAttrs.buildInputs;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- old/collects/setup/variant.rkt
+++ new/collects/setup/variant.rkt
@@ -7,7 +7,8 @@
(provide variant-suffix
script-variant?)

-(define plain-variant
+(define plain-variant 'cs)
+#;(define plain-variant
(delay/sync
(cond
[(cross-installation?)
Original file line number Diff line number Diff line change
@@ -1,27 +1,45 @@
{ runCommandLocal, racket }:
{
lib,
runCommandLocal,
racket,
}:

runCommandLocal "racket-test-get-version-and-variant"
{
nativeBuildInputs = [ racket ];
}
''
expectation="${racket.version}"
(
lib.concatLines (
builtins.map
(
{ expectation, output }:
''
expectation="${expectation}"
output="$(racket -e '(display (version))')"
output="${output}"
if test "$output" != "$expectation"; then
echo "output mismatch: expected ''${expectation}, but got ''${output}"
exit 1
fi
expectation="cs"
output="$(racket -e '(require launcher/launcher) (display (current-launcher-variant))')"
if test "$output" != "$expectation"; then
echo "output mismatch: expected ''${expectation}, but got ''${output}"
exit 1
fi
touch $out
''
if test "$output" != "$expectation"; then
echo "output mismatch: expected ''${expectation}, but got ''${output}"
exit 1
fi
''
)
[
{
expectation = racket.version;
output = "$(racket -e '(display (version))')";
}
{
expectation = "cs";
output = "$(racket -e '(require launcher/launcher) (display (current-launcher-variant))')";
}
{
expectation = "${lib.getExe racket}";
output = "$(racket -e '(require compiler/find-exe) (display (find-exe))')";
}
]
)
+ ''
touch $out
''
)

0 comments on commit 3a8ef07

Please sign in to comment.