diff options
author | Minijackson <minijackson@riseup.net> | 2021-04-18 16:58:23 +0200 |
---|---|---|
committer | Minijackson <minijackson@riseup.net> | 2021-04-18 16:58:23 +0200 |
commit | 8ffe5ce23fa1548304a3fa25f2bd0e89837f5a0b (patch) | |
tree | cd0de6a4642b76b42002dae5291c307d30727bc6 /usecases | |
parent | 46ac3d5464712d6b0e0bee4ac62543abcbf2db2c (diff) | |
download | nixos-config-reborn-8ffe5ce23fa1548304a3fa25f2bd0e89837f5a0b.tar.gz nixos-config-reborn-8ffe5ce23fa1548304a3fa25f2bd0e89837f5a0b.zip |
revamp with nix flakes + desktop config
Diffstat (limited to 'usecases')
-rw-r--r-- | usecases/common/backup-client.nix | 2 | ||||
-rw-r--r-- | usecases/desktop/default.nix | 11 | ||||
-rw-r--r-- | usecases/desktop/graphical.nix | 73 | ||||
-rw-r--r-- | usecases/desktop/graphical/alacritty.nix | 49 | ||||
-rw-r--r-- | usecases/desktop/graphical/mpv.nix | 16 | ||||
-rw-r--r-- | usecases/desktop/graphical/rofi.nix | 102 | ||||
-rw-r--r-- | usecases/desktop/graphical/sway.nix | 263 | ||||
-rw-r--r-- | usecases/desktop/graphical/waybar.nix | 288 | ||||
-rw-r--r-- | usecases/desktop/graphical/zathura.nix | 55 | ||||
-rw-r--r-- | usecases/desktop/pipewire.nix | 44 | ||||
-rw-r--r-- | usecases/server/default.nix | 8 | ||||
-rw-r--r-- | usecases/server/fail2ban.nix | 2 | ||||
-rw-r--r-- | usecases/server/monitoring-target.nix | 4 |
13 files changed, 914 insertions, 3 deletions
diff --git a/usecases/common/backup-client.nix b/usecases/common/backup-client.nix index 39e4ca1..a9acd7a 100644 --- a/usecases/common/backup-client.nix +++ b/usecases/common/backup-client.nix | |||
@@ -1,3 +1,5 @@ | |||
1 | inputs: | ||
2 | |||
1 | { config, lib, ... }: | 3 | { config, lib, ... }: |
2 | 4 | ||
3 | with lib; | 5 | with lib; |
diff --git a/usecases/desktop/default.nix b/usecases/desktop/default.nix new file mode 100644 index 0000000..8b6687a --- /dev/null +++ b/usecases/desktop/default.nix | |||
@@ -0,0 +1,11 @@ | |||
1 | # A reasonable set of defaults for desktop | ||
2 | |||
3 | inputs: | ||
4 | |||
5 | { ... }: | ||
6 | |||
7 | { | ||
8 | imports = [ | ||
9 | (import ./graphical.nix inputs) | ||
10 | ]; | ||
11 | } | ||
diff --git a/usecases/desktop/graphical.nix b/usecases/desktop/graphical.nix new file mode 100644 index 0000000..29b2db6 --- /dev/null +++ b/usecases/desktop/graphical.nix | |||
@@ -0,0 +1,73 @@ | |||
1 | inputs: | ||
2 | |||
3 | { pkgs, ... }: | ||
4 | |||
5 | { | ||
6 | imports = [ | ||
7 | (import ./pipewire.nix inputs) | ||
8 | |||
9 | (import ./graphical/alacritty.nix inputs) | ||
10 | (import ./graphical/mpv.nix inputs) | ||
11 | (import ./graphical/rofi.nix inputs) | ||
12 | (import ./graphical/sway.nix inputs) | ||
13 | (import ./graphical/waybar.nix inputs) | ||
14 | (import ./graphical/zathura.nix inputs) | ||
15 | ]; | ||
16 | |||
17 | fonts = { | ||
18 | enableDefaultFonts = true; | ||
19 | fonts = with pkgs; [ | ||
20 | fira | ||
21 | fira-mono | ||
22 | dejavu_fonts | ||
23 | freefont_ttf | ||
24 | liberation_ttf | ||
25 | noto-fonts-cjk | ||
26 | #fira-mono-italic | ||
27 | lmodern | ||
28 | # Symbols | ||
29 | unifont | ||
30 | siji | ||
31 | font-awesome_5 | ||
32 | #joypixels | ||
33 | # Collections | ||
34 | league-of-moveable-type | ||
35 | ]; | ||
36 | |||
37 | fontconfig = { | ||
38 | #ultimate.enable = true; | ||
39 | |||
40 | defaultFonts = { | ||
41 | serif = [ "DejaVu Serif" ]; | ||
42 | sansSerif = [ "DejaVu Sans" ]; | ||
43 | monospace = [ "Fira Mono" ]; | ||
44 | #emoji = [ "JoyPixels" ]; | ||
45 | }; | ||
46 | }; | ||
47 | }; | ||
48 | |||
49 | hardware.opengl.enable = true; | ||
50 | programs.dconf.enable = true; | ||
51 | |||
52 | xdg = { | ||
53 | sounds.enable = true; | ||
54 | portal = { | ||
55 | enable = true; | ||
56 | extraPortals = with pkgs; [ | ||
57 | xdg-desktop-portal-gtk | ||
58 | ]; | ||
59 | gtkUsePortal = true; | ||
60 | }; | ||
61 | }; | ||
62 | |||
63 | # For KDEConnect | ||
64 | networking.firewall.allowedTCPPortRanges = [{ from = 1714; to = 1764; }]; | ||
65 | networking.firewall.allowedUDPPortRanges = [{ from = 1714; to = 1764; }]; | ||
66 | |||
67 | home-manager.users.minijackson = { | ||
68 | services.kdeconnect = { | ||
69 | enable = true; | ||
70 | indicator = true; | ||
71 | }; | ||
72 | }; | ||
73 | } | ||
diff --git a/usecases/desktop/graphical/alacritty.nix b/usecases/desktop/graphical/alacritty.nix new file mode 100644 index 0000000..3e5795b --- /dev/null +++ b/usecases/desktop/graphical/alacritty.nix | |||
@@ -0,0 +1,49 @@ | |||
1 | inputs: | ||
2 | |||
3 | { config, ... }: | ||
4 | |||
5 | { | ||
6 | home-manager.users.minijackson.programs.alacritty = { | ||
7 | enable = true; | ||
8 | settings = { | ||
9 | window = { | ||
10 | padding.x = 2; | ||
11 | padding.y = 2; | ||
12 | }; | ||
13 | |||
14 | font = { | ||
15 | size = 8.0; | ||
16 | italic.style = "Regular Italic"; | ||
17 | }; | ||
18 | |||
19 | colors = with config.theme.colors; { | ||
20 | primary.background = softBackground; | ||
21 | primary.foreground = foreground; | ||
22 | |||
23 | normal = { | ||
24 | black = background; | ||
25 | # TODO: bright white is same | ||
26 | #white = "0xa89984"; | ||
27 | white = foreground; | ||
28 | red = neutralRed; | ||
29 | green = neutralGreen; | ||
30 | yellow = neutralYellow; | ||
31 | blue = neutralBlue; | ||
32 | magenta = neutralMagenta; | ||
33 | cyan = neutralCyan; | ||
34 | }; | ||
35 | |||
36 | bright = { | ||
37 | black = dimForeground; | ||
38 | white = foreground; | ||
39 | red = brightRed; | ||
40 | green = brightGreen; | ||
41 | yellow = brightYellow; | ||
42 | blue = brightBlue; | ||
43 | magenta = brightMagenta; | ||
44 | cyan = brightCyan; | ||
45 | }; | ||
46 | }; | ||
47 | }; | ||
48 | }; | ||
49 | } | ||
diff --git a/usecases/desktop/graphical/mpv.nix b/usecases/desktop/graphical/mpv.nix new file mode 100644 index 0000000..381b893 --- /dev/null +++ b/usecases/desktop/graphical/mpv.nix | |||
@@ -0,0 +1,16 @@ | |||
1 | inputs: | ||
2 | |||
3 | { pkgs, ... }: | ||
4 | |||
5 | { | ||
6 | home-manager.users.minijackson.programs.mpv = { | ||
7 | enable = true; | ||
8 | config = { | ||
9 | hwdec = "auto"; | ||
10 | profile = "gpu-hq"; | ||
11 | }; | ||
12 | # TODO: for 21.05 | ||
13 | #defaultProfiles = [ "gpu-hq" ]; | ||
14 | scripts = with pkgs.mpvScripts; [ mpris sponsorblock ]; | ||
15 | }; | ||
16 | } | ||
diff --git a/usecases/desktop/graphical/rofi.nix b/usecases/desktop/graphical/rofi.nix new file mode 100644 index 0000000..0013f5c --- /dev/null +++ b/usecases/desktop/graphical/rofi.nix | |||
@@ -0,0 +1,102 @@ | |||
1 | inputs: | ||
2 | |||
3 | { config, ... }: | ||
4 | |||
5 | { | ||
6 | home-manager.users.minijackson.programs.rofi = { | ||
7 | enable = true; | ||
8 | |||
9 | # TODO: there is a better way | ||
10 | theme = with config.theme.colors; builtins.toFile "theme.rasi" '' | ||
11 | * { | ||
12 | dominant: ${dominant}; | ||
13 | |||
14 | foreground: ${foreground}; | ||
15 | dim-foreground: ${dimForeground}; | ||
16 | |||
17 | text-color: @foreground; | ||
18 | border-color: @dim-foreground; | ||
19 | |||
20 | background-color: ${background}; | ||
21 | light-background: ${lightBackground}; | ||
22 | } | ||
23 | |||
24 | #window { | ||
25 | padding: 8px; | ||
26 | |||
27 | border: 1px solid; | ||
28 | background-color: @background; | ||
29 | } | ||
30 | |||
31 | #mainbox { | ||
32 | border: 0; | ||
33 | padding: 0; | ||
34 | } | ||
35 | |||
36 | #inputbar { | ||
37 | spacing: 0; | ||
38 | padding: 5px; | ||
39 | border: 0 0 1px 0; | ||
40 | margin: 0 0 8px 0; | ||
41 | children: [ prompt, textbox-prompt-sep, entry ]; | ||
42 | } | ||
43 | |||
44 | #prompt { | ||
45 | background-color: @background; | ||
46 | text-color: @dim-foreground; | ||
47 | } | ||
48 | |||
49 | textbox-prompt-sep { | ||
50 | expand: false; | ||
51 | str: ":"; | ||
52 | text-color: @dim-foreground; | ||
53 | margin: 0 8px 0 0; | ||
54 | } | ||
55 | |||
56 | #message { | ||
57 | spacing: 0; | ||
58 | padding: 5px; | ||
59 | border: 0 0 1px 0; | ||
60 | margin: 0 0 8px 0; | ||
61 | } | ||
62 | |||
63 | #listview { | ||
64 | spacing: 0; | ||
65 | } | ||
66 | |||
67 | #element { | ||
68 | border: 0; | ||
69 | padding: 5px; | ||
70 | |||
71 | background-color: @background; | ||
72 | } | ||
73 | |||
74 | #element.selected.normal { | ||
75 | background-color: @dominant; | ||
76 | } | ||
77 | |||
78 | #element.urgent { | ||
79 | background-color: ${fadedRed}; | ||
80 | } | ||
81 | |||
82 | #element.selected.urgent { | ||
83 | background-color: ${neutralRed}; | ||
84 | } | ||
85 | |||
86 | #element.active { | ||
87 | background-color: ${dimForeground}; | ||
88 | text-color: ${background}; | ||
89 | } | ||
90 | |||
91 | #element.selected.active { | ||
92 | background-color: ${foreground}; | ||
93 | text-color: ${background}; | ||
94 | } | ||
95 | |||
96 | #scrollbar { | ||
97 | width: 4px; | ||
98 | handle-width: 8px; | ||
99 | } | ||
100 | ''; | ||
101 | }; | ||
102 | } | ||
diff --git a/usecases/desktop/graphical/sway.nix b/usecases/desktop/graphical/sway.nix new file mode 100644 index 0000000..6c5b2ed --- /dev/null +++ b/usecases/desktop/graphical/sway.nix | |||
@@ -0,0 +1,263 @@ | |||
1 | inputs: | ||
2 | |||
3 | { config, lib, pkgs, system, ... }: | ||
4 | let | ||
5 | globalConfig = config; | ||
6 | in | ||
7 | { | ||
8 | home-manager.users.minijackson = { config, ... }: { | ||
9 | wayland.windowManager.sway = { | ||
10 | enable = true; | ||
11 | |||
12 | extraSessionCommands = '' | ||
13 | # https://github.com/emersion/xdg-desktop-portal-wlr/issues/20 | ||
14 | export XDG_CURRENT_DESKTOP=sway | ||
15 | # https://github.com/emersion/xdg-desktop-portal-wlr/pull/11 | ||
16 | export XDG_SESSION_TYPE=wayland | ||
17 | |||
18 | export SDL_VIDEODRIVER=wayland | ||
19 | |||
20 | export QT_QPA_PLATFORM=wayland | ||
21 | export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 | ||
22 | ''; | ||
23 | |||
24 | # Implemented below in startup, due to global import-environment failing | ||
25 | # when not specifying variables. | ||
26 | # | ||
27 | # TODO: make PR | ||
28 | #systemdIntegration = true; | ||
29 | wrapperFeatures.gtk = true; | ||
30 | |||
31 | config = { | ||
32 | # Using waybar | ||
33 | bars = [ ]; | ||
34 | |||
35 | bindkeysToCode = true; | ||
36 | |||
37 | colors = with globalConfig.theme.colors; { | ||
38 | focused = { | ||
39 | border = lightBackground; | ||
40 | background = lightBackground; | ||
41 | text = foreground; | ||
42 | indicator = dominant; | ||
43 | childBorder = dominant; | ||
44 | }; | ||
45 | |||
46 | focusedInactive = { | ||
47 | border = background; | ||
48 | background = background; | ||
49 | text = dimForeground; | ||
50 | indicator = dominant; | ||
51 | childBorder = background; | ||
52 | }; | ||
53 | |||
54 | unfocused = { | ||
55 | border = background; | ||
56 | background = background; | ||
57 | text = dimForeground; | ||
58 | indicator = dominant; | ||
59 | childBorder = background; | ||
60 | }; | ||
61 | |||
62 | urgent = { | ||
63 | border = brightRed; | ||
64 | background = brightRed; | ||
65 | text = foreground; | ||
66 | indicator = brightRed; | ||
67 | childBorder = brightRed; | ||
68 | }; | ||
69 | |||
70 | placeholder = { | ||
71 | border = background0; | ||
72 | background = background0; | ||
73 | text = foreground; | ||
74 | indicator = background0; | ||
75 | childBorder = background0; | ||
76 | }; | ||
77 | }; | ||
78 | |||
79 | floating.criteria = [ | ||
80 | { title = "Steam - News"; } | ||
81 | ]; | ||
82 | |||
83 | input = { | ||
84 | "1:1:AT_Translated_Set_2_keyboard" = { | ||
85 | xkb_layout = "fr"; | ||
86 | xkb_variant = "oss"; | ||
87 | xkb_options = "compose:caps"; | ||
88 | xkb_numlock = "enabled"; | ||
89 | }; | ||
90 | |||
91 | "1452:514:Alps_Electric_M2452" = { | ||
92 | xkb_layout = "fr"; | ||
93 | xkb_variant = "oss"; | ||
94 | xkb_options = "compose:caps,lv3:rwin_switch"; | ||
95 | xkb_numlock = "enabled"; | ||
96 | }; | ||
97 | |||
98 | "7764:8240:TypeMatrix.com_USB_Keyboard" = { | ||
99 | xkb_layout = "dvorak"; | ||
100 | xkb_options = "eurosign:e,compose:caps"; | ||
101 | }; | ||
102 | |||
103 | |||
104 | "1133:49948:Logitech_USB_Keyboard" = { | ||
105 | xkb_layout = "fr"; | ||
106 | xkb_variant = "oss"; | ||
107 | xkb_options = "eurosign:e,compose:caps"; | ||
108 | xkb_numlock = "enabled"; | ||
109 | }; | ||
110 | |||
111 | "1102:4639:DELL0817:00_044E:121F_Mouse" = { | ||
112 | scroll_method = "on_button_down"; | ||
113 | scroll_button = "button2"; | ||
114 | }; | ||
115 | }; | ||
116 | |||
117 | keybindings = | ||
118 | let | ||
119 | modifier = config.wayland.windowManager.sway.config.modifier; | ||
120 | in | ||
121 | lib.mkOptionDefault { | ||
122 | "${modifier}+ampersand" = "workspace 1"; | ||
123 | "${modifier}+eacute" = "workspace 2"; | ||
124 | "${modifier}+quotedbl" = "workspace 3"; | ||
125 | "${modifier}+apostrophe" = "workspace 4"; | ||
126 | "${modifier}+parenleft" = "workspace 5"; | ||
127 | "${modifier}+minus" = "workspace 6"; | ||
128 | "${modifier}+egrave" = "workspace 7"; | ||
129 | "${modifier}+underscore" = "workspace 8"; | ||
130 | "${modifier}+ccedilla" = "workspace 9"; | ||
131 | "${modifier}+agrave" = "workspace 10"; | ||
132 | |||
133 | "${modifier}+Shift+ampersand" = "move container to workspace 1"; | ||
134 | "${modifier}+Shift+eacute" = "move container to workspace 2"; | ||
135 | "${modifier}+Shift+quotedbl" = "move container to workspace 3"; | ||
136 | "${modifier}+Shift+apostrophe" = "move container to workspace 4"; | ||
137 | "${modifier}+Shift+parenleft" = "move container to workspace 5"; | ||
138 | "${modifier}+Shift+minus" = "move container to workspace 6"; | ||
139 | "${modifier}+Shift+egrave" = "move container to workspace 7"; | ||
140 | "${modifier}+Shift+underscore" = "move container to workspace 8"; | ||
141 | "${modifier}+Shift+ccedilla" = "move container to workspace 9"; | ||
142 | "${modifier}+Shift+agrave" = "move container to workspace 10"; | ||
143 | |||
144 | "${modifier}+m" = "exec ${pkgs.swaylock}/bin/swaylock"; | ||
145 | }; | ||
146 | |||
147 | menu = '' | ||
148 | ${pkgs.rofi}/bin/rofi -show drun -terminal ${pkgs.alacritty}/bin/alacritty | ||
149 | ''; | ||
150 | |||
151 | modifier = "Mod4"; | ||
152 | |||
153 | output."*".bg = | ||
154 | "${../../../res/wallpapers/wallpaper-1920x1080-kernel-card-black.png} fill"; | ||
155 | |||
156 | startup = [ | ||
157 | { command = "${pkgs.mako}/bin/mako"; always = true; } | ||
158 | { | ||
159 | command = "systemctl --user import-environment ${ | ||
160 | builtins.toString (lib.unique config.xsession.importedVariables) | ||
161 | }; systemctl --user start sway-session.target"; | ||
162 | } | ||
163 | ]; | ||
164 | |||
165 | terminal = "${pkgs.alacritty}/bin/alacritty"; | ||
166 | |||
167 | window = { | ||
168 | border = 2; | ||
169 | hideEdgeBorders = "smart"; | ||
170 | titlebar = true; | ||
171 | }; | ||
172 | }; | ||
173 | }; | ||
174 | |||
175 | # TODO: 21.05 | ||
176 | /* | ||
177 | services.wlsunset = { | ||
178 | enable = true; | ||
179 | latitude = "48.864716"; | ||
180 | longitude = "2.349014"; | ||
181 | # Reduce blue light anyways | ||
182 | temperature = { | ||
183 | day = 4000; | ||
184 | night = 2500; | ||
185 | }; | ||
186 | systemdTarget = "sway-session.target"; | ||
187 | }; | ||
188 | */ | ||
189 | |||
190 | # TODO: upstream a PR to beautify this | ||
191 | xdg.configFile."swaylock/config".text = with globalConfig.theme.colors; '' | ||
192 | ignore-empty-password | ||
193 | image=${../../../res/wallpapers/wallpaper-1920x1080-install-gentoo.png} | ||
194 | |||
195 | font=monospace | ||
196 | |||
197 | inside-color=${lib.removePrefix "#" dominant}dd | ||
198 | inside-clear-color=${lib.removePrefix "#" neutralOrange}dd | ||
199 | inside-ver-color=${lib.removePrefix "#" neutralOrange}dd | ||
200 | inside-wrong-color=${lib.removePrefix "#" neutralRed}dd | ||
201 | |||
202 | key-hl-color=${lib.removePrefix "#" brightGreen}ee | ||
203 | bs-hl-color=${lib.removePrefix "#" neutralRed}ee | ||
204 | |||
205 | line-color=${lib.removePrefix "#" background}ee | ||
206 | line-clear-color=${lib.removePrefix "#" background}ee | ||
207 | line-ver-color=${lib.removePrefix "#" background}ee | ||
208 | line-wrong-color=${lib.removePrefix "#" background}ee | ||
209 | |||
210 | ring-color=${lib.removePrefix "#" dominant}ee | ||
211 | ring-clear-color=${lib.removePrefix "#" brightOrange}ee | ||
212 | ring-ver-color=${lib.removePrefix "#" brightOrange}ee | ||
213 | ring-wrong-color=${lib.removePrefix "#" brightRed}ee | ||
214 | |||
215 | separator-color=${lib.removePrefix "#" background}ee | ||
216 | |||
217 | text-color=${lib.removePrefix "#" background}ff | ||
218 | text-clear-color=${lib.removePrefix "#" background}ff | ||
219 | text-ver-color=${lib.removePrefix "#" background}ff | ||
220 | text-wrong-color=${lib.removePrefix "#" background}ff | ||
221 | |||
222 | indicator-radius=75 | ||
223 | indicator-thickness=10 | ||
224 | ''; | ||
225 | |||
226 | xsession.importedVariables = [ | ||
227 | "DBUS_SESSION_BUS_ADDRESS" | ||
228 | "DISPLAY" | ||
229 | "SSH_AUTH_SOCK" | ||
230 | "XAUTHORITY" | ||
231 | "XDG_DATA_DIRS" | ||
232 | "XDG_RUNTIME_DIR" | ||
233 | "XDG_SESSION_ID" | ||
234 | |||
235 | "WAYLAND_DISPLAY" | ||
236 | "SWAYSOCK" | ||
237 | "I3SOCK" | ||
238 | |||
239 | "XDG_CURRENT_DESKTOP" | ||
240 | "XDG_SESSION_TYPE" | ||
241 | ]; | ||
242 | |||
243 | systemd.user.targets.sway-session = { | ||
244 | Unit = { | ||
245 | Description = "sway compositor session"; | ||
246 | Documentation = [ "man:systemd.special(7)" ]; | ||
247 | BindsTo = [ "graphical-session.target" ]; | ||
248 | Wants = [ "graphical-session-pre.target" ]; | ||
249 | After = [ "graphical-session-pre.target" ]; | ||
250 | }; | ||
251 | }; | ||
252 | }; | ||
253 | |||
254 | environment.systemPackages = with pkgs; [ qt5.qtwayland ]; | ||
255 | |||
256 | # TODO: in 21.05 | ||
257 | #programs.xwayland.enable = true; | ||
258 | security.pam.services.swaylock = { }; | ||
259 | |||
260 | xdg.portal.extraPortals = with pkgs; [ | ||
261 | unstable.xdg-desktop-portal-wlr | ||
262 | ]; | ||
263 | } | ||
diff --git a/usecases/desktop/graphical/waybar.nix b/usecases/desktop/graphical/waybar.nix new file mode 100644 index 0000000..dca43a2 --- /dev/null +++ b/usecases/desktop/graphical/waybar.nix | |||
@@ -0,0 +1,288 @@ | |||
1 | inputs: | ||
2 | |||
3 | { config, lib, pkgs, ... }: | ||
4 | |||
5 | { | ||
6 | home-manager.users.minijackson = { | ||
7 | programs.waybar = { | ||
8 | enable = true; | ||
9 | |||
10 | settings = [{ | ||
11 | layer = "top"; | ||
12 | position = "bottom"; | ||
13 | height = 25; | ||
14 | |||
15 | modules-left = [ "sway/workspaces" "sway/mode" ]; | ||
16 | modules-center = [ "mpd" ]; | ||
17 | modules-right = [ | ||
18 | "idle_inhibitor" | ||
19 | "pulseaudio" | ||
20 | "network#eth" | ||
21 | "network#wlan" | ||
22 | "cpu" | ||
23 | "memory" | ||
24 | "temperature" | ||
25 | "backlight" | ||
26 | "battery" | ||
27 | "clock" | ||
28 | "tray" | ||
29 | ]; | ||
30 | |||
31 | modules = { | ||
32 | mpd = { | ||
33 | format = "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) <span font_desc='Font Awesome 5 Free'></span>"; | ||
34 | format-stopped = "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped <span font_desc='Font Awesome 5 Free'></span>"; | ||
35 | format-disconnected = "Disconnected <span font_desc='Font Awesome 5 Free'></span>"; | ||
36 | |||
37 | on-click-middle = "${pkgs.alacritty}/bin/alacritty --command ncmpcpp"; | ||
38 | |||
39 | consume-icons = { | ||
40 | on = " "; | ||
41 | }; | ||
42 | |||
43 | random-icons = { | ||
44 | on = " "; | ||
45 | }; | ||
46 | |||
47 | repeat-icons = { | ||
48 | on = " "; | ||
49 | }; | ||
50 | |||
51 | single-icons = { | ||
52 | on = "1 "; | ||
53 | }; | ||
54 | |||
55 | state-icons = { | ||
56 | playing = ""; | ||
57 | paused = ""; | ||
58 | }; | ||
59 | }; | ||
60 | |||
61 | idle_inhibitor = { | ||
62 | format = "{icon}"; | ||
63 | format-icons = { | ||
64 | activated = ""; | ||
65 | deactivated = ""; | ||
66 | }; | ||
67 | }; | ||
68 | |||
69 | clock = { | ||
70 | tooltip-format = "{:%Y-%m-%d | %H:%M}"; | ||
71 | format-alt = "{:%Y-%m-%d}"; | ||
72 | }; | ||
73 | |||
74 | cpu = { format = "{usage}% "; }; | ||
75 | |||
76 | memory = { format = "{}% "; }; | ||
77 | |||
78 | battery = { | ||
79 | states = { good = 90; }; | ||
80 | format = "{capacity}% {icon}"; | ||
81 | format-icons = [ | ||
82 | "<span font_desc='Font Awesome 5 Free'></span>" | ||
83 | "<span font_desc='Font Awesome 5 Free'></span>" | ||
84 | "<span font_desc='Font Awesome 5 Free'></span>" | ||
85 | "<span font_desc='Font Awesome 5 Free'></span>" | ||
86 | "<span font_desc='Font Awesome 5 Free'></span>" | ||
87 | ]; | ||
88 | }; | ||
89 | |||
90 | "network#eth" = { | ||
91 | interface = "enp*"; | ||
92 | format-ethernet = "{ipaddr}/{cidr} "; | ||
93 | format-disconnected = "Disconnected "; | ||
94 | }; | ||
95 | |||
96 | "network#wlan" = { | ||
97 | interface = "wlp*"; | ||
98 | format-wifi = "{essid} ({signalStrength}%) <span font_desc='Font Awesome 5 Free'></span>"; | ||
99 | format-disconnected = "Disconnected <span font_desc='Font Awesome 5 Free'></span>"; | ||
100 | tooltip = true; | ||
101 | tooltip-format-wifi = "{ipaddr}/{cidr}"; | ||
102 | }; | ||
103 | |||
104 | temperature = { | ||
105 | hwmon-path = "/sys/class/hwmon/hwmon0/temp1_input"; | ||
106 | format = "{temperatureC} °C "; | ||
107 | }; | ||
108 | |||
109 | backlight = { | ||
110 | format = "{percent}% <span font_desc='Font Awesome 5 Free'>{icon}</span>"; | ||
111 | format-icons = [ "" "" ]; | ||
112 | }; | ||
113 | |||
114 | pulseaudio = { | ||
115 | format = "{volume}% {icon}"; | ||
116 | format-bluetooth = "{volume}% {icon}"; | ||
117 | format-muted = ""; | ||
118 | format-icons = { | ||
119 | headphones = ""; | ||
120 | handsfree = ""; | ||
121 | headset = ""; | ||
122 | phone = ""; | ||
123 | portable = ""; | ||
124 | car = ""; | ||
125 | default = [ "" "" ]; | ||
126 | }; | ||
127 | on-click = "pavucontrol"; | ||
128 | }; | ||
129 | }; | ||
130 | }]; | ||
131 | |||
132 | style = with config.theme.colors; '' | ||
133 | * { | ||
134 | border: none; | ||
135 | border-radius: 0; | ||
136 | font-family: mono; | ||
137 | font-size: 11px; | ||
138 | min-height: 0; | ||
139 | } | ||
140 | |||
141 | window#waybar { | ||
142 | background: ${background}; | ||
143 | border-bottom: 3px solid ${lightBackground}; | ||
144 | color: ${foreground}; | ||
145 | } | ||
146 | |||
147 | /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ | ||
148 | #workspaces button { | ||
149 | padding: 0 5px; | ||
150 | background: transparent; | ||
151 | color: ${foreground}; | ||
152 | border-bottom: 3px solid transparent; | ||
153 | } | ||
154 | |||
155 | #workspaces button.focused { | ||
156 | background: ${dominant}; | ||
157 | border-bottom: 3px solid ${foreground}; | ||
158 | } | ||
159 | |||
160 | #mode { | ||
161 | background: ${lightBackground}; | ||
162 | border-bottom: 3px solid ${foreground}; | ||
163 | } | ||
164 | |||
165 | #clock, #battery, #cpu, #memory, #temperature, #backlight, #network, #pulseaudio, #custom-mpd, #mpd, #tray, #mode, #idle_inhibitor { | ||
166 | padding: 0 10px; | ||
167 | margin: 0 5px; | ||
168 | } | ||
169 | |||
170 | #clock { | ||
171 | background-color: ${neutralMagenta}; | ||
172 | color: ${background}; | ||
173 | } | ||
174 | |||
175 | #battery { | ||
176 | background-color: ${neutralYellow}; | ||
177 | color: ${background}; | ||
178 | } | ||
179 | |||
180 | /* | ||
181 | #battery.charging { | ||
182 | color: ${foreground}; | ||
183 | background-color: #26A65B; | ||
184 | } | ||
185 | */ | ||
186 | |||
187 | @keyframes blink { | ||
188 | to { | ||
189 | background-color: ${foreground}; | ||
190 | color: ${background}; | ||
191 | } | ||
192 | } | ||
193 | |||
194 | #battery.critical:not(.charging) { | ||
195 | background: ${fadedRed}; | ||
196 | color: ${foreground}; | ||
197 | animation-name: blink; | ||
198 | animation-duration: 0.5s; | ||
199 | animation-timing-function: linear; | ||
200 | animation-iteration-count: infinite; | ||
201 | animation-direction: alternate; | ||
202 | } | ||
203 | |||
204 | #cpu { | ||
205 | background: ${neutralOrange}; | ||
206 | color: ${background}; | ||
207 | } | ||
208 | |||
209 | #memory { | ||
210 | background: ${brightBlue}; | ||
211 | color: ${background}; | ||
212 | } | ||
213 | |||
214 | #backlight { | ||
215 | background: ${background6}; | ||
216 | color: ${background}; | ||
217 | } | ||
218 | |||
219 | #network { | ||
220 | background: ${neutralGreen}; | ||
221 | color: ${background}; | ||
222 | } | ||
223 | |||
224 | #network.disconnected { | ||
225 | background: ${lightBackground}; | ||
226 | color: ${foreground}; | ||
227 | } | ||
228 | |||
229 | #pulseaudio { | ||
230 | background: ${neutralCyan}; | ||
231 | color: ${background}; | ||
232 | } | ||
233 | |||
234 | #pulseaudio.muted { | ||
235 | background: ${foreground}; | ||
236 | } | ||
237 | |||
238 | #temperature { | ||
239 | background: ${brightCyan}; | ||
240 | color: ${background}; | ||
241 | } | ||
242 | |||
243 | #temperature.critical { | ||
244 | background: ${fadedRed}; | ||
245 | color: ${foreground}; | ||
246 | } | ||
247 | |||
248 | #tray { | ||
249 | background-color: #2980b9; | ||
250 | } | ||
251 | |||
252 | #idle_inhibitor { | ||
253 | background-color: ${lightBackground}; | ||
254 | } | ||
255 | |||
256 | #custom-mpd { | ||
257 | background-color: ${dominant}; | ||
258 | } | ||
259 | |||
260 | #mpd { | ||
261 | background: ${dominant}; | ||
262 | } | ||
263 | |||
264 | #mpd.disconnected { | ||
265 | background: ${lightBackground}; | ||
266 | color: ${foreground}; | ||
267 | } | ||
268 | |||
269 | #mpd.stopped { | ||
270 | background: ${foreground}; | ||
271 | color: ${background}; | ||
272 | } | ||
273 | |||
274 | #mpd.paused { | ||
275 | background: ${dimDominant}; | ||
276 | } | ||
277 | ''; | ||
278 | |||
279 | systemd.enable = true; | ||
280 | }; | ||
281 | |||
282 | # Fix https://github.com/nix-community/home-manager/pull/1628 | ||
283 | systemd.user.services.waybar.Unit = { | ||
284 | Requisite = lib.mkForce []; | ||
285 | After = lib.mkForce []; | ||
286 | }; | ||
287 | }; | ||
288 | } | ||
diff --git a/usecases/desktop/graphical/zathura.nix b/usecases/desktop/graphical/zathura.nix new file mode 100644 index 0000000..d1832d8 --- /dev/null +++ b/usecases/desktop/graphical/zathura.nix | |||
@@ -0,0 +1,55 @@ | |||
1 | inputs: | ||
2 | |||
3 | { config, ... }: | ||
4 | |||
5 | { | ||
6 | home-manager.users.minijackson.programs.zathura = { | ||
7 | enable = true; | ||
8 | |||
9 | options = with config.theme.colors; { | ||
10 | guioptions = ""; | ||
11 | adjust-open = "width"; | ||
12 | |||
13 | smooth-scroll = true; | ||
14 | scroll-step = 100; | ||
15 | #scroll-full-overlap = 0.05; | ||
16 | |||
17 | selection-clipboard = "clipboard"; | ||
18 | |||
19 | default-bg = softBackground; | ||
20 | default-fg = foreground; | ||
21 | |||
22 | notification-error-bg = neutralRed; | ||
23 | notification-error-fg = foreground; | ||
24 | |||
25 | notification-warning-bg = background; | ||
26 | notification-warning-fg = brightRed; | ||
27 | |||
28 | highlight-color = fadedYellow; | ||
29 | highlight-active-color = brightYellow; | ||
30 | |||
31 | inputbar-bg = background; | ||
32 | inputbar-fg = dominant; | ||
33 | |||
34 | completion-bg = background; | ||
35 | completion-fg = neutralBlue; | ||
36 | |||
37 | completion-highlight-bg = dominant; | ||
38 | completion-highlight-fg = background; | ||
39 | |||
40 | notification-bg = dominant; | ||
41 | notification-fg = background; | ||
42 | |||
43 | index-bg = background; | ||
44 | index-fg = foreground; | ||
45 | |||
46 | index-active-bg = dominant; | ||
47 | index-active-fg = background; | ||
48 | |||
49 | recolor-lightcolor = background; | ||
50 | recolor-darkcolor = foreground; | ||
51 | recolor-keephue = true; | ||
52 | recolor = true; | ||
53 | }; | ||
54 | }; | ||
55 | } | ||
diff --git a/usecases/desktop/pipewire.nix b/usecases/desktop/pipewire.nix new file mode 100644 index 0000000..e742ba9 --- /dev/null +++ b/usecases/desktop/pipewire.nix | |||
@@ -0,0 +1,44 @@ | |||
1 | inputs: | ||
2 | |||
3 | { pkgs, ... }: | ||
4 | |||
5 | { | ||
6 | imports = [ | ||
7 | (inputs.nixpkgs-unstable.outPath + "/nixos/modules/services/desktops/pipewire/pipewire.nix") | ||
8 | (inputs.nixpkgs-unstable.outPath + "/nixos/modules/services/desktops/pipewire/pipewire-media-session.nix") | ||
9 | ]; | ||
10 | |||
11 | disabledModules = [ "services/desktops/pipewire.nix" ]; | ||
12 | |||
13 | services.pipewire = { | ||
14 | enable = true; | ||
15 | package = pkgs.unstable.pipewire; | ||
16 | |||
17 | alsa.enable = true; | ||
18 | jack.enable = true; | ||
19 | pulse.enable = true; | ||
20 | |||
21 | config = { | ||
22 | pipewire-pulse = { | ||
23 | "context.modules" = [ | ||
24 | { name = "libpipewire-module-rtkit"; flags = [ "ifexists" "nofail" ]; } | ||
25 | { name = "libpipewire-module-protocol-native"; } | ||
26 | { name = "libpipewire-module-client-node"; } | ||
27 | { name = "libpipewire-module-adapter"; } | ||
28 | { name = "libpipewire-module-metadata"; } | ||
29 | { | ||
30 | name = "libpipewire-module-protocol-pulse"; | ||
31 | args = { | ||
32 | # TODO: set it in MPD? | ||
33 | "server.address" = [ "unix:native" "tcp:127.0.0.1:4713" ]; | ||
34 | }; | ||
35 | } | ||
36 | ]; | ||
37 | }; | ||
38 | }; | ||
39 | |||
40 | media-session.package = pkgs.unstable.pipewire.mediaSession; | ||
41 | }; | ||
42 | |||
43 | security.rtkit.enable = true; | ||
44 | } | ||
diff --git a/usecases/server/default.nix b/usecases/server/default.nix index 1b47ee4..f32728a 100644 --- a/usecases/server/default.nix +++ b/usecases/server/default.nix | |||
@@ -1,8 +1,12 @@ | |||
1 | # A reasonable set of defaults for a server | ||
2 | |||
3 | inputs: | ||
4 | |||
1 | { ... }: | 5 | { ... }: |
2 | 6 | ||
3 | { | 7 | { |
4 | imports = [ | 8 | imports = [ |
5 | ./fail2ban.nix | 9 | (import ./fail2ban.nix inputs) |
6 | ./monitoring-target.nix | 10 | (import ./monitoring-target.nix inputs) |
7 | ]; | 11 | ]; |
8 | } | 12 | } |
diff --git a/usecases/server/fail2ban.nix b/usecases/server/fail2ban.nix index 1c2912c..3870a32 100644 --- a/usecases/server/fail2ban.nix +++ b/usecases/server/fail2ban.nix | |||
@@ -1,3 +1,5 @@ | |||
1 | inputs: | ||
2 | |||
1 | { config, ... }: | 3 | { config, ... }: |
2 | 4 | ||
3 | { | 5 | { |
diff --git a/usecases/server/monitoring-target.nix b/usecases/server/monitoring-target.nix index 1ddeb25..2ccd160 100644 --- a/usecases/server/monitoring-target.nix +++ b/usecases/server/monitoring-target.nix | |||
@@ -1,3 +1,5 @@ | |||
1 | inputs: | ||
2 | |||
1 | { config, ... }: | 3 | { config, ... }: |
2 | 4 | ||
3 | { | 5 | { |
@@ -6,7 +8,7 @@ | |||
6 | enable = true; | 8 | enable = true; |
7 | enabledCollectors = [ "logind" "systemd" ]; | 9 | enabledCollectors = [ "logind" "systemd" ]; |
8 | disabledCollectors = [ "textfile" ]; | 10 | disabledCollectors = [ "textfile" ]; |
9 | listenAddress = config.topology.mainVpn.currentNodeIP; | 11 | listenAddress = "[${config.topology.mainVpn.currentNodeIP}]"; |
10 | }; | 12 | }; |
11 | }; | 13 | }; |
12 | 14 | ||