1{
2 config,
3 pkgs,
4 lib,
5 ...
6}:
7with lib; let
8 cfg = config.programs.river;
9in {
10 options.programs.river = {
11 enable = mkEnableOption (lib.mdDoc "river, a dynamic tiling Wayland compositor");
12
13 package = mkOption {
14 type = with types; nullOr package;
15 default = pkgs.river;
16 defaultText = literalExpression "pkgs.river";
17 description = lib.mdDoc ''
18 River package to use.
19 Set to `null` to not add any River package to your path.
20 This should be done if you want to use the Home Manager River module to install River.
21 '';
22 };
23
24 extraPackages = mkOption {
25 type = with types; listOf package;
26 default = with pkgs; [
27 swaylock
28 foot
29 dmenu
30 ];
31 defaultText = literalExpression ''
32 with pkgs; [ swaylock foot dmenu ];
33 '';
34 example = literalExpression ''
35 with pkgs; [
36 termite rofi light
37 ]
38 '';
39 description = lib.mdDoc ''
40 Extra packages to be installed system wide. See
41 [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)
42 for a list of useful software.
43 '';
44 };
45 };
46
47 config =
48 mkIf cfg.enable (mkMerge [
49 {
50 environment.systemPackages = optional (cfg.package != null) cfg.package ++ cfg.extraPackages;
51
52 # To make a river session available if a display manager like SDDM is enabled:
53 services.xserver.displayManager.sessionPackages = optionals (cfg.package != null) [ cfg.package ];
54 }
55 (import ./wayland-session.nix { inherit lib pkgs; })
56 ]);
57
58 meta.maintainers = with lib.maintainers; [ GaetanLepage ];
59}