diff --git a/pkgs/applications/networking/browsers/nyxt/default.nix b/pkgs/applications/networking/browsers/nyxt/default.nix index 59bb2adbf5182..6b00e54794728 100644 --- a/pkgs/applications/networking/browsers/nyxt/default.nix +++ b/pkgs/applications/networking/browsers/nyxt/default.nix @@ -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; + 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 \ - --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; { diff --git a/pkgs/development/lisp-modules/lisp-packages.nix b/pkgs/development/lisp-modules/lisp-packages.nix index e4f623686a9af..10eb880fe663a 100644 --- a/pkgs/development/lisp-modules/lisp-packages.nix +++ b/pkgs/development/lisp-modules/lisp-packages.nix @@ -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" - ) + + # clear unnecessary environment variables to avoid hitting the limit + env -i \ + 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