Fixing 1Password on NixOS/Wayland with Nvidia Graphics

by Peter Stuart on July 1, 2023

I’m running Wayland on NixOS using Nvidia graphics. 1PasswordAvailable in the _1password-gui package.

is not compatible by default with that setup and starts up with a black window:

1Password support suggests running 1Password with the --disable-gpu-sandbox option, which works from the command line, but to use that option when launching 1Password with the GNOME launcher, we need to edit the .desktop file that’s included with the package. Since that file is immutable in NixOS, I wrote an overlayBased on a comment in the NixOS subreddit.

for the _1password-gui package which overrides that file.

In my home-managerYou should be able to do something similar if you are using NixOS to install 1Password for the entire system, instead of using home-manager.

config:

nixpkgs.overlays = [ (import ./overlays/1password.nix) ];

… and in overlays/1password.nix:

final: prev: {
  _1password-gui = prev._1password-gui.overrideAttrs (oldAttrs: {
    postInstall = (oldAttrs.postInstall or "") + ''
      substituteInPlace $out/share/applications/1password.desktop \
        --replace "Exec=1password" "Exec=1password --disable-gpu-sandbox"
    '';
  });
}

We can see the result of the override by inspecting ~/.nix-profile/share/applications/1password.desktop, which is symlinked to the .desktop file in the Nix store.

[Desktop Entry]
Name=1Password
Exec=1password --disable-gpu-sandbox %U
Terminal=false
Type=Application
Icon=1password
StartupWMClass=1Password
Comment=Password manager and secure wallet
MimeType=x-scheme-handler/onepassword;
Categories=Office;

The file looks correct and 1Password works after being launched from the GNOME launcher:1Password doesn’t quit when the window is closed, so if you already have an instance running without the necessary option, you may need to killall 1password to shut it down before launching it again.