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