Slack: Difference between revisions

From NixOS Wiki
imported>Patryk27
No edit summary
imported>Rbjorklin
No edit summary
Line 72: Line 72:
   };
   };
};
};
</syntaxHighlight>
==== Window decorations ====
If the above configuration leaves you without window decorations you may want to enable this feature as well:
<syntaxHighlight lang="console">
WaylandWindowDecorations
</syntaxHighlight>
</syntaxHighlight>

Revision as of 02:24, 17 November 2023

Slack is a communication platform with a desktop application based on Electron.

Installation

NixOS

environment.systemPackages = with pkgs; [ slack ];

Non-NixOS

$ nix-env -iA nixos.slack

Tips

Wayland

If you're using recent nixpkgs (from 2022-01-27), you can enable native Wayland support by launching Slack as:

$ NIXOS_OZONE_WL=1 slack

... or by simply specifying this option globally:

environment.sessionVariables.NIXOS_OZONE_WL = "1";

If that doesn't work for you, you might be using an older nixpkgs where the NIXOS_OZONE_WL option didn't exist yet - in that case, you can launch Slack via:

$ slack --ozone-platform=wayland --enable-features=UseOzonePlatform,WebRTCPipeWireCapturer

... or, which is a bit more convenient, patch its derivation:

{ lib, pkgs, ... }:
let
  slack = pkgs.slack.overrideAttrs (old: {
    installPhase = old.installPhase + ''
      rm $out/bin/slack

      makeWrapper $out/lib/slack/slack $out/bin/slack \
        --prefix XDG_DATA_DIRS : $GSETTINGS_SCHEMAS_PATH \
        --prefix PATH : ${lib.makeBinPath [pkgs.xdg-utils]} \
        --add-flags "--ozone-platform=wayland --enable-features=UseOzonePlatform,WebRTCPipeWireCapturer"
    '';
  });

in
{
  environment.systemPackages = [ slack ];
}

In all of the cases, if you want to use screen-sharing, you'll have to enable xdg-desktop-portal, too:

xdg = {
  portal = {
    enable = true;
    extraPortals = with pkgs; [
      xdg-desktop-portal-wlr
      xdg-desktop-portal-gtk
    ];
    gtkUsePortal = true;
  };
};

Window decorations

If the above configuration leaves you without window decorations you may want to enable this feature as well:

WaylandWindowDecorations