New install, vivaldi not starting

On new system x86_64 installed with KDE 6 with wayland, i install also vivaldi but it is not starting at all.

i saw a correction on vivaldi: allow selecting qt5 or 6 and gtk3 or 4 by matklad · Pull Request #292148 · NixOS/nixpkgs · GitHub but i don’t know at all how to apply it, as newby on nixos.

(pkgs.vivaldi.overrideAttrs (oldAttrs: {
buildPhase = builtins.replaceStrings
[“for f in libGLESv2.so libqt5_shim.so ; do”]
[“for f in libGLESv2.so libqt5_shim.so libqt6_shim.so ; do”]
oldAttrs.buildPhase
;
})).override {
qt5 = pkgs.qt6;
commandLineArgs = [ “–ozone-platform=wayland” ];
proprietaryCodecs = true;
enableWidevine = true;
};

it is not adding like that in configuration.nix : ?
environment.systemPackages = with pkgs; [
htop
vivaldi
(pkgs.vivaldi.overrideAttrs (oldAttrs: {
buildPhase = builtins.replaceStrings
[“for f in libGLESv2.so libqt5_shim.so ; do”]
[“for f in libGLESv2.so libqt5_shim.so libqt6_shim.so ; do”]
oldAttrs.buildPhase
;
})).override {
qt5 = pkgs.qt6;
commandLineArgs = [ “–ozone-platform=wayland” ];
# The following two are just my preference, feel free to leave them out
proprietaryCodecs = true;
enableWidevine = true;
}

I think you might need another pair of parenthesis there? That’s what I use right now:

Thanks a lot, now the build passed, but i see that vivaldi is not stating at all.
Via command line :

[david@nixos:~]$ vivaldi
Gtk-Message: 19:27:32.484: Failed to load module "appmenu-gtk-module": 'gtk_module_display_init': /run/current-system/sw/lib/gtk-3.0/modules/libcolorreload-gtk-module.so: undefined symbol: gtk_module_display_init
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

[0928/192732.504873:ERROR:elf_dynamic_array_reader.h(64)] tag not found
[0928/192732.505452:ERROR:process_memory_range.cc(75)] read out of range
Aborted (core dumped)

[david@nixos:~]$

I think you’re missing libsForQt5.qt5.qtwayland.

My full overlay:

      vivaldi =
        (prev.vivaldi.overrideAttrs (oldAttrs: {
          dontWrapQtApps = false;
          dontPatchELF = true;
          nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [pkgs.kdePackages.wrapQtAppsHook];
        }))
        .override {
          commandLineArgs = ''
            --enable-features=UseOzonePlatform
            --ozone-platform=wayland
            --ozone-platform-hint=auto
            --enable-features=WaylandWindowDecorations
          '';
        };
    })

sorry but i’m too much newby to know exactly how to use your overlay and what action to have for the missing : libsForQt5.qt5.qtwayland ?

does i have to insert that in the configuration.nix file ?

Ah, my bad!

libsForQt5.qt5.qtwayland is a package, you should add to your system packages. Better not ask me about the details, I basically know as much as you do.

The overlay takes the vivaldi package from nixpkgs and changes its configuration. Besides adding some qt stuff, it adds commandline arguments to be used when starting vivaldi, for wayland. In my case, I imported that overlay in my flake.nix for that nixos Configuration. You can take a look here, but my configuration is surely not following best practises and so on.

finally it work with :

    (vivaldi.overrideAttrs
      (oldAttrs: {
        dontWrapQtApps = false;
        dontPatchELF = true;
        nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [pkgs.kdePackages.wrapQtAppsHook];
      }))