Unverified Commit 248893ed authored by 7c6f434c's avatar 7c6f434c Committed by GitHub
Browse files

Merge pull request #321845 from Uthar/nyxt-bundled-dependencies

Nyxt bundled dependencies
parents 52247efc 0875a51b
Loading
Loading
Loading
Loading
+88 −40
Original line number Diff line number Diff line
{ stdenv, lib, sbclPackages
, makeWrapper, wrapGAppsHook3, gst_all_1
, glib, gdk-pixbuf, cairo
, mailcap, pango, gtk3
, glib-networking, gsettings-desktop-schemas
, xclip, wl-clipboard, notify-osd, enchant
{ stdenv
, lib
, testers
, wrapGAppsHook3
, fetchzip
, sbcl
, pkg-config
, libfixposix
, gobject-introspection
, gsettings-desktop-schemas
, glib-networking
, notify-osd
, gtk3
, glib
, gdk-pixbuf
, cairo
, pango
, webkitgtk
, openssl
, gstreamer
, gst-libav
, gst-plugins-base
, gst-plugins-good
, gst-plugins-bad
, gst-plugins-ugly
, xdg-utils
, xclip
, wl-clipboard
}:

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
  pname = "nyxt";
  inherit (sbclPackages.nyxt) version;
  version = "3.11.8";

  src = sbclPackages.nyxt;
  src = fetchzip {
    url = "https://github.com/atlas-engineer/nyxt/releases/download/${finalAttrs.version}/nyxt-${finalAttrs.version}-source-with-submodules.tar.xz";
    hash = "sha256-mLf2dvnXYUwPEB3QkoB/O3m/e96t6ISUZNfh+y1ArX4=";
    stripRoot = false;
  };

  # for sbcl 2.4.3
  postPatch = ''
    substituteInPlace _build/cl-gobject-introspection/src/init.lisp \
       --replace-warn sb-ext::set-floating-point-modes sb-int:set-floating-point-modes
    substituteInPlace _build/fset/Code/port.lisp \
       --replace-warn sb-ext::once-only sb-int:once-only
  '';

  nativeBuildInputs = [ makeWrapper wrapGAppsHook3 ];
  gstBuildInputs = with gst_all_1; [
    gstreamer gst-libav
  nativeBuildInputs = [ wrapGAppsHook3 ];

  buildInputs = [
    sbcl
    # for groveller
    pkg-config libfixposix
    # for gappsWrapper
    gobject-introspection
    gsettings-desktop-schemas
    glib-networking
    notify-osd
    gtk3
    gstreamer
    gst-libav
    gst-plugins-base
    gst-plugins-good
    gst-plugins-bad
    gst-plugins-ugly
  ];
  buildInputs = [
    glib gdk-pixbuf cairo
    mailcap pango gtk3
    glib-networking gsettings-desktop-schemas
    notify-osd enchant
  ] ++ gstBuildInputs;

  GST_PLUGIN_SYSTEM_PATH_1_0 = lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" gstBuildInputs;

  # The executable is already built in sbclPackages.nyxt, buildPhase tries to build using the makefile which we ignore
  dontBuild = true;

  dontWrapGApps = true;
  installPhase = ''
    mkdir -p $out/share/applications/
    sed "s/VERSION/$version/" $src/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/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 PATH : ${lib.makeBinPath [ xclip wl-clipboard ]} \
      --prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "${GST_PLUGIN_SYSTEM_PATH_1_0}" \
      --argv0 nyxt "''${gappsWrapperArgs[@]}"

  # for cffi
  LD_LIBRARY_PATH = lib.makeLibraryPath [
    glib
    gobject-introspection
    gdk-pixbuf
    cairo
    pango
    gtk3
    webkitgtk
    openssl
    libfixposix
  ];

  postConfigure = ''
    export CL_SOURCE_REGISTRY="$(pwd)/_build//"
    export ASDF_OUTPUT_TRANSLATIONS="$(pwd):$(pwd)"
    export PREFIX="$out"
    export NYXT_VERSION="$version"
  '';

  checkPhase = ''
    $out/bin/nyxt -h
  # don't refresh from git
  makeFlags = [ "all" "NYXT_SUBMODULES=false" ];

  preFixup = ''
    gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : "$LD_LIBRARY_PATH")
    gappsWrapperArgs+=(--prefix PATH : "${lib.makeBinPath [ xdg-utils xclip wl-clipboard ]}")
  '';

  # prevent corrupting core in exe
  dontStrip = true;

  passthru.tests.version = testers.testVersion { package = finalAttrs.finalPackage; };

  meta = with lib; {
    description = "Infinitely extensible web-browser (with Lisp development files using WebKitGTK platform port)";
    mainProgram = "nyxt";
@@ -59,4 +107,4 @@ stdenv.mkDerivation rec {
    maintainers = with maintainers; [ lewo dariof4 ];
    platforms = platforms.all;
  };
}
})
+0 −265
Original line number Diff line number Diff line
@@ -206,271 +206,6 @@ let
    lispLibs = super.mathkit.lispLibs ++ [ super.sb-cga ];
  };

  cl-colors2_0_5_4 = build-asdf-system {
    inherit (super.cl-colors2) pname systems lispLibs;
    version = "0.5.4";

    src = pkgs.fetchgit {
      url = "https://codeberg.org/cage/cl-colors2";
      rev = "v0.5.4";
      sha256 = "sha256-JbT1BKjaXDwdlzHLPjX1eg0RMIOT86R17SPgbe2h+tA=";
    };
  };

  prompter = build-asdf-system rec {
    pname = "prompter";
    version = "20240108-git";

    src = pkgs.fetchFromGitHub {
      owner = "atlas-engineer";
      repo = "prompter";
      rev = "7890ed5d02e70aba01ceb964c6ee4f40776e7dc0";
      hash = "sha256-rRKtpSKAqfzvnlC3NQ4840RrlbBUpI4V6uX6p5hRJWQ=";
    };

    lispLibs = [
      self.cl-containers
      self.nclasses
      self.alexandria
      self.calispel
      self.closer-mop
      self.lparallel
      self.moptilities
      self.serapeum
      self.str
      self.trivial-package-local-nicknames
    ];

  };

  njson = build-asdf-system rec {
    pname = "njson";
    version = "1.2.2";
    src = pkgs.fetchFromGitHub {
      owner = "atlas-engineer";
      repo = "njson";
      rev = version;
      sha256 = "sha256-kw5DD0GJp/TeCiYATBY8GL8UKqYS6Q4j0a0eQsdcZRc=";
    };
    lispLibs = [ self.cl-json self.com_dot_inuoe_dot_jzon];
    systems = [ "njson" "njson/cl-json" "njson/jzon"];
  };

  nsymbols = build-asdf-system rec {
    pname = "nsymbols";
    version = "0.3.2";
    src = pkgs.fetchFromGitHub {
      owner = "atlas-engineer";
      repo = "nsymbols";
      rev = version;
      sha256 = "sha256-psk29WEA7Hxgp29oUniBNvI+lyZfMkdpa5A7okc6kKs=";
    };
    lispLibs = [ self.closer-mop ];
    systems = [ "nsymbols" "nsymbols/star" ];

  };

  nclasses = build-asdf-system rec {
    pname = "nclasses";
    version = "0.6.1";
    src = pkgs.fetchFromGitHub {
      owner = "atlas-engineer";
      repo = "nclasses";
      rev = version;
      sha256 = "sha256-foXmaLxMYMFieB2Yd2iPsU4EX5kLXq7kyElqGZ47OgI=";
    };
    lispLibs = [ self.moptilities ];
  };

  nfiles = build-asdf-system rec {
    pname = "nfiles";
    version = "1.1.4";
    src = pkgs.fetchFromGitHub {
      owner = "atlas-engineer";
      repo = "nfiles";
      rev = version;
      sha256 = "sha256-4rhpBErQgZHcwZRblxgiYaUmKalvllSbJjnRteDVH6k=";
    };
    lispLibs = [
      self.nclasses
      self.quri
      self.alexandria
      self.iolib
      self.serapeum
      self.trivial-garbage
      self.trivial-package-local-nicknames
      self.trivial-types
    ];
  };

  nhooks = build-asdf-system rec {
    pname = "nhooks";
    version = "1.2.2";
    src = pkgs.fetchFromGitHub {
      owner = "atlas-engineer";
      repo = "nhooks";
      rev = version;
      hash = "sha256-6A3fsemsv2KbTmdGMQeL9iHFUBHc4kK6CRNVyc91LdU=";
    };
    lispLibs = with self; [ bordeaux-threads closer-mop serapeum ];
  };

  nkeymaps = build-asdf-system rec {
    pname = "nkeymaps";
    version = "1.1.1";
    src = pkgs.fetchFromGitHub {
      owner = "atlas-engineer";
      repo = "nkeymaps";
      rev = version;
      hash = "sha256-/t85Yh4EvnSyIM6xeDBLmfVz3wddmavInXzeYafNMJ0=";
    };
    lispLibs = with self; [ alexandria fset trivial-package-local-nicknames
                            str ];
  };


  history-tree = build-asdf-system rec {
    pname = "history-tree";
    version = "0.1.2";
    src = pkgs.fetchFromGitHub {
      owner = "atlas-engineer";
      repo = "history-tree";
      rev = version;
      hash = "sha256-wpVONvShNnvrPOlbNoX/t9sYiwxnIKnnJaJyALEyeNg=";
    };
    lispLibs = with self; [
      alexandria
      cl-custom-hash-table
      local-time
      nclasses
      trivial-package-local-nicknames
    ];
  };

  nyxt-gtk = build-asdf-system {
    pname = "nyxt";
    version = "3.11.6";

    lispLibs = (with self; [
      alexandria
      bordeaux-threads
      calispel
      cl-base64
      cl-gopher
      cl-html-diff
      cl-json
      cl-ppcre
      cl-ppcre-unicode
      cl-prevalence
      cl-qrencode
      cl-tld
      closer-mop
      dissect
      moptilities
      dexador
      enchant
      flexi-streams
      idna
      iolib
      lass
      local-time
      lparallel
      log4cl
      montezuma
      ndebug
      osicat
      parenscript
      py-configparser
      serapeum
      str
      phos
      plump
      clss
      spinneret
      trivia
      trivial-features
      trivial-garbage
      trivial-package-local-nicknames
      trivial-types
      unix-opts
      cluffer
      cl-cffi-gtk
      quri
      sqlite
      trivial-clipboard
      cl-gobject-introspection
      cl-webkit2
      slynk
      iterate
      symbol-munger
      history-tree
      nhooks
      nkeymaps
      prompter
      cl-colors2_0_5_4
      njson
      nsymbols
      nclasses
      nfiles
      cl-containers
      swank
    ]);

    src = pkgs.fetchFromGitHub {
      owner = "atlas-engineer";
      repo = "nyxt";
      rev = "3.11.6";
      hash = "sha256-o+4LnSNyhdz5YAjNQJuE2ERtt48PckjKfts9QVRw82A=";
    };

    nativeBuildInputs = [ pkgs.makeWrapper ];

    buildInputs = [
      # needed for GSETTINGS_SCHEMAS_PATH
      pkgs.gsettings-desktop-schemas pkgs.glib pkgs.gtk3

      # needed for XDG_ICON_DIRS
      pkgs.adwaita-icon-theme
    ];

    # This patch removes the :build-operation component from the nyxt/gi-gtk-application system.
    # This is done because if asdf:operate is used and the operation matches the system's :build-operation
    # then output translations are ignored, causing the result of the operation to be placed where
    # the .asd is located, which in this case is the nix store.
    # see: https://gitlab.common-lisp.net/asdf/asdf/-/blob/master/doc/asdf.texinfo#L2582
    patches = [ ./patches/nyxt-remove-build-operation.patch ];

    NASDF_USE_LOGICAL_PATHS = true;

    buildScript = pkgs.writeText "build-nyxt.lisp" ''
      (load "${super.alexandria.asdfFasl}/asdf.${super.alexandria.faslExt}")
      (require :uiop)
      (let ((pwd (uiop:ensure-directory-pathname (uiop/os:getcwd))))
        (asdf:load-asd (uiop:merge-pathnames* "libraries/nasdf/nasdf.asd" pwd))
        (asdf:load-asd (uiop:merge-pathnames* "nyxt.asd" pwd)))
      ;; There's a weird error while copy/pasting in Nyxt that manifests with sb-ext:save-lisp-and-die, so we use asdf:operare :program-op instead
      (asdf:operate :program-op :nyxt/gi-gtk-application)
    '';

    # TODO(kasper): use wrapGAppsHook3
    installPhase = ''
      mkdir -pv $out
      cp -r * $out
      rm -fv $out/nyxt
      mkdir -p $out/bin
      cp -v nyxt $out/bin
      wrapProgram $out/bin/nyxt \
        --prefix LD_LIBRARY_PATH : $LD_LIBRARY_PATH \
        --prefix XDG_DATA_DIRS : $XDG_ICON_DIRS \
        --prefix XDG_DATA_DIRS : $GSETTINGS_SCHEMAS_PATH \
        --prefix GI_TYPELIB_PATH : $GI_TYPELIB_PATH \
        --prefix GIO_EXTRA_MODULES ":" ${pkgs.dconf.lib}/lib/gio/modules/ \
        --prefix GIO_EXTRA_MODULES ":" ${pkgs.glib-networking}/lib/gio/modules/
    '';
  };

  nyxt = self.nyxt-gtk;

  stumpwm = super.stumpwm.overrideLispAttrs (o: rec {
    version = "22.11";
    src = pkgs.fetchFromGitHub {
+10 −1
Original line number Diff line number Diff line
@@ -9732,7 +9732,16 @@ with pkgs;
  nkeys = callPackage ../tools/system/nkeys { };
  nyxt = callPackage ../applications/networking/browsers/nyxt { };
  nyxt = callPackage ../applications/networking/browsers/nyxt {
    sbcl = sbcl_2_4_6;
    inherit (gst_all_1)
      gstreamer
      gst-libav
      gst-plugins-base
      gst-plugins-good
      gst-plugins-bad
      gst-plugins-ugly;
  };
  nfpm = callPackage ../tools/package-management/nfpm { };