summaryrefslogtreecommitdiffstats
path: root/nixos/modules/programs/wayland/wayfire.nix
blob: 2d8c6a8c54561092294dec492cc00b3d10bcf397 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{
  config,
  lib,
  pkgs,
  ...
}:
let
  cfg = config.programs.wayfire;
in
{
  meta.maintainers = with lib.maintainers; [ wineee ];

  options.programs.wayfire = {
    enable = lib.mkEnableOption "Wayfire, a wayland compositor based on wlroots";

    package = lib.mkPackageOption pkgs "wayfire" { };

    plugins = lib.mkOption {
      type = lib.types.listOf lib.types.package;
      default = with pkgs.wayfirePlugins; [
        wcm
        wf-shell
      ];
      defaultText = lib.literalExpression "with pkgs.wayfirePlugins; [ wcm wf-shell ]";
      example = lib.literalExpression ''
        with pkgs.wayfirePlugins; [
          wcm
          wf-shell
          wayfire-plugins-extra
        ];
      '';
      description = ''
        Additional plugins to use with the wayfire window manager.
      '';
    };
    xwayland.enable = lib.mkEnableOption "XWayland" // {
      default = true;
    };
  };

  config =
    let
      finalPackage = pkgs.wayfire-with-plugins.override {
        wayfire = cfg.package;
        plugins = cfg.plugins;
      };
    in
    lib.mkIf cfg.enable (
      lib.mkMerge [
        {
          environment.systemPackages = [ finalPackage ];

          services.displayManager.sessionPackages = [ finalPackage ];

          xdg.portal = {
            enable = lib.mkDefault true;
            wlr.enable = lib.mkDefault true;
            # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1050914
            config.wayfire.default = lib.mkDefault [
              "wlr"
              "gtk"
            ];
          };
        }
        (import ./wayland-session.nix {
          inherit lib pkgs;
          enableXWayland = cfg.xwayland.enable;
        })
      ]
    );
}