-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nyxt: fix darwin build #126082
base: master
Are you sure you want to change the base?
nyxt: fix darwin build #126082
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,96 @@ | ||
{ stdenv, lib, lispPackages | ||
, makeWrapper, wrapGAppsHook, gst_all_1 | ||
, glib, gdk-pixbuf, cairo | ||
, mime-types, pango, gtk3 | ||
, glib-networking, gsettings-desktop-schemas | ||
, xclip, notify-osd, enchant | ||
{ lib | ||
, stdenv | ||
, cairo | ||
, enchant | ||
, gdk-pixbuf | ||
, glib | ||
, glib-networking | ||
, gobject-introspection | ||
, gsettings-desktop-schemas | ||
, gtk3 | ||
, gst_all_1 | ||
, lispPackages | ||
, mime-types | ||
, pango | ||
, wrapGAppsHook | ||
, xclip | ||
}: | ||
|
||
stdenv.mkDerivation rec { | ||
pname = "nyxt"; | ||
inherit (lispPackages.nyxt.meta) version; | ||
inherit (lispPackages.nyxt-unwrapped.meta) version; | ||
|
||
src = lispPackages.nyxt; | ||
src = lispPackages.nyxt-unwrapped; | ||
|
||
nativeBuildInputs = [ makeWrapper wrapGAppsHook ]; | ||
gstBuildInputs = with gst_all_1; [ | ||
gstreamer gst-libav | ||
nativeBuildInputs = [ wrapGAppsHook ]; | ||
buildInputs = [ | ||
cairo | ||
enchant | ||
gdk-pixbuf | ||
glib | ||
glib-networking | ||
gobject-introspection | ||
gsettings-desktop-schemas | ||
gtk3 | ||
mime-types | ||
pango | ||
] ++ (with gst_all_1; [ | ||
gstreamer | ||
gst-libav | ||
gst-plugins-base | ||
gst-plugins-good | ||
gst-plugins-bad | ||
gst-plugins-ugly | ||
]; | ||
buildInputs = [ | ||
glib gdk-pixbuf cairo | ||
mime-types pango gtk3 | ||
glib-networking gsettings-desktop-schemas | ||
xclip notify-osd enchant | ||
] ++ gstBuildInputs; | ||
]); | ||
|
||
GST_PLUGIN_SYSTEM_PATH_1_0 = lib.concatMapStringsSep ":" (p: "${p}/lib/gstreamer-1.0") gstBuildInputs; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setting |
||
binPath = lib.optionals (!stdenv.isDarwin) [ xclip ]; | ||
|
||
doInstallCheck = !stdenv.isDarwin; | ||
dontBuild = true; | ||
dontWrapGApps = true; | ||
|
||
# stripping breaks the Linux build, possibly because the resulting binary is | ||
# already stripped once in lispPackages.nyxt | ||
dontStrip = true; | ||
|
||
installPhase = '' | ||
mkdir -p $out/share/applications/ | ||
sed "s/VERSION/$version/" $src/lib/common-lisp/nyxt/assets/nyxt.desktop > $out/share/applications/nyxt.desktop | ||
for i in 16 32 128 256 512; do | ||
mkdir -p "$out/share/icons/hicolor/''${i}x''${i}/apps/" | ||
cp -f $src/lib/common-lisp/nyxt/assets/nyxt_''${i}x''${i}.png "$out/share/icons/hicolor/''${i}x''${i}/apps/nyxt.png" | ||
done | ||
|
||
mkdir -p $out/bin && makeWrapper $src/bin/nyxt $out/bin/nyxt \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This didn't work because |
||
--prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "${GST_PLUGIN_SYSTEM_PATH_1_0}" \ | ||
--argv0 nyxt "''${gappsWrapperArgs[@]}" | ||
''; | ||
runHook preInstall | ||
'' + (if stdenv.isDarwin then '' | ||
mkdir -p $out/bin $out/Applications/Nyxt.app/Contents | ||
pushd $out/Applications/Nyxt.app/Contents | ||
install -Dm644 $src/lib/common-lisp/nyxt-unwrapped/assets/Info.plist Info.plist | ||
install -Dm644 $src/lib/common-lisp/nyxt-unwrapped/assets/nyxt.icns Resources/nyxt.icns | ||
install -Dm755 $src/bin/nyxt MacOS/nyxt | ||
popd | ||
|
||
gappsWrapperArgsHook # FIXME: currently runs at preFixup | ||
wrapGApp $out/Applications/Nyxt.app/Contents/MacOS/nyxt \ | ||
--prefix PATH : "${lib.makeBinPath binPath}" \ | ||
--argv0 nyxt | ||
|
||
ln -s $out/Applications/Nyxt.app/Contents/MacOS/nyxt $out/bin/nyxt | ||
'' else '' | ||
mkdir -p $out/share/applications/ | ||
sed "s/VERSION/$version/" $src/lib/common-lisp/nyxt-unwrapped/assets/nyxt.desktop > $out/share/applications/nyxt.desktop | ||
for i in 16 32 128 256 512; do | ||
mkdir -p "$out/share/icons/hicolor/''${i}x''${i}/apps/" | ||
cp -f $src/lib/common-lisp/nyxt-unwrapped/assets/nyxt_''${i}x''${i}.png "$out/share/icons/hicolor/''${i}x''${i}/apps/nyxt.png" | ||
done | ||
|
||
install -Dm755 $src/bin/nyxt $out/bin/nyxt | ||
|
||
gappsWrapperArgsHook # FIXME: currently runs at preFixup | ||
wrapGApp $out/bin/nyxt \ | ||
--prefix PATH : "${lib.makeBinPath binPath}" \ | ||
--argv0 nyxt | ||
'') + '' | ||
runHook postInstall | ||
''; | ||
|
||
checkPhase = '' | ||
installCheckPhase = '' | ||
runHook preCheck | ||
$out/bin/nyxt -h | ||
runHook postCheck | ||
''; | ||
|
||
meta = with lib; { | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -122,29 +122,49 @@ let lispPackages = rec { | |||||||||||||||||||||||
|
||||||||||||||||||||||||
asdFilesToKeep = [ "cluffer.asd" "cluffer-base.asd" "cluffer-simple-buffer.asd" "cluffer-simple-line.asd" "cluffer-standard-buffer.asd" "cluffer-standard-line.asd" ]; | ||||||||||||||||||||||||
}; | ||||||||||||||||||||||||
nyxt = pkgs.lispPackages.buildLispPackage rec { | ||||||||||||||||||||||||
baseName = "nyxt"; | ||||||||||||||||||||||||
nyxt-unwrapped = pkgs.lispPackages.buildLispPackage rec { | ||||||||||||||||||||||||
baseName = "nyxt-unwrapped"; | ||||||||||||||||||||||||
version = "2.0.0"; | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
description = "Browser"; | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
overrides = x: { | ||||||||||||||||||||||||
patches = [ | ||||||||||||||||||||||||
# Fixes a startup crash on Darwin | ||||||||||||||||||||||||
# https://github.com/atlas-engineer/nyxt/pull/1476 | ||||||||||||||||||||||||
(pkgs.fetchpatch { | ||||||||||||||||||||||||
url = "https://github.com/midchildan/nyxt/commit/6184884b48b7cacdc51d104cb2299c26437a73d8.diff"; | ||||||||||||||||||||||||
sha256 = "sha256-A8Hwfjn/B5fv8OTKM5i9YrNFAMbPAg9xRH7gwoMMlQs="; | ||||||||||||||||||||||||
}) | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Fix list-buffers | ||||||||||||||||||||||||
(pkgs.fetchpatch { | ||||||||||||||||||||||||
url = "https://github.com/atlas-engineer/nyxt/commit/4e2efb5a456d8d647f3eeaeb52cb21f96c92471c.diff"; | ||||||||||||||||||||||||
sha256 = "sha256-xt+jXZlTktznAoEWsaO5uQywo+bR9PecgTKOjY7UNvY="; | ||||||||||||||||||||||||
}) | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Fix non-functional "Update" button in the buffer list | ||||||||||||||||||||||||
# https://github.com/atlas-engineer/nyxt/pull/1484 | ||||||||||||||||||||||||
(pkgs.fetchpatch { | ||||||||||||||||||||||||
url = "https://github.com/midchildan/nyxt/commit/7589181d6e367442bad8011f0ef5b42fc1cfd3c5.diff"; | ||||||||||||||||||||||||
sha256 = "sha256-4uXm7yxkhcArk39JBealGr1N4r/8AM5v/1VYHw1y4hw="; | ||||||||||||||||||||||||
}) | ||||||||||||||||||||||||
]; | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
postInstall = '' | ||||||||||||||||||||||||
echo "Building nyxt binary" | ||||||||||||||||||||||||
( | ||||||||||||||||||||||||
source "$out/lib/common-lisp-settings"/*-shell-config.sh | ||||||||||||||||||||||||
cd "$out/lib/common-lisp"/*/ | ||||||||||||||||||||||||
makeFlags="''${makeFlags:-}" | ||||||||||||||||||||||||
make LISP=common-lisp.sh NYXT_INTERNAL_QUICKLISP=false PREFIX="$out" $makeFlags all | ||||||||||||||||||||||||
make LISP=common-lisp.sh NYXT_INTERNAL_QUICKLISP=false PREFIX="$out" $makeFlags install | ||||||||||||||||||||||||
cp nyxt "$out/bin/nyxt" | ||||||||||||||||||||||||
) | ||||||||||||||||||||||||
Comment on lines
-134
to
-141
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was redundant because it creates a broken build artifact |
||||||||||||||||||||||||
|
||||||||||||||||||||||||
# clear unnecessary environment variables to avoid hitting the limit | ||||||||||||||||||||||||
env -i \ | ||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's necessary to clear unnecessary environment variables because otherwise it hits the length limit imposed by the OS. This is similar to what is done in nixpkgs/pkgs/development/lisp-modules/define-package.nix Lines 89 to 99 in 8284fc3
|
||||||||||||||||||||||||
NIX_LISP="$NIX_LISP" \ | ||||||||||||||||||||||||
NIX_LISP_PRELAUNCH_HOOK=' | ||||||||||||||||||||||||
nix_lisp_build_system nyxt/gtk-application \ | ||||||||||||||||||||||||
"(asdf/system:component-entry-point (asdf:find-system :nyxt/gtk-application))" \ | ||||||||||||||||||||||||
"" "(format *error-output* \"Alien objects:~%~s~%\" sb-alien::*shared-objects*)" | ||||||||||||||||||||||||
' "$out/bin/nyxt-lisp-launcher.sh" | ||||||||||||||||||||||||
cp "$out/lib/common-lisp/nyxt/nyxt" "$out/bin/" | ||||||||||||||||||||||||
nix_lisp_build_system nyxt/gi-gtk-application \ | ||||||||||||||||||||||||
"(asdf/system:component-entry-point (asdf:find-system :nyxt/gi-gtk-application))" \ | ||||||||||||||||||||||||
"" \ | ||||||||||||||||||||||||
"(format *error-output* \"Alien objects:~%~s~%\" sb-alien::*shared-objects*)" | ||||||||||||||||||||||||
' "$out/bin/${baseName}-lisp-launcher.sh" | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
mv "$out/lib/common-lisp/${baseName}/nyxt" "$out/bin/" | ||||||||||||||||||||||||
''; | ||||||||||||||||||||||||
}; | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
|
@@ -205,5 +225,8 @@ let lispPackages = rec { | |||||||||||||||||||||||
pkgs.sbcl | ||||||||||||||||||||||||
]; | ||||||||||||||||||||||||
}; | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# added 2021-06-14 | ||||||||||||||||||||||||
nyxt = throw "lispPackages.nyxt was renamed to lispPackages.nyxt-unwrapped"; | ||||||||||||||||||||||||
}; | ||||||||||||||||||||||||
in lispPackages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xclip
inbuildInputs
doesn't have any effect because it's a CLI tool, not a library. I've addedxclip
to the wrapper instead.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
notify-osd
is removed since it's no longer needed. Details in #125113 (comment).