-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrootston.nix
118 lines (106 loc) · 3.33 KB
/
rootston.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.programs.rootston;
rootstonWrapped = pkgs.writeScriptBin "rootston" ''
#! ${pkgs.runtimeShell}
if [[ "$#" -ge 1 ]]; then
exec ${pkgs.wlroots.bin}/bin/rootston "$@"
else
${cfg.extraSessionCommands}
exec ${pkgs.wlroots.bin}/bin/rootston -C ${cfg.configFile}
fi
'';
in {
options.programs.rootston = {
enable = mkEnableOption ''
rootston, the reference compositor for wlroots. The purpose of rootston
is to test and demonstrate the features of wlroots (if you want a real
Wayland compositor you should e.g. use Sway instead). You can manually
start the compositor by running "rootston" from a terminal'';
extraSessionCommands = mkOption {
type = types.lines;
default = "";
example = ''
'';
description = ''
Shell commands executed just before rootston is started.
'';
};
extraPackages = mkOption {
type = with types; listOf package;
default = with pkgs; [
westonLite xwayland rofi
];
defaultText = literalExample ''
with pkgs; [
westonLite xwayland rofi
]
'';
example = literalExample "[ ]";
description = ''
Extra packages to be installed system wide.
'';
};
config = mkOption {
type = types.attrs;
default = {
keyboard = {
meta-key = "Logo";
};
bindings = {
# Sway/i3 like Keybindings
# Maps key combinations with commands to execute
# Commands include:
# - "exit" to stop the compositor
# - "exec" to execute a shell command
# - "close" to close the current view
# - "next_window" to cycle through windows
"Logo+Shift+e" = "exit";
"Logo+q" = "close";
"Logo+m" = "maximize";
"Alt+Tab" = "next_window";
"Logo+Return" = "exec weston-terminal";
"Logo+d" = "exec rofi -show run";
};
};
description = ''
Default configuration for rootston (used when called without any
parameters).
'';
};
extraConfig = mkOption {
type = types.attrs;
default = { };
example = {
keyboard = {
layout = "de,us";
variant = "nodeadkeys";
options = "grp:alt_shift_toggle,caps:escape";
};
};
description = ''
Extra configuration options for rootston. These options will be merged
with the base configuration from config (overriding existing options).
'';
};
configFile = mkOption {
type = types.path;
default = "/etc/rootston.ini";
example = literalExample "${pkgs.wlroots.bin}/etc/rootston.ini";
description = ''
Path to the default rootston configuration file (the "config" option
will have no effect if you change the path).
'';
};
};
config = mkIf cfg.enable {
environment.etc."rootston.ini".text = lib.generators.toINI {}
(lib.recursiveUpdate cfg.config cfg.extraConfig);
environment.systemPackages = [ rootstonWrapped ] ++ cfg.extraPackages;
hardware.opengl.enable = mkDefault true;
fonts.enableDefaultFonts = mkDefault true;
programs.dconf.enable = mkDefault true;
};
meta.maintainers = with lib.maintainers; [ primeos ];
}