1{
2 config,
3 pkgs,
4 lib,
5 ...
6}:
7let
8 cfg = config.programs.river;
9in {
10 options.programs.river = {
11 enable = lib.mkEnableOption "river, a dynamic tiling Wayland compositor";
12
13 package = lib.mkPackageOption pkgs "river" {
14 nullable = true;
15 extraDescription = ''
16 Set to `null` to not add any River package to your path.
17 This should be done if you want to use the Home Manager River module to install River.
18 '';
19 };
20
21 extraPackages = lib.mkOption {
22 type = with lib.types; listOf package;
23 default = with pkgs; [
24 swaylock
25 foot
26 dmenu
27 ];
28 defaultText = lib.literalExpression ''
29 with pkgs; [ swaylock foot dmenu ];
30 '';
31 example = lib.literalExpression ''
32 with pkgs; [
33 termite rofi light
34 ]
35 '';
36 description = ''
37 Extra packages to be installed system wide. See
38 [Common X11 apps used on i3 with Wayland alternatives](https://github.com/swaywm/sway/wiki/i3-Migration-Guide#common-x11-apps-used-on-i3-with-wayland-alternatives)
39 for a list of useful software.
40 '';
41 };
42 };
43
44 config =
45 lib.mkIf cfg.enable (lib.mkMerge [
46 {
47 environment.systemPackages = lib.optional (cfg.package != null) cfg.package ++ cfg.extraPackages;
48
49 # To make a river session available if a display manager like SDDM is enabled:
50 services.displayManager.sessionPackages = lib.optionals (cfg.package != null) [ cfg.package ];
51
52 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1050913
53 xdg.portal.config.river.default = lib.mkDefault [ "wlr" "gtk" ];
54 }
55 (import ./wayland-session.nix { inherit lib pkgs; })
56 ]);
57
58 meta.maintainers = with lib.maintainers; [ GaetanLepage ];
59}