1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7let
8 cfg = config.programs.wayfire;
9in
10{
11 meta.maintainers = with lib.maintainers; [ rewine ];
12
13 options.programs.wayfire = {
14 enable = lib.mkEnableOption "Wayfire, a wayland compositor based on wlroots";
15
16 package = lib.mkPackageOption pkgs "wayfire" { };
17
18 plugins = lib.mkOption {
19 type = lib.types.listOf lib.types.package;
20 default = with pkgs.wayfirePlugins; [
21 wcm
22 wf-shell
23 ];
24 defaultText = lib.literalExpression "with pkgs.wayfirePlugins; [ wcm wf-shell ]";
25 example = lib.literalExpression ''
26 with pkgs.wayfirePlugins; [
27 wcm
28 wf-shell
29 wayfire-plugins-extra
30 ];
31 '';
32 description = ''
33 Additional plugins to use with the wayfire window manager.
34 '';
35 };
36 xwayland.enable = lib.mkEnableOption "XWayland" // {
37 default = true;
38 };
39 };
40
41 config =
42 let
43 finalPackage = pkgs.wayfire-with-plugins.override {
44 wayfire = cfg.package;
45 plugins = cfg.plugins;
46 };
47 in
48 lib.mkIf cfg.enable (
49 lib.mkMerge [
50 {
51 environment.systemPackages = [ finalPackage ];
52
53 services.displayManager.sessionPackages = [ finalPackage ];
54
55 xdg.portal = {
56 enable = lib.mkDefault true;
57 wlr.enable = lib.mkDefault true;
58 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1050914
59 config.wayfire.default = lib.mkDefault [
60 "wlr"
61 "gtk"
62 ];
63 };
64 }
65 (import ./wayland-session.nix {
66 inherit lib pkgs;
67 enableXWayland = cfg.xwayland.enable;
68 })
69 ]
70 );
71}