at master 2.9 kB view raw
1{ 2 config, 3 lib, 4 pkgs, 5 ... 6}: 7 8let 9 cfg = config.programs.river-classic; 10 11 wayland-lib = import ./lib.nix { inherit lib; }; 12in 13{ 14 options.programs.river-classic = { 15 enable = lib.mkEnableOption "river-classic, a dynamic tiling Wayland compositor"; 16 17 package = 18 lib.mkPackageOption pkgs "river-classic" { 19 nullable = true; 20 extraDescription = '' 21 If the package is not overridable with `xwaylandSupport`, then the module option 22 {option}`xwayland` will have no effect. 23 24 Set to `null` to not add any River package to your path. 25 This should be done if you want to use the Home Manager River module to install River. 26 ''; 27 } 28 // { 29 apply = 30 p: 31 if p == null then 32 null 33 else 34 wayland-lib.genFinalPackage p { 35 xwaylandSupport = cfg.xwayland.enable; 36 }; 37 }; 38 39 xwayland.enable = lib.mkEnableOption "XWayland" // { 40 default = true; 41 }; 42 43 extraPackages = lib.mkOption { 44 type = with lib.types; listOf package; 45 default = with pkgs; [ 46 swaylock 47 foot 48 dmenu 49 ]; 50 defaultText = lib.literalExpression '' 51 with pkgs; [ swaylock foot dmenu ]; 52 ''; 53 example = lib.literalExpression '' 54 with pkgs; [ termite rofi light ] 55 ''; 56 description = '' 57 Extra packages to be installed system wide. See 58 [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) 59 for a list of useful software. 60 ''; 61 }; 62 }; 63 64 imports = [ 65 (lib.mkRenamedOptionModule [ "programs" "river" "enable" ] [ "programs" "river-classic" "enable" ]) 66 (lib.mkRenamedOptionModule 67 [ "programs" "river" "package" ] 68 [ "programs" "river-classic" "package" ] 69 ) 70 (lib.mkRenamedOptionModule 71 [ "programs" "river" "xwayland" "enable" ] 72 [ "programs" "river-classic" "xwayland" "enable" ] 73 ) 74 (lib.mkRenamedOptionModule 75 [ "programs" "river" "extraPackages" ] 76 [ "programs" "river-classic" "extraPackages" ] 77 ) 78 ]; 79 80 config = lib.mkIf cfg.enable ( 81 lib.mkMerge [ 82 { 83 environment.systemPackages = lib.optional (cfg.package != null) cfg.package ++ cfg.extraPackages; 84 85 # To make a river session available if a display manager like SDDM is enabled: 86 services.displayManager.sessionPackages = lib.optional (cfg.package != null) cfg.package; 87 88 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1050913 89 xdg.portal.config.river.default = lib.mkDefault [ 90 "wlr" 91 "gtk" 92 ]; 93 } 94 95 (import ./wayland-session.nix { 96 inherit lib pkgs; 97 enableXWayland = cfg.xwayland.enable; 98 }) 99 ] 100 ); 101 102 meta.maintainers = with lib.maintainers; [ GaetanLepage ]; 103}