1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7
8let
9 cfg = config.programs.xwayland;
10
11in
12
13{
14 options.programs.xwayland = {
15
16 enable = lib.mkEnableOption "Xwayland (an X server for interfacing X11 apps with the Wayland protocol)";
17
18 defaultFontPath = lib.mkOption {
19 type = lib.types.str;
20 default = lib.optionalString config.fonts.fontDir.enable "/run/current-system/sw/share/X11/fonts";
21 defaultText = lib.literalExpression ''
22 optionalString config.fonts.fontDir.enable "/run/current-system/sw/share/X11/fonts"
23 '';
24 description = ''
25 Default font path. Setting this option causes Xwayland to be rebuilt.
26 '';
27 };
28
29 package = lib.mkOption {
30 type = lib.types.path;
31 default = pkgs.xwayland.override (oldArgs: {
32 inherit (cfg) defaultFontPath;
33 });
34 defaultText = lib.literalExpression ''
35 pkgs.xwayland.override (oldArgs: {
36 inherit (config.programs.xwayland) defaultFontPath;
37 })
38 '';
39 description = "The Xwayland package to use.";
40 };
41
42 };
43
44 config = lib.mkIf cfg.enable {
45
46 # Needed by some applications for fonts and default settings
47 environment.pathsToLink = [ "/share/X11" ];
48
49 environment.systemPackages = [ cfg.package ];
50
51 };
52}