alpha
Login
or
Join now
hermes.pds.lassul.us
/
superconfig
forked from
lass.pds.lassul.us/superconfig
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
configs: remove dead modules
author
lassulus
date
2 weeks ago
(Oct 4, 2026, 1:11 AM CEST)
commit
0d720f92
0d720f92322030a52330fde16f06e8a8e55241b3
parent
46432575
464325754eb0a35b6ddbcd7068e9b44002ab1d3d
-1586
10 changed files
Expand all
Collapse all
Unified
Split
configs
desktops
lib
gamescope_libinput.patch
wayland.nix
sway
eww.nix
git.nix
services
coms
default.nix
murmur.nix
git
default.nix
proxy.nix
nixcache
default.nix
site
default.nix
-238
configs/git.nix
Reviewed
···
1
1
-
{
2
2
-
self,
3
3
-
config,
4
4
-
lib,
5
5
-
pkgs,
6
6
-
...
7
7
-
}:
8
8
-
9
9
-
let
10
10
-
git = self.inputs.stockholm.lib.git;
11
11
-
out = {
12
12
-
imports = [
13
13
-
self.inputs.stockholm.nixosModules.git
14
14
-
];
15
15
-
services.nginx.enable = true;
16
16
-
krebs.git = {
17
17
-
enable = true;
18
18
-
cgit = {
19
19
-
settings = {
20
20
-
root-title = "public repositories at ${config.krebs.build.host.name}";
21
21
-
root-desc = "keep calm and engage";
22
22
-
};
23
23
-
};
24
24
-
repos = repos;
25
25
-
rules = rules;
26
26
-
};
27
27
-
28
28
-
krebs.iptables.tables.filter.INPUT.rules = [
29
29
-
{
30
30
-
predicate = "-i retiolum -p tcp --dport 80";
31
31
-
target = "ACCEPT";
32
32
-
}
33
33
-
];
34
34
-
35
35
-
system.activationScripts.spool-chmod = ''
36
36
-
${pkgs.coreutils}/bin/chmod +x /var/spool
37
37
-
'';
38
38
-
};
39
39
-
40
40
-
cgit-clear-cache = pkgs.cgit-clear-cache.override {
41
41
-
inherit (config.krebs.git.cgit.settings) cache-root;
42
42
-
};
43
43
-
44
44
-
repos = public-repos // lib.optionalAttrs config.krebs.build.host.secure restricted-repos;
45
45
-
46
46
-
rules = lib.concatMap make-rules (lib.attrValues repos);
47
47
-
48
48
-
public-repos = lib.mapAttrs make-public-repo {
49
49
-
Reaktor = {
50
50
-
cgit.desc = "Reaktor IRC bot";
51
51
-
cgit.section = "software";
52
52
-
};
53
53
-
buildbot-classic = {
54
54
-
cgit.desc = "fork of buildbot";
55
55
-
cgit.section = "software";
56
56
-
};
57
57
-
cholerab = {
58
58
-
cgit.desc = "krebs thesauron & enterprise-patterns";
59
59
-
cgit.section = "documentation";
60
60
-
};
61
61
-
disko = {
62
62
-
cgit.desc = "take a description of your disk layout and produce a format script";
63
63
-
cgit.section = "software";
64
64
-
};
65
65
-
go = {
66
66
-
cgit.desc = "url shortener";
67
67
-
cgit.section = "software";
68
68
-
};
69
69
-
grib2json-bin = {
70
70
-
cgit.desc = "build jar of grib2json";
71
71
-
cgit.section = "deployment";
72
72
-
};
73
73
-
krebspage = {
74
74
-
cgit.desc = "homepage of krebs";
75
75
-
cgit.section = "configuration";
76
76
-
};
77
77
-
krops = {
78
78
-
cgit.desc = "krebs deployment";
79
79
-
cgit.section = "software";
80
80
-
};
81
81
-
news = {
82
82
-
cgit.desc = "take a rss feed and a timeout and print it to stdout";
83
83
-
cgit.section = "software";
84
84
-
};
85
85
-
newsbot-js = {
86
86
-
cgit.desc = "print rss feeds to irc channels";
87
87
-
cgit.section = "software";
88
88
-
};
89
89
-
nix-user-chroot = {
90
90
-
cgit.desc = "Fork of nix-user-chroot by lethalman";
91
91
-
cgit.section = "software";
92
92
-
};
93
93
-
nix-writers = {
94
94
-
cgit.desc = "high level writers for nix";
95
95
-
cgit.section = "software";
96
96
-
};
97
97
-
nixos-generators = {
98
98
-
cgit.desc = "custom image builders";
99
99
-
cgit.section = "software";
100
100
-
};
101
101
-
nixpkgs = {
102
102
-
cgit.desc = "nixpkgs fork";
103
103
-
cgit.section = "configuration";
104
104
-
};
105
105
-
populate = {
106
106
-
cgit.section = "software";
107
107
-
};
108
108
-
reaktor2 = {
109
109
-
cgit.desc = "irc bot";
110
110
-
cgit.section = "software";
111
111
-
};
112
112
-
stockholm = {
113
113
-
cgit.desc = "take all the computers hostage, they'll love you!";
114
114
-
cgit.section = "configuration";
115
115
-
};
116
116
-
stockholm-issues = {
117
117
-
cgit.desc = "stockholm issues";
118
118
-
cgit.section = "issues";
119
119
-
};
120
120
-
the_playlist = {
121
121
-
cgit.desc = "Good Music collection + tools";
122
122
-
cgit.section = "art";
123
123
-
};
124
124
-
workadventure-nix = {
125
125
-
cgit.desc = "Nix packaging for workadventure";
126
126
-
cgit.section = "deployment";
127
127
-
};
128
128
-
xmonad-stockholm = {
129
129
-
cgit.desc = "krebs xmonad modules";
130
130
-
cgit.section = "configuration";
131
131
-
};
132
132
-
};
133
133
-
134
134
-
restricted-repos = lib.mapAttrs make-restricted-repo {
135
135
-
brain = {
136
136
-
collaborators = with config.krebs.users; [
137
137
-
tv
138
138
-
makefu
139
139
-
];
140
140
-
announce = true;
141
141
-
};
142
142
-
};
143
143
-
144
144
-
make-public-repo =
145
145
-
name:
146
146
-
{
147
147
-
cgit ? { },
148
148
-
collaborators ? [ ],
149
149
-
...
150
150
-
}:
151
151
-
{
152
152
-
inherit cgit collaborators name;
153
153
-
public = true;
154
154
-
hooks = {
155
155
-
post-receive = ''
156
156
-
${pkgs.git-hooks.irc-announce {
157
157
-
# TODO make nick = config.krebs.build.host.name the default
158
158
-
nick = config.krebs.build.host.name;
159
159
-
channel = "#xxx";
160
160
-
# TODO define refs in some kind of option per repo
161
161
-
server = "irc.r";
162
162
-
verbose = config.krebs.build.host.name == "orange";
163
163
-
}}
164
164
-
${cgit-clear-cache}/bin/cgit-clear-cache
165
165
-
'';
166
166
-
};
167
167
-
};
168
168
-
169
169
-
make-restricted-repo =
170
170
-
name:
171
171
-
{
172
172
-
admins ? [ ],
173
173
-
collaborators ? [ ],
174
174
-
announce ? true,
175
175
-
hooks ? { },
176
176
-
...
177
177
-
}:
178
178
-
{
179
179
-
inherit admins collaborators name;
180
180
-
public = false;
181
181
-
hooks = {
182
182
-
post-receive = ''
183
183
-
${lib.optionalString announce (
184
184
-
pkgs.git-hooks.irc-announce {
185
185
-
# TODO make nick = config.krebs.build.host.name the default
186
186
-
nick = config.krebs.build.host.name;
187
187
-
channel = "#xxx";
188
188
-
# TODO define refs in some kind of option per repo
189
189
-
refs = [
190
190
-
"refs/heads/master"
191
191
-
"refs/heads/staging*"
192
192
-
];
193
193
-
server = "irc.r";
194
194
-
verbose = false;
195
195
-
}
196
196
-
)}
197
197
-
${cgit-clear-cache}/bin/cgit-clear-cache
198
198
-
'';
199
199
-
}
200
200
-
// hooks;
201
201
-
};
202
202
-
203
203
-
make-rules =
204
204
-
with git // config.krebs.users;
205
205
-
repo:
206
206
-
lib.singleton {
207
207
-
user = [ lass ];
208
208
-
repo = [ repo ];
209
209
-
perm = push "refs/*" [
210
210
-
non-fast-forward
211
211
-
create
212
212
-
delete
213
213
-
merge
214
214
-
];
215
215
-
}
216
216
-
++ lib.optional (lib.length (repo.admins or [ ]) > 0) {
217
217
-
user = repo.admins;
218
218
-
repo = [ repo ];
219
219
-
perm = push "refs/*" [
220
220
-
non-fast-forward
221
221
-
create
222
222
-
delete
223
223
-
merge
224
224
-
];
225
225
-
}
226
226
-
++ lib.optional (lib.length (repo.collaborators or [ ]) > 0) {
227
227
-
user = repo.collaborators;
228
228
-
repo = [ repo ];
229
229
-
perm = fetch;
230
230
-
}
231
231
-
++ lib.optional repo.public {
232
232
-
user = lib.attrValues config.krebs.users;
233
233
-
repo = [ repo ];
234
234
-
perm = fetch;
235
235
-
};
236
236
-
237
237
-
in
238
238
-
out
-459
configs/desktops/lib/gamescope_libinput.patch
Reviewed
···
1
1
-
From 8518bc9b6ce13b0beffde1e59dae347e25adec84 Mon Sep 17 00:00:00 2001
2
2
-
From: honjow <honjow311@gmail.com>
3
3
-
Date: Tue, 25 Jun 2024 21:52:11 +0800
4
4
-
Subject: [PATCH 1/3] feat: Support libinput pointer settings.
5
5
-
6
6
-
---
7
7
-
src/main.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++
8
8
-
src/main.hpp | 12 ++++++++++++
9
9
-
src/wlserver.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++++
10
10
-
3 files changed, 99 insertions(+)
11
11
-
12
12
-
diff --git a/src/main.cpp b/src/main.cpp
13
13
-
index e8ebd66a30..37dfb8ebcb 100644
14
14
-
--- a/src/main.cpp
15
15
-
+++ b/src/main.cpp
16
16
-
@@ -145,6 +145,12 @@ const struct option *gamescope_options = (struct option[]){
17
17
-
// Steam Deck options
18
18
-
{ "mura-map", required_argument, nullptr, 0 },
19
19
-
20
20
-
+ // Pointer options
21
21
-
+ { "tap-to-click", no_argument, nullptr, 0 },
22
22
-
+ { "tap-to-drag", no_argument, nullptr, 0 },
23
23
-
+ { "drag-lock", no_argument, nullptr, 0 },
24
24
-
+ { "natural-scrolling", required_argument, nullptr, 0 },
25
25
-
+
26
26
-
{} // keep last
27
27
-
};
28
28
-
29
29
-
@@ -256,6 +262,16 @@ const char usage[] =
30
30
-
"Steam Deck options:\n"
31
31
-
" --mura-map Set the mura compensation map to use for the display. Takes in a path to the mura map.\n"
32
32
-
"\n"
33
33
-
+ "Libinput Pointer options:\n"
34
34
-
+ " --tap-to-click enable tap-to-click feature for pointer devices\n"
35
35
-
+ " --tap-and-drag enable tap-and-drag feature for pointer devices\n"
36
36
-
+ " --drag-lock enable drag-lock feature for pointer devices\n"
37
37
-
+ " --natural-scrolling enable natural scrolling for ...\n"
38
38
-
+ " none => No pointer device\n"
39
39
-
+ " touchpad => Only for touchpad\n"
40
40
-
+ " mouse => Only for mouse\n"
41
41
-
+ " all => All pointer device\n"
42
42
-
+ "\n"
43
43
-
"Keyboard shortcuts:\n"
44
44
-
" Super + F toggle fullscreen\n"
45
45
-
" Super + N toggle nearest neighbour filtering\n"
46
46
-
@@ -305,6 +321,11 @@ float g_flMaxWindowScale = FLT_MAX;
47
47
-
uint32_t g_preferVendorID = 0;
48
48
-
uint32_t g_preferDeviceID = 0;
49
49
-
50
50
-
+bool g_tapToClick = false;
51
51
-
+bool g_tapAndDrag = false;
52
52
-
+bool g_dragLock = false;
53
53
-
+SelectedPointerType g_naturalScrolling = SelectedPointerType::NONE;
54
54
-
+
55
55
-
pthread_t g_mainThread;
56
56
-
57
57
-
static void steamCompMgrThreadRun(int argc, char **argv);
58
58
-
@@ -438,6 +459,20 @@ static gamescope::ConCommand cc_shutdown( "shutdown", "Cleanly shutdown gamescop
59
59
-
console_log.infof( "Shutting down..." );
60
60
-
ShutdownGamescope();
61
61
-
});
62
62
-
+static SelectedPointerType parse_selected_pointer_type(const char* str)
63
63
-
+{
64
64
-
+ if (!str || !*str)
65
65
-
+ return SelectedPointerType::NONE;
66
66
-
+
67
67
-
+ if (!strcmp(str, "all"))
68
68
-
+ return SelectedPointerType::ALL;
69
69
-
+ else if (!strcmp(str, "touchpad"))
70
70
-
+ return SelectedPointerType::TOUCHPAD;
71
71
-
+ else if (!strcmp(str, "mouse"))
72
72
-
+ return SelectedPointerType::MOUSE;
73
73
-
+ else
74
74
-
+ return SelectedPointerType::NONE;
75
75
-
+}
76
76
-
77
77
-
static void handle_signal( int sig )
78
78
-
{
79
79
-
@@ -754,6 +789,14 @@ int main(int argc, char **argv)
80
80
-
g_nCursorScaleHeight = atoi(optarg);
81
81
-
} else if (strcmp(opt_name, "mangoapp") == 0) {
82
82
-
g_bLaunchMangoapp = true;
83
83
-
+ } else if (strcmp(opt_name, "tap-to-click") == 0) {
84
84
-
+ g_tapToClick = true;
85
85
-
+ } else if (strcmp(opt_name, "tap-and-drag") == 0) {
86
86
-
+ g_tapAndDrag = true;
87
87
-
+ } else if (strcmp(opt_name, "drag-lock") == 0) {
88
88
-
+ g_dragLock = true;
89
89
-
+ } else if (strcmp(opt_name, "natural-scrolling") == 0) {
90
90
-
+ g_naturalScrolling = parse_selected_pointer_type( optarg );
91
91
-
}
92
92
-
break;
93
93
-
case '?':
94
94
-
diff --git a/src/main.hpp b/src/main.hpp
95
95
-
index 8cfe62915f..c8948f7bdc 100644
96
96
-
--- a/src/main.hpp
97
97
-
+++ b/src/main.hpp
98
98
-
@@ -66,3 +66,15 @@ extern int g_nXWaylandCount;
99
99
-
extern uint32_t g_preferVendorID;
100
100
-
extern uint32_t g_preferDeviceID;
101
101
-
102
102
-
+enum class SelectedPointerType : uint32_t
103
103
-
+{
104
104
-
+ NONE,
105
105
-
+ TOUCHPAD,
106
106
-
+ MOUSE,
107
107
-
+ ALL,
108
108
-
+};
109
109
-
+
110
110
-
+extern bool g_tapToClick;
111
111
-
+extern bool g_tapAndDrag;
112
112
-
+extern bool g_dragLock;
113
113
-
+extern SelectedPointerType g_naturalScrolling;
114
114
-
diff --git a/src/wlserver.cpp b/src/wlserver.cpp
115
115
-
index ee6891d103..95b250ec4a 100644
116
116
-
--- a/src/wlserver.cpp
117
117
-
+++ b/src/wlserver.cpp
118
118
-
@@ -484,6 +484,48 @@ static void wlserver_handle_touch_motion(struct wl_listener *listener, void *dat
119
119
-
wlserver_touchmotion( event->x, event->y, event->touch_id, event->time_msec );
120
120
-
}
121
121
-
122
122
-
+static void wlserver_set_libinput_pointer(struct wlr_input_device *device)
123
123
-
+{
124
124
-
+#ifdef WLR_BACKEND_LIBINPUT_H
125
125
-
+ if (device->type != WLR_INPUT_DEVICE_POINTER || !wlr_input_device_is_libinput(device))
126
126
-
+ return;
127
127
-
+
128
128
-
+ struct libinput_device* libinput_device = wlr_libinput_get_device_handle(device);
129
129
-
+
130
130
-
+ if (g_tapToClick)
131
131
-
+ libinput_device_config_tap_set_enabled(libinput_device, LIBINPUT_CONFIG_TAP_ENABLED);
132
132
-
+ else
133
133
-
+ libinput_device_config_tap_set_enabled(libinput_device, LIBINPUT_CONFIG_TAP_DISABLED);
134
134
-
+
135
135
-
+ if (g_tapAndDrag)
136
136
-
+ libinput_device_config_tap_set_drag_enabled(libinput_device, LIBINPUT_CONFIG_DRAG_ENABLED);
137
137
-
+ else
138
138
-
+ libinput_device_config_tap_set_drag_enabled(libinput_device, LIBINPUT_CONFIG_DRAG_DISABLED);
139
139
-
+
140
140
-
+ if (g_dragLock)
141
141
-
+ libinput_device_config_tap_set_drag_lock_enabled(libinput_device, LIBINPUT_CONFIG_DRAG_LOCK_ENABLED);
142
142
-
+ else
143
143
-
+ libinput_device_config_tap_set_drag_lock_enabled(libinput_device, LIBINPUT_CONFIG_DRAG_LOCK_DISABLED);
144
144
-
+
145
145
-
+ if (libinput_device_config_scroll_has_natural_scroll(libinput_device) != 0)
146
146
-
+ switch (g_naturalScrolling)
147
147
-
+ {
148
148
-
+ case SelectedPointerType::TOUCHPAD:
149
149
-
+ if (libinput_device_config_tap_get_finger_count(libinput_device) != 0)
150
150
-
+ libinput_device_config_scroll_set_natural_scroll_enabled(libinput_device, true);
151
151
-
+ break;
152
152
-
+ case SelectedPointerType::MOUSE:
153
153
-
+ if (libinput_device_config_tap_get_finger_count(libinput_device) == 0)
154
154
-
+ libinput_device_config_scroll_set_natural_scroll_enabled(libinput_device, true);
155
155
-
+ break;
156
156
-
+ case SelectedPointerType::ALL:
157
157
-
+ libinput_device_config_scroll_set_natural_scroll_enabled(libinput_device, true);
158
158
-
+ case SelectedPointerType::NONE:
159
159
-
+ break;
160
160
-
+ }
161
161
-
+#endif
162
162
-
+}
163
163
-
+
164
164
-
static void wlserver_new_input(struct wl_listener *listener, void *data)
165
165
-
{
166
166
-
struct wlr_input_device *device = (struct wlr_input_device *) data;
167
167
-
@@ -534,6 +576,8 @@ static void wlserver_new_input(struct wl_listener *listener, void *data)
168
168
-
wl_signal_add( &pointer->wlr->events.axis, &pointer->axis);
169
169
-
pointer->frame.notify = wlserver_handle_pointer_frame;
170
170
-
wl_signal_add( &pointer->wlr->events.frame, &pointer->frame);
171
171
-
+
172
172
-
+ wlserver_set_libinput_pointer(device);
173
173
-
}
174
174
-
break;
175
175
-
case WLR_INPUT_DEVICE_TOUCH:
176
176
-
177
177
-
From 8f3bd1747ec3f72e8f5598e4de6a962ec44eecf4 Mon Sep 17 00:00:00 2001
178
178
-
From: Chenx Dust <chenx_dust@outlook.com>
179
179
-
Date: Fri, 5 Jul 2024 14:30:07 +0000
180
180
-
Subject: [PATCH 2/3] feat: Add more options for libinput pointer device
181
181
-
182
182
-
---
183
183
-
src/main.cpp | 53 +++++++++++++++++++++++++---
184
184
-
src/main.hpp | 14 ++++++++
185
185
-
src/wlserver.cpp | 90 ++++++++++++++++++++++++++++++++++++++++++------
186
186
-
3 files changed, 142 insertions(+), 15 deletions(-)
187
187
-
188
188
-
diff --git a/src/main.cpp b/src/main.cpp
189
189
-
index 37dfb8ebcb..5eda5e8133 100644
190
190
-
--- a/src/main.cpp
191
191
-
+++ b/src/main.cpp
192
192
-
@@ -145,11 +145,17 @@ const struct option *gamescope_options = (struct option[]){
193
193
-
// Steam Deck options
194
194
-
{ "mura-map", required_argument, nullptr, 0 },
195
195
-
196
196
-
- // Pointer options
197
197
-
+ // Libinput options
198
198
-
{ "tap-to-click", no_argument, nullptr, 0 },
199
199
-
{ "tap-to-drag", no_argument, nullptr, 0 },
200
200
-
{ "drag-lock", no_argument, nullptr, 0 },
201
201
-
+ { "middle-emulation", no_argument, nullptr, 0 },
202
202
-
+ { "disable-while-typing", no_argument, nullptr, 0 },
203
203
-
+ { "disable-while-trackpointing", no_argument, nullptr, 0 },
204
204
-
+ { "left-handed", no_argument, nullptr, 0 },
205
205
-
{ "natural-scrolling", required_argument, nullptr, 0 },
206
206
-
+ { "pointer-accel-profile", required_argument, nullptr, 0 },
207
207
-
+ { "pointer-accel-speed", required_argument, nullptr, 0 },
208
208
-
209
209
-
{} // keep last
210
210
-
};
211
211
-
@@ -266,11 +272,19 @@ const char usage[] =
212
212
-
" --tap-to-click enable tap-to-click feature for pointer devices\n"
213
213
-
" --tap-and-drag enable tap-and-drag feature for pointer devices\n"
214
214
-
" --drag-lock enable drag-lock feature for pointer devices\n"
215
215
-
+ " --middle-emulation enable middle button emulation for pointer devices\n"
216
216
-
+ " --left-handed enable left handed mode for pointer devices\n"
217
217
-
+ " --disable-while-typing disable pointer devices while typing\n"
218
218
-
+ " --disable-while-trackpointing disable pointer devices while trackpointing\n"
219
219
-
" --natural-scrolling enable natural scrolling for ...\n"
220
220
-
- " none => No pointer device\n"
221
221
-
- " touchpad => Only for touchpad\n"
222
222
-
- " mouse => Only for mouse\n"
223
223
-
+ " none => No pointer device (default)\n"
224
224
-
+ " touchpad => Only touchpad\n"
225
225
-
+ " mouse => Only mouse\n"
226
226
-
" all => All pointer device\n"
227
227
-
+ " --pointer-accel-profile set acceleration profile for pointer devices to ...\n"
228
228
-
+ " adaptive => takes the current speed of the device into account when deciding on acceleration (default)\n"
229
229
-
+ " flat => simply a constant factor applied to all device deltas, regardless of the speed of motion\n"
230
230
-
+ " --pointer-accel-speed set acceleration speed for pointer devices within [-1, 1] (default 0)\n"
231
231
-
"\n"
232
232
-
"Keyboard shortcuts:\n"
233
233
-
" Super + F toggle fullscreen\n"
234
234
-
@@ -324,7 +338,13 @@ uint32_t g_preferDeviceID = 0;
235
235
-
bool g_tapToClick = false;
236
236
-
bool g_tapAndDrag = false;
237
237
-
bool g_dragLock = false;
238
238
-
+bool g_middleEmu = false;
239
239
-
+bool g_leftHanded = false;
240
240
-
+bool g_dwt = false;
241
241
-
+bool g_dwtp = false;
242
242
-
SelectedPointerType g_naturalScrolling = SelectedPointerType::NONE;
243
243
-
+PointerAccelProfileType g_accelProfile = PointerAccelProfileType::ADAPTIVE;
244
244
-
+double g_accelSpeed = false;
245
245
-
246
246
-
pthread_t g_mainThread;
247
247
-
248
248
-
@@ -474,6 +494,19 @@ static SelectedPointerType parse_selected_pointer_type(const char* str)
249
249
-
return SelectedPointerType::NONE;
250
250
-
}
251
251
-
252
252
-
+static PointerAccelProfileType parse_pointer_accel_profile(const char* str)
253
253
-
+{
254
254
-
+ if (!str || !*str)
255
255
-
+ return PointerAccelProfileType::ADAPTIVE;
256
256
-
+
257
257
-
+ if (!strcmp(str, "adaptive"))
258
258
-
+ return PointerAccelProfileType::ADAPTIVE;
259
259
-
+ else if (!strcmp(str, "flat"))
260
260
-
+ return PointerAccelProfileType::FLAT;
261
261
-
+ else
262
262
-
+ return PointerAccelProfileType::ADAPTIVE;
263
263
-
+}
264
264
-
+
265
265
-
static void handle_signal( int sig )
266
266
-
{
267
267
-
switch ( sig ) {
268
268
-
@@ -795,8 +828,20 @@ int main(int argc, char **argv)
269
269
-
g_tapAndDrag = true;
270
270
-
} else if (strcmp(opt_name, "drag-lock") == 0) {
271
271
-
g_dragLock = true;
272
272
-
+ } else if (strcmp(opt_name, "middle-emulation") == 0) {
273
273
-
+ g_middleEmu = true;
274
274
-
+ } else if (strcmp(opt_name, "left-handed") == 0) {
275
275
-
+ g_leftHanded = true;
276
276
-
+ } else if (strcmp(opt_name, "disable-while-typing") == 0) {
277
277
-
+ g_dwt = true;
278
278
-
+ } else if (strcmp(opt_name, "disable-while-trackpointing") == 0) {
279
279
-
+ g_dwtp = true;
280
280
-
} else if (strcmp(opt_name, "natural-scrolling") == 0) {
281
281
-
g_naturalScrolling = parse_selected_pointer_type( optarg );
282
282
-
+ } else if (strcmp(opt_name, "pointer-accel-profile") == 0) {
283
283
-
+ g_accelProfile = parse_pointer_accel_profile( optarg );
284
284
-
+ } else if (strcmp(opt_name, "pointer-accel-speed") == 0) {
285
285
-
+ g_accelSpeed = atof( optarg );
286
286
-
}
287
287
-
break;
288
288
-
case '?':
289
289
-
diff --git a/src/main.hpp b/src/main.hpp
290
290
-
index c8948f7bdc..58eed11701 100644
291
291
-
--- a/src/main.hpp
292
292
-
+++ b/src/main.hpp
293
293
-
@@ -74,7 +74,21 @@ enum class SelectedPointerType : uint32_t
294
294
-
ALL,
295
295
-
};
296
296
-
297
297
-
+enum class PointerAccelProfileType : uint32_t
298
298
-
+{
299
299
-
+ NONE,
300
300
-
+ FLAT,
301
301
-
+ ADAPTIVE,
302
302
-
+ CUSTOM,
303
303
-
+};
304
304
-
+
305
305
-
extern bool g_tapToClick;
306
306
-
extern bool g_tapAndDrag;
307
307
-
extern bool g_dragLock;
308
308
-
+extern bool g_middleEmu;
309
309
-
+extern bool g_leftHanded;
310
310
-
+extern bool g_dwt;
311
311
-
+extern bool g_dwtp;
312
312
-
extern SelectedPointerType g_naturalScrolling;
313
313
-
+extern PointerAccelProfileType g_accelProfile;
314
314
-
+extern double g_accelSpeed;
315
315
-
diff --git a/src/wlserver.cpp b/src/wlserver.cpp
316
316
-
index 95b250ec4a..7d7778f6ee 100644
317
317
-
--- a/src/wlserver.cpp
318
318
-
+++ b/src/wlserver.cpp
319
319
-
@@ -486,28 +486,76 @@ static void wlserver_handle_touch_motion(struct wl_listener *listener, void *dat
320
320
-
321
321
-
static void wlserver_set_libinput_pointer(struct wlr_input_device *device)
322
322
-
{
323
323
-
-#ifdef WLR_BACKEND_LIBINPUT_H
324
324
-
+#ifdef HAVE_DRM
325
325
-
if (device->type != WLR_INPUT_DEVICE_POINTER || !wlr_input_device_is_libinput(device))
326
326
-
return;
327
327
-
328
328
-
struct libinput_device* libinput_device = wlr_libinput_get_device_handle(device);
329
329
-
330
330
-
- if (g_tapToClick)
331
331
-
+ if (g_tapToClick) {
332
332
-
libinput_device_config_tap_set_enabled(libinput_device, LIBINPUT_CONFIG_TAP_ENABLED);
333
333
-
- else
334
334
-
+ } else {
335
335
-
libinput_device_config_tap_set_enabled(libinput_device, LIBINPUT_CONFIG_TAP_DISABLED);
336
336
-
-
337
337
-
- if (g_tapAndDrag)
338
338
-
+ }
339
339
-
+ if (g_tapAndDrag) {
340
340
-
libinput_device_config_tap_set_drag_enabled(libinput_device, LIBINPUT_CONFIG_DRAG_ENABLED);
341
341
-
- else
342
342
-
+ } else {
343
343
-
libinput_device_config_tap_set_drag_enabled(libinput_device, LIBINPUT_CONFIG_DRAG_DISABLED);
344
344
-
-
345
345
-
- if (g_dragLock)
346
346
-
+ }
347
347
-
+ if (g_dragLock) {
348
348
-
libinput_device_config_tap_set_drag_lock_enabled(libinput_device, LIBINPUT_CONFIG_DRAG_LOCK_ENABLED);
349
349
-
- else
350
350
-
+ } else {
351
351
-
libinput_device_config_tap_set_drag_lock_enabled(libinput_device, LIBINPUT_CONFIG_DRAG_LOCK_DISABLED);
352
352
-
-
353
353
-
- if (libinput_device_config_scroll_has_natural_scroll(libinput_device) != 0)
354
354
-
+ }
355
355
-
+ if (libinput_device_config_middle_emulation_is_available(libinput_device)) {
356
356
-
+ if (g_middleEmu) {
357
357
-
+ libinput_device_config_middle_emulation_set_enabled(libinput_device, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED);
358
358
-
+ } else {
359
359
-
+ libinput_device_config_middle_emulation_set_enabled(libinput_device, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED);
360
360
-
+ }
361
361
-
+ } else {
362
362
-
+ if (device->name) {
363
363
-
+ printf("Libinput pointer \"%s\": Middle button emulation not supported", device->name);
364
364
-
+ } else {
365
365
-
+ printf("Unnamed libinput pointer: Middle button emulation not supported");
366
366
-
+ }
367
367
-
+ }
368
368
-
+ if (libinput_device_config_left_handed_is_available(libinput_device)) {
369
369
-
+ libinput_device_config_left_handed_set(libinput_device, g_leftHanded);
370
370
-
+ } else {
371
371
-
+ if (device->name) {
372
372
-
+ printf("Libinput pointer \"%s\": Left handed mode not supported", device->name);
373
373
-
+ } else {
374
374
-
+ printf("Unnamed libinput pointer: Left handed mode not supported");
375
375
-
+ }
376
376
-
+ }
377
377
-
+ if (libinput_device_config_dwt_is_available(libinput_device)) {
378
378
-
+ if (g_dwt) {
379
379
-
+ libinput_device_config_dwt_set_enabled(libinput_device, LIBINPUT_CONFIG_DWT_ENABLED);
380
380
-
+ } else {
381
381
-
+ libinput_device_config_dwt_set_enabled(libinput_device, LIBINPUT_CONFIG_DWT_DISABLED);
382
382
-
+ }
383
383
-
+ } else {
384
384
-
+ if (device->name) {
385
385
-
+ printf("Libinput pointer \"%s\": Disable while typing not supported", device->name);
386
386
-
+ } else {
387
387
-
+ printf("Unnamed libinput pointer: Disable while typing not supported");
388
388
-
+ }
389
389
-
+ }
390
390
-
+ if (libinput_device_config_dwtp_is_available(libinput_device)) {
391
391
-
+ if (g_dwtp) {
392
392
-
+ libinput_device_config_dwtp_set_enabled(libinput_device, LIBINPUT_CONFIG_DWTP_ENABLED);
393
393
-
+ } else {
394
394
-
+ libinput_device_config_dwtp_set_enabled(libinput_device, LIBINPUT_CONFIG_DWTP_DISABLED);
395
395
-
+ }
396
396
-
+ } else {
397
397
-
+ if (device->name) {
398
398
-
+ printf("Libinput pointer \"%s\": Disable while track pointing not supported", device->name);
399
399
-
+ } else {
400
400
-
+ printf("Unnamed libinput pointer: Disable while track pointing not supported");
401
401
-
+ }
402
402
-
+ }
403
403
-
+ if (libinput_device_config_scroll_has_natural_scroll(libinput_device) != 0) {
404
404
-
switch (g_naturalScrolling)
405
405
-
{
406
406
-
case SelectedPointerType::TOUCHPAD:
407
407
-
@@ -520,9 +568,29 @@ static void wlserver_set_libinput_pointer(struct wlr_input_device *device)
408
408
-
break;
409
409
-
case SelectedPointerType::ALL:
410
410
-
libinput_device_config_scroll_set_natural_scroll_enabled(libinput_device, true);
411
411
-
+ break;
412
412
-
case SelectedPointerType::NONE:
413
413
-
break;
414
414
-
}
415
415
-
+ }
416
416
-
+ if (libinput_device_config_accel_is_available(libinput_device)) {
417
417
-
+ switch (g_accelProfile) {
418
418
-
+ case PointerAccelProfileType::FLAT:
419
419
-
+ libinput_device_config_accel_set_profile(libinput_device, LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT);
420
420
-
+ break;
421
421
-
+ case PointerAccelProfileType::ADAPTIVE:
422
422
-
+ default:
423
423
-
+ libinput_device_config_accel_set_profile(libinput_device, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE);
424
424
-
+ break;
425
425
-
+ }
426
426
-
+ libinput_device_config_accel_set_speed(libinput_device, g_accelSpeed);
427
427
-
+ } else {
428
428
-
+ if (device->name) {
429
429
-
+ printf("Libinput pointer \"%s\": Accelation not supported", device->name);
430
430
-
+ } else {
431
431
-
+ printf("Unnamed libinput pointer: Accelation not supported");
432
432
-
+ }
433
433
-
+ }
434
434
-
#endif
435
435
-
}
436
436
-
437
437
-
438
438
-
From f69e6bcb2d1c49911f9e9aaf1a6f8e0f182eb29c Mon Sep 17 00:00:00 2001
439
439
-
From: Chenx Dust <chenx_dust@outlook.com>
440
440
-
Date: Thu, 17 Oct 2024 04:41:02 +0000
441
441
-
Subject: [PATCH 3/3] fix: Fix typo of "tap and drag" option in `main.cpp`
442
442
-
443
443
-
---
444
444
-
src/main.cpp | 2 +-
445
445
-
1 file changed, 1 insertion(+), 1 deletion(-)
446
446
-
447
447
-
diff --git a/src/main.cpp b/src/main.cpp
448
448
-
index 5eda5e8133..05f8d26517 100644
449
449
-
--- a/src/main.cpp
450
450
-
+++ b/src/main.cpp
451
451
-
@@ -147,7 +147,7 @@ const struct option *gamescope_options = (struct option[]){
452
452
-
453
453
-
// Libinput options
454
454
-
{ "tap-to-click", no_argument, nullptr, 0 },
455
455
-
- { "tap-to-drag", no_argument, nullptr, 0 },
456
456
-
+ { "tap-and-drag", no_argument, nullptr, 0 },
457
457
-
{ "drag-lock", no_argument, nullptr, 0 },
458
458
-
{ "middle-emulation", no_argument, nullptr, 0 },
459
459
-
{ "disable-while-typing", no_argument, nullptr, 0 },
-6
configs/desktops/lib/wayland.nix
View file
Reviewed
···
89
89
programs.wshowkeys.enable = true;
90
90
91
91
environment.systemPackages = with pkgs; [
92
92
-
# (gamescope.overrideAttrs (old: {
93
93
-
# patches = old.patches ++ [
94
94
-
# ./gamescope_libinput.patch
95
95
-
# ];
96
96
-
#
97
97
-
# }))
98
92
swaylock-effects # lockscreen
99
93
pavucontrol
100
94
swayidle
-730
configs/desktops/sway/eww.nix
Reviewed
···
1
1
-
{
2
2
-
pkgs,
3
3
-
lib,
4
4
-
config,
5
5
-
self,
6
6
-
...
7
7
-
}:
8
8
-
let
9
9
-
10
10
-
# Reference to goto-workspace (defined in default.nix, available at /run/current-system/sw/bin/)
11
11
-
gotoWorkspace = "/run/current-system/sw/bin/goto-workspace";
12
12
-
13
13
-
# eww configuration
14
14
-
ewwYuck = pkgs.writeText "eww.yuck" ''
15
15
-
; Magic variables (built-in, no polling needed)
16
16
-
; EWW_TIME provides current time
17
17
-
; EWW_CPU provides {cores: [...], avg: X}
18
18
-
; EWW_RAM provides {used_mem_perc: X, available_mem: Y, total_mem: Z, ...}
19
19
-
20
20
-
; Custom variables with polling
21
21
-
(defpoll cpu-freq :interval "2s" :initial 0 "${lib.getExe cpuFreqScript}")
22
22
-
(defpoll cpu-load :interval "2s" :initial "0.00" "cut -d' ' -f1 /proc/loadavg")
23
23
-
(defpoll temperature :interval "2s" :initial '{"temp": 0, "fan": 0}' "${lib.getExe tempScript}")
24
24
-
(defpoll power :interval "2s" :initial '{"watts": 0, "charging": false}' "${lib.getExe powerScript}")
25
25
-
(defpoll power-profile :interval "2s" :initial '{"name": "unknown", "tdp": 0}' "${lib.getExe powerProfileStatusScript}")
26
26
-
(defpoll battery :interval "10s" :initial '{"capacity": "100", "icon": "", "watts": "0", "time_remaining": "--", "status": "Full"}' "${lib.getExe batteryScript}")
27
27
-
(defpoll volume :interval "1s" :initial '{"level": "0", "icon": ""}' "${lib.getExe volumeScript}")
28
28
-
(defpoll network :interval "5s" :initial " ..." "${lib.getExe networkScript}")
29
29
-
(defpoll brightness :interval "1s" :initial 100 "${lib.getExe brightnessScript}")
30
30
-
(defpoll idle-inhibited :interval "0.5s" :initial "false" "${lib.getExe idleStatusScript}")
31
31
-
(deflisten workspaces :initial '[]' "${lib.getExe workspacesScript}")
32
32
-
33
33
-
; Tooltip state
34
34
-
(defvar hover-tooltip "")
35
35
-
36
36
-
; Generic hover-tooltip wrapper: shows tooltip on hover via in-bar overlay
37
37
-
; Use an explicit eww command here instead of the EWW_CMD shell variable,
38
38
-
; because yuck also treats dollar-brace interpolation as a dynamic string.
39
39
-
(defwidget hover-tip [text]
40
40
-
(eventbox :onhover {text != "" ? "${lib.getExe pkgs.eww} --config \"$EWW_CONFIG\" update hover-tooltip=${"'"}''${text}${"'"}" : ""}
41
41
-
:onhoverlost "${lib.getExe pkgs.eww} --config \"$EWW_CONFIG\" update hover-tooltip=${"'"}${"'"}"
42
42
-
(children)))
43
43
-
44
44
-
; Widget definitions
45
45
-
(defwidget bar []
46
46
-
(overlay
47
47
-
(centerbox :orientation "h"
48
48
-
(left)
49
49
-
(center)
50
50
-
(right))
51
51
-
(revealer :reveal {hover-tooltip != ""} :transition "slidedown" :duration "150ms" :valign "end" :halign "end"
52
52
-
(box :class "hover-tooltip"
53
53
-
(label :text hover-tooltip)))))
54
54
-
55
55
-
(defwidget left []
56
56
-
(box :class "left" :orientation "h" :space-evenly false :halign "start"
57
57
-
(workspaces-widget)))
58
58
-
59
59
-
(defwidget center []
60
60
-
(box :class "center" :orientation "h" :space-evenly false :halign "center"
61
61
-
(label :text {formattime(EWW_TIME, "%H:%M")})))
62
62
-
63
63
-
(defwidget right []
64
64
-
(box :class "right" :orientation "h" :space-evenly false :halign "end" :spacing 8
65
65
-
(network-widget)
66
66
-
(volume-widget)
67
67
-
(graph-widget :value {EWW_CPU.avg} :icon "" :class "cpu" :unit "%" :tooltip "Load: ''${cpu-load} | ''${cpu-freq} MHz")
68
68
-
(graph-widget :value {EWW_RAM.used_mem_perc} :icon "" :class "memory" :unit "%")
69
69
-
(graph-widget :value {temperature.temp} :icon "" :class "temp" :unit "°" :tooltip "Fan: ''${temperature.fan} RPM")
70
70
-
(power-graph-widget)
71
71
-
(brightness-widget)
72
72
-
(battery-widget)
73
73
-
(idle-inhibitor)
74
74
-
(label :class "date" :text {formattime(EWW_TIME, "%Y-%m-%d")})
75
75
-
(systray :class "systray" :icon-size 18 :spacing 4)))
76
76
-
77
77
-
(defwidget workspaces-widget []
78
78
-
(box :class "workspaces" :orientation "h" :space-evenly false :spacing 0
79
79
-
(for ws in workspaces
80
80
-
(button :class {ws.urgent ? "workspace urgent" : (ws.focused ? "workspace focused" : "workspace")}
81
81
-
:onclick "${gotoWorkspace} ''${ws.name}"
82
82
-
{ws.name}))))
83
83
-
84
84
-
(defwidget graph-widget [value icon class unit ?tooltip]
85
85
-
(hover-tip :text {tooltip ?: ""}
86
86
-
(box :class "graph-module ''${class}" :orientation "h" :space-evenly false :spacing 4
87
87
-
(graph :class "graph"
88
88
-
:value value
89
89
-
:thickness 3
90
90
-
:time-range "60s"
91
91
-
:min 0
92
92
-
:max 100
93
93
-
:dynamic true
94
94
-
:line-style "round"
95
95
-
:width 75)
96
96
-
(label :text "''${round(value, 0)}''${unit} ''${icon}"))))
97
97
-
98
98
-
(defwidget battery-widget []
99
99
-
(hover-tip :text "''${battery.watts}W | ''${battery.time_remaining} ''${battery.status == 'Charging' ? 'to full' : 'remaining'}"
100
100
-
(box :class "battery" :orientation "h" :space-evenly false
101
101
-
(label :text "''${battery.capacity}% ''${battery.icon}"))))
102
102
-
103
103
-
(defwidget power-graph-widget []
104
104
-
(hover-tip :text "TDP: ''${power-profile.tdp}W (''${power-profile.name}) | ''${battery.time_remaining} ''${battery.status == 'Charging' ? 'to full' : 'remaining'}"
105
105
-
(eventbox :onclick "${lib.getExe powerProfileCycleScript}"
106
106
-
(box :class {power.charging ? "graph-module power charging" : "graph-module power"} :orientation "h" :space-evenly false :spacing 4
107
107
-
(graph :class "graph"
108
108
-
:value {power.watts}
109
109
-
:thickness 3
110
110
-
:time-range "60s"
111
111
-
:min 0
112
112
-
:max 45
113
113
-
:dynamic false
114
114
-
:line-style "round"
115
115
-
:width 75)
116
116
-
(label :text "''${round(power.watts, 1)}W ''${power.charging ? '' : ''}")))))
117
117
-
118
118
-
(defwidget volume-widget []
119
119
-
(eventbox :onscroll "${lib.getExe volumeAdjustScript} {}"
120
120
-
:onclick "${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle"
121
121
-
(box :class "volume" :orientation "h" :space-evenly false
122
122
-
(label :text "''${volume.level}% ''${volume.icon}"))))
123
123
-
124
124
-
(defwidget network-widget []
125
125
-
(box :class "network" :orientation "h" :space-evenly false
126
126
-
(label :text "''${network}")))
127
127
-
128
128
-
(defwidget brightness-widget []
129
129
-
(button :class "brightness" :onclick "/run/current-system/sw/bin/switch-theme toggle"
130
130
-
(label :text "''${brightness}% ")))
131
131
-
132
132
-
(defwidget idle-inhibitor []
133
133
-
(button :class {idle-inhibited == "true" ? "idle-inhibitor active" : "idle-inhibitor"}
134
134
-
:onclick "${lib.getExe idleToggleScript}"
135
135
-
{idle-inhibited == "true" ? "" : ""}))
136
136
-
137
137
-
; Window definition - screen name passed as argument
138
138
-
(defwindow bar [screen]
139
139
-
:monitor screen
140
140
-
:geometry (geometry :x "0%"
141
141
-
:y "0%"
142
142
-
:width "100%"
143
143
-
:height "36px"
144
144
-
:anchor "top center")
145
145
-
:stacking "fg"
146
146
-
:exclusive true
147
147
-
:focusable false
148
148
-
(bar))
149
149
-
150
150
-
151
151
-
'';
152
152
-
153
153
-
ewwScss = pkgs.writeText "eww.scss" ''
154
154
-
* {
155
155
-
all: unset;
156
156
-
font-family: "Iosevka Nerd Font", monospace;
157
157
-
font-size: 14px;
158
158
-
}
159
159
-
160
160
-
window {
161
161
-
background-color: #1a1b26;
162
162
-
color: #c0caf5;
163
163
-
}
164
164
-
165
165
-
.left, .center, .right {
166
166
-
margin: 4px 8px;
167
167
-
}
168
168
-
169
169
-
.workspaces {
170
170
-
button {
171
171
-
padding: 0 4px;
172
172
-
margin: 0 1px;
173
173
-
border-radius: 2px;
174
174
-
min-width: 24px;
175
175
-
background-color: #24283b;
176
176
-
&.focused {
177
177
-
background-color: #7aa2f7;
178
178
-
color: #1a1b26;
179
179
-
}
180
180
-
&.urgent {
181
181
-
background-color: #f7768e;
182
182
-
color: #1a1b26;
183
183
-
}
184
184
-
&:hover {
185
185
-
background-color: #414868;
186
186
-
}
187
187
-
}
188
188
-
}
189
189
-
190
190
-
.graph-module {
191
191
-
padding: 0 8px;
192
192
-
margin: 0 2px;
193
193
-
border-radius: 4px;
194
194
-
&.cpu {
195
195
-
background-color: #9ece6a;
196
196
-
color: #1a1b26;
197
197
-
}
198
198
-
&.memory {
199
199
-
background-color: #7dcfff;
200
200
-
color: #1a1b26;
201
201
-
}
202
202
-
&.temp {
203
203
-
background-color: #ff9e64;
204
204
-
color: #1a1b26;
205
205
-
}
206
206
-
&.power {
207
207
-
background-color: #f7768e;
208
208
-
color: #1a1b26;
209
209
-
&.charging {
210
210
-
background-color: #9ece6a;
211
211
-
}
212
212
-
}
213
213
-
}
214
214
-
215
215
-
.graph {
216
216
-
min-height: 20px;
217
217
-
}
218
218
-
219
219
-
.battery, .volume, .network, .date, .brightness {
220
220
-
padding: 0 8px;
221
221
-
margin: 0 2px;
222
222
-
border-radius: 4px;
223
223
-
background-color: #24283b;
224
224
-
}
225
225
-
226
226
-
.idle-inhibitor {
227
227
-
padding: 0 8px;
228
228
-
margin: 0 2px;
229
229
-
border-radius: 4px;
230
230
-
background-color: #24283b;
231
231
-
&.active {
232
232
-
background-color: #bb9af7;
233
233
-
color: #1a1b26;
234
234
-
}
235
235
-
&:hover {
236
236
-
background-color: #414868;
237
237
-
}
238
238
-
}
239
239
-
240
240
-
.systray {
241
241
-
padding: 0 8px;
242
242
-
margin: 0 2px;
243
243
-
}
244
244
-
245
245
-
.hover-tooltip {
246
246
-
background-color: #24283b;
247
247
-
color: #c0caf5;
248
248
-
border-bottom: 1px solid #414868;
249
249
-
padding: 2px 12px;
250
250
-
}
251
251
-
'';
252
252
-
253
253
-
cpuFreqScript = pkgs.writeShellApplication {
254
254
-
name = "eww-cpu-freq";
255
255
-
runtimeInputs = [ ];
256
256
-
text = ''
257
257
-
# Get average CPU frequency in MHz
258
258
-
freq=0
259
259
-
count=0
260
260
-
for f in /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq; do
261
261
-
if [ -f "$f" ]; then
262
262
-
val=$(cat "$f")
263
263
-
freq=$((freq + val))
264
264
-
count=$((count + 1))
265
265
-
fi
266
266
-
done
267
267
-
if [ "$count" -gt 0 ]; then
268
268
-
freq=$((freq / count / 1000))
269
269
-
fi
270
270
-
echo "$freq"
271
271
-
'';
272
272
-
};
273
273
-
274
274
-
tempScript = pkgs.writeShellApplication {
275
275
-
name = "eww-temp";
276
276
-
runtimeInputs = [ pkgs.jq ];
277
277
-
text = ''
278
278
-
temp_raw=$(cat /sys/class/thermal/thermal_zone0/temp 2>/dev/null || echo 0)
279
279
-
temp=$((temp_raw / 1000))
280
280
-
281
281
-
# Find gpdfan hwmon for fan speed
282
282
-
fan=0
283
283
-
for hwmon in /sys/class/hwmon/hwmon*; do
284
284
-
if [ "$(cat "$hwmon/name" 2>/dev/null)" = "gpdfan" ]; then
285
285
-
fan=$(cat "$hwmon/fan1_input" 2>/dev/null || echo 0)
286
286
-
break
287
287
-
fi
288
288
-
done
289
289
-
290
290
-
jq -n --argjson temp "$temp" --argjson fan "$fan" '{temp: $temp, fan: $fan}'
291
291
-
'';
292
292
-
};
293
293
-
294
294
-
powerScript = pkgs.writeShellApplication {
295
295
-
name = "eww-power";
296
296
-
runtimeInputs = [
297
297
-
pkgs.jq
298
298
-
pkgs.bc
299
299
-
];
300
300
-
text = ''
301
301
-
# Use RAPL for actual system power consumption (works on Intel and AMD Zen)
302
302
-
# Falls back to battery power_now if RAPL unavailable
303
303
-
304
304
-
state_file="/tmp/eww-power-state"
305
305
-
rapl_path="/sys/class/powercap/intel-rapl:0/energy_uj"
306
306
-
307
307
-
# Check charging status
308
308
-
charging="false"
309
309
-
for p in /sys/class/power_supply/BAT* /sys/class/power_supply/BATT*; do
310
310
-
if [ -f "$p/status" ]; then
311
311
-
status=$(cat "$p/status" 2>/dev/null || echo "Unknown")
312
312
-
if [ "$status" = "Charging" ]; then
313
313
-
charging="true"
314
314
-
fi
315
315
-
break
316
316
-
fi
317
317
-
done
318
318
-
319
319
-
# Try RAPL first (gives actual system power regardless of charging state)
320
320
-
if [ -r "$rapl_path" ]; then
321
321
-
current_energy=$(cat "$rapl_path")
322
322
-
current_time=$(date +%s%N)
323
323
-
324
324
-
if [ -f "$state_file" ]; then
325
325
-
read -r prev_energy prev_time < "$state_file"
326
326
-
327
327
-
# Calculate power from energy difference
328
328
-
energy_diff=$((current_energy - prev_energy))
329
329
-
time_diff=$((current_time - prev_time))
330
330
-
331
331
-
# Handle counter wrap-around
332
332
-
if [ "$energy_diff" -lt 0 ]; then
333
333
-
max_energy=$(cat /sys/class/powercap/intel-rapl:0/max_energy_range_uj 2>/dev/null || echo 0)
334
334
-
energy_diff=$((energy_diff + max_energy))
335
335
-
fi
336
336
-
337
337
-
if [ "$time_diff" -gt 0 ]; then
338
338
-
# energy_diff is in microjoules, time_diff is in nanoseconds
339
339
-
# watts = microjoules / (nanoseconds / 1e9) / 1e6 = microjoules * 1000 / nanoseconds
340
340
-
watts=$(echo "scale=1; $energy_diff * 1000 / $time_diff" | bc)
341
341
-
else
342
342
-
watts="0"
343
343
-
fi
344
344
-
else
345
345
-
watts="0"
346
346
-
fi
347
347
-
348
348
-
# Save current state
349
349
-
echo "$current_energy $current_time" > "$state_file"
350
350
-
351
351
-
jq -n --argjson watts "$watts" --argjson charging "$charging" '{watts: $watts, charging: $charging}'
352
352
-
exit 0
353
353
-
fi
354
354
-
355
355
-
# Fallback: use battery power_now (only accurate when discharging)
356
356
-
bat_path=""
357
357
-
for p in /sys/class/power_supply/BAT* /sys/class/power_supply/BATT*; do
358
358
-
if [ -f "$p/power_now" ]; then
359
359
-
bat_path="$p"
360
360
-
break
361
361
-
fi
362
362
-
done
363
363
-
364
364
-
if [ -z "$bat_path" ]; then
365
365
-
echo '{"watts": 0, "charging": false}'
366
366
-
exit 0
367
367
-
fi
368
368
-
369
369
-
power_now=$(cat "$bat_path/power_now" 2>/dev/null || echo 0)
370
370
-
watts=$(echo "scale=1; $power_now / 1000000" | bc)
371
371
-
372
372
-
jq -n --argjson watts "$watts" --argjson charging "$charging" '{watts: $watts, charging: $charging}'
373
373
-
'';
374
374
-
};
375
375
-
376
376
-
batteryScript = pkgs.writeShellApplication {
377
377
-
name = "eww-battery";
378
378
-
runtimeInputs = [
379
379
-
pkgs.jq
380
380
-
pkgs.bc
381
381
-
];
382
382
-
text = ''
383
383
-
# Find battery device dynamically
384
384
-
bat_path=""
385
385
-
for p in /sys/class/power_supply/BAT* /sys/class/power_supply/BATT*; do
386
386
-
if [ -f "$p/capacity" ]; then
387
387
-
bat_path="$p"
388
388
-
break
389
389
-
fi
390
390
-
done
391
391
-
392
392
-
if [ -z "$bat_path" ]; then
393
393
-
echo '{"capacity": "N/A", "icon": "", "watts": "0", "time_remaining": "N/A"}'
394
394
-
exit 0
395
395
-
fi
396
396
-
397
397
-
capacity=$(cat "$bat_path/capacity" 2>/dev/null || echo 100)
398
398
-
status=$(cat "$bat_path/status" 2>/dev/null || echo "Full")
399
399
-
power_now=$(cat "$bat_path/power_now" 2>/dev/null || echo 0)
400
400
-
energy_now=$(cat "$bat_path/energy_now" 2>/dev/null || echo 0)
401
401
-
energy_full=$(cat "$bat_path/energy_full" 2>/dev/null || echo 0)
402
402
-
403
403
-
# Convert microwatts to watts
404
404
-
watts=$(echo "scale=1; $power_now / 1000000" | bc)
405
405
-
406
406
-
# Calculate time remaining
407
407
-
if [ "$power_now" -gt 0 ]; then
408
408
-
if [ "$status" = "Charging" ]; then
409
409
-
# Time to full
410
410
-
remaining_energy=$((energy_full - energy_now))
411
411
-
hours=$(echo "scale=2; $remaining_energy / $power_now" | bc)
412
412
-
else
413
413
-
# Time to empty
414
414
-
hours=$(echo "scale=2; $energy_now / $power_now" | bc)
415
415
-
fi
416
416
-
# Convert to hours:minutes
417
417
-
# Note: bc outputs ".76" for values < 1, so cut returns empty string
418
418
-
h=$(echo "$hours" | cut -d. -f1)
419
419
-
h=''${h:-0} # Default to 0 if empty (i.e., less than 1 hour)
420
420
-
m=$(echo "scale=0; ($hours - $h) * 60 / 1" | bc)
421
421
-
time_remaining="''${h}h ''${m}m"
422
422
-
else
423
423
-
time_remaining="--"
424
424
-
fi
425
425
-
426
426
-
if [ "$status" = "Charging" ]; then
427
427
-
icon=""
428
428
-
elif [ "$status" = "Full" ]; then
429
429
-
icon=""
430
430
-
elif [ "$capacity" -gt 80 ]; then
431
431
-
icon=""
432
432
-
elif [ "$capacity" -gt 60 ]; then
433
433
-
icon=""
434
434
-
elif [ "$capacity" -gt 40 ]; then
435
435
-
icon=""
436
436
-
elif [ "$capacity" -gt 20 ]; then
437
437
-
icon=""
438
438
-
else
439
439
-
icon=""
440
440
-
fi
441
441
-
jq -n --arg cap "$capacity" --arg icon "$icon" --arg watts "$watts" --arg time "$time_remaining" --arg status "$status" \
442
442
-
'{capacity: $cap, icon: $icon, watts: $watts, time_remaining: $time, status: $status}'
443
443
-
'';
444
444
-
};
445
445
-
446
446
-
volumeScript = pkgs.writeShellApplication {
447
447
-
name = "eww-volume";
448
448
-
runtimeInputs = [
449
449
-
pkgs.pulseaudio
450
450
-
pkgs.jq
451
451
-
pkgs.gnugrep
452
452
-
];
453
453
-
text = ''
454
454
-
vol=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -oP '\d+%' | head -1 | tr -d '%')
455
455
-
muted=$(pactl get-sink-mute @DEFAULT_SINK@ | grep -oP '(yes|no)')
456
456
-
if [ "$muted" = "yes" ]; then
457
457
-
icon=""
458
458
-
elif [ "$vol" -gt 50 ]; then
459
459
-
icon=""
460
460
-
elif [ "$vol" -gt 0 ]; then
461
461
-
icon=""
462
462
-
else
463
463
-
icon=""
464
464
-
fi
465
465
-
jq -n --arg level "$vol" --arg icon "$icon" '{level: $level, icon: $icon}'
466
466
-
'';
467
467
-
};
468
468
-
469
469
-
volumeAdjustScript = pkgs.writeShellApplication {
470
470
-
name = "eww-volume-adjust";
471
471
-
runtimeInputs = [ pkgs.pulseaudio ];
472
472
-
text = ''
473
473
-
direction="$1"
474
474
-
if [ "$direction" = "up" ]; then
475
475
-
pactl set-sink-volume @DEFAULT_SINK@ +5%
476
476
-
else
477
477
-
pactl set-sink-volume @DEFAULT_SINK@ -5%
478
478
-
fi
479
479
-
'';
480
480
-
};
481
481
-
482
482
-
networkScript = pkgs.writeShellApplication {
483
483
-
name = "eww-network";
484
484
-
runtimeInputs = [ pkgs.networkmanager ];
485
485
-
text = ''
486
486
-
connection=$(nmcli -t -f NAME,TYPE,DEVICE connection show --active 2>/dev/null | head -1)
487
487
-
if [ -z "$connection" ]; then
488
488
-
echo " Disconnected"
489
489
-
else
490
490
-
name=$(echo "$connection" | cut -d: -f1)
491
491
-
type=$(echo "$connection" | cut -d: -f2)
492
492
-
if [ "$type" = "802-11-wireless" ]; then
493
493
-
echo " $name"
494
494
-
else
495
495
-
echo " $name"
496
496
-
fi
497
497
-
fi
498
498
-
'';
499
499
-
};
500
500
-
501
501
-
workspacesScript = pkgs.writeShellApplication {
502
502
-
name = "sway-workspaces";
503
503
-
runtimeInputs = [
504
504
-
pkgs.sway
505
505
-
pkgs.jq
506
506
-
];
507
507
-
text = ''
508
508
-
# Output initial state
509
509
-
swaymsg -t get_workspaces | jq -c '[.[] | {name: .name, focused: .focused, urgent: .urgent}]'
510
510
-
511
511
-
# Subscribe to workspace events and output updated state
512
512
-
swaymsg -t subscribe -m '["workspace"]' | while read -r _; do
513
513
-
swaymsg -t get_workspaces | jq -c '[.[] | {name: .name, focused: .focused, urgent: .urgent}]'
514
514
-
done
515
515
-
'';
516
516
-
};
517
517
-
518
518
-
brightnessScript = pkgs.writeShellApplication {
519
519
-
name = "eww-brightness";
520
520
-
runtimeInputs = [ pkgs.brightnessctl ];
521
521
-
text = ''
522
522
-
brightnessctl -m | cut -d, -f4 | tr -d '%'
523
523
-
'';
524
524
-
};
525
525
-
526
526
-
idleToggleScript = pkgs.writeShellApplication {
527
527
-
name = "eww-idle-toggle";
528
528
-
runtimeInputs = [ pkgs.systemd ];
529
529
-
text = ''
530
530
-
if systemctl --user is-active --quiet sway-idle-inhibit.service; then
531
531
-
systemctl --user stop sway-idle-inhibit.service
532
532
-
else
533
533
-
systemctl --user start sway-idle-inhibit.service
534
534
-
fi
535
535
-
'';
536
536
-
};
537
537
-
538
538
-
idleStatusScript = pkgs.writeShellApplication {
539
539
-
name = "eww-idle-status";
540
540
-
runtimeInputs = [ pkgs.systemd ];
541
541
-
text = ''
542
542
-
if systemctl --user is-active --quiet sway-idle-inhibit.service; then
543
543
-
echo "true"
544
544
-
else
545
545
-
echo "false"
546
546
-
fi
547
547
-
'';
548
548
-
};
549
549
-
550
550
-
# Power profile state file (written by power-profile tool, read by eww)
551
551
-
powerProfileStateFile = "/tmp/power-profile-state";
552
552
-
553
553
-
powerProfileStatusScript = pkgs.writeShellApplication {
554
554
-
name = "eww-power-profile-status";
555
555
-
runtimeInputs = [ pkgs.jq ];
556
556
-
text = ''
557
557
-
state_file="${powerProfileStateFile}"
558
558
-
if [ -f "$state_file" ]; then
559
559
-
read -r name tdp < "$state_file"
560
560
-
else
561
561
-
name="unknown"
562
562
-
tdp="?"
563
563
-
fi
564
564
-
jq -n --arg name "$name" --arg tdp "$tdp" '{name: $name, tdp: $tdp}'
565
565
-
'';
566
566
-
};
567
567
-
568
568
-
powerProfileCycleScript = pkgs.writeShellApplication {
569
569
-
name = "eww-power-profile-cycle";
570
570
-
runtimeInputs = [ pkgs.libnotify ];
571
571
-
text = ''
572
572
-
state_file="${powerProfileStateFile}"
573
573
-
574
574
-
# Profile names (must match power-profile tool)
575
575
-
profiles=("low" "normal" "high")
576
576
-
577
577
-
# Read current profile from state file
578
578
-
current="unknown"
579
579
-
if [ -f "$state_file" ]; then
580
580
-
read -r current _ < "$state_file"
581
581
-
fi
582
582
-
583
583
-
# Find next profile (cycle through)
584
584
-
next_idx=0
585
585
-
for i in "''${!profiles[@]}"; do
586
586
-
if [ "''${profiles[$i]}" = "$current" ]; then
587
587
-
next_idx=$(( (i + 1) % ''${#profiles[@]} ))
588
588
-
break
589
589
-
fi
590
590
-
done
591
591
-
592
592
-
next="''${profiles[$next_idx]}"
593
593
-
594
594
-
# Use the power-profile tool (uses sudo internally, writes state file)
595
595
-
if /run/current-system/sw/bin/power-profile "$next" >/dev/null 2>&1; then
596
596
-
notify-send -t 2000 "Power Profile" "Set to $next"
597
597
-
else
598
598
-
notify-send -t 2000 "Power Profile" "Failed to set profile"
599
599
-
fi
600
600
-
'';
601
601
-
};
602
602
-
603
603
-
ewwConfigDir = pkgs.runCommand "eww-config" { } ''
604
604
-
mkdir -p $out
605
605
-
cp ${ewwYuck} $out/eww.yuck
606
606
-
cp ${ewwScss} $out/eww.scss
607
607
-
'';
608
608
-
609
609
-
in
610
610
-
{
611
611
-
# ryzenadj and power-profile for power profile control
612
612
-
environment.systemPackages = [
613
613
-
pkgs.ryzenadj
614
614
-
self.packages.${pkgs.system}.power-profile
615
615
-
];
616
616
-
617
617
-
# Allow user to run ryzenadj without password (for power profile switching)
618
618
-
security.sudo.extraRules = [
619
619
-
{
620
620
-
users = [ config.users.users.mainUser.name ];
621
621
-
commands = [
622
622
-
{
623
623
-
command = "/run/current-system/sw/bin/ryzenadj";
624
624
-
options = [ "NOPASSWD" ];
625
625
-
}
626
626
-
];
627
627
-
}
628
628
-
];
629
629
-
630
630
-
# Make RAPL energy counters readable for power monitoring
631
631
-
# Works on both Intel and AMD Zen CPUs (via intel_rapl_msr module)
632
632
-
services.udev.extraRules = ''
633
633
-
SUBSYSTEM=="powercap", ACTION=="add", RUN+="${pkgs.coreutils}/bin/chmod a+r /sys/class/powercap/%k/energy_uj"
634
634
-
'';
635
635
-
636
636
-
# eww daemon
637
637
-
systemd.user.services.eww = {
638
638
-
description = "ElKowars Wacky Widgets daemon";
639
639
-
partOf = [ "sway-session.target" ];
640
640
-
wantedBy = [ "sway-session.target" ];
641
641
-
path = [
642
642
-
pkgs.bash
643
643
-
pkgs.sway
644
644
-
];
645
645
-
environment.EWW_CONFIG = "${ewwConfigDir}";
646
646
-
serviceConfig = {
647
647
-
Type = "simple";
648
648
-
ExecStart = "${lib.getExe pkgs.eww} daemon --config ${ewwConfigDir} --no-daemonize";
649
649
-
ExecStop = "${lib.getExe pkgs.eww} --config ${ewwConfigDir} kill";
650
650
-
Restart = "on-failure";
651
651
-
RestartSec = 1;
652
652
-
};
653
653
-
};
654
654
-
655
655
-
# Idle inhibit service - toggled by eww button
656
656
-
systemd.user.services.sway-idle-inhibit = {
657
657
-
description = "Inhibit idle/sleep";
658
658
-
serviceConfig = {
659
659
-
Type = "simple";
660
660
-
ExecStart = "${pkgs.systemd}/bin/systemd-inhibit --what=idle:sleep --who=eww --why='User requested' --mode=block sleep infinity";
661
661
-
};
662
662
-
};
663
663
-
664
664
-
# eww bar per output - template unit using output name (e.g. eww-bar@eDP-1.service)
665
665
-
systemd.user.services."eww-bar@" = {
666
666
-
description = "Eww bar on output %i";
667
667
-
partOf = [ "sway-session.target" ];
668
668
-
after = [ "eww.service" ];
669
669
-
requires = [ "eww.service" ];
670
670
-
serviceConfig = {
671
671
-
Type = "oneshot";
672
672
-
RemainAfterExit = true;
673
673
-
ExecStart = "${pkgs.eww}/bin/eww --config ${ewwConfigDir} open bar --id bar-%i --arg screen=%i";
674
674
-
ExecStop = "${pkgs.eww}/bin/eww --config ${ewwConfigDir} close bar-%i";
675
675
-
};
676
676
-
};
677
677
-
678
678
-
# Watches for output changes and starts/stops eww-bar@ instances
679
679
-
systemd.user.services.eww-output-watcher = {
680
680
-
description = "Watch for output changes and manage eww bars";
681
681
-
partOf = [ "sway-session.target" ];
682
682
-
wantedBy = [ "sway-session.target" ];
683
683
-
after = [ "eww.service" ];
684
684
-
requires = [ "eww.service" ];
685
685
-
serviceConfig = {
686
686
-
Type = "simple";
687
687
-
ExecStart = lib.getExe (
688
688
-
pkgs.writeShellApplication {
689
689
-
name = "eww-output-watcher";
690
690
-
runtimeInputs = [
691
691
-
pkgs.sway
692
692
-
pkgs.jq
693
693
-
pkgs.systemd
694
694
-
pkgs.gawk
695
695
-
pkgs.gnused
696
696
-
pkgs.gnugrep
697
697
-
];
698
698
-
text = ''
699
699
-
update_bars() {
700
700
-
# Get current outputs
701
701
-
outputs=$(swaymsg -t get_outputs | jq -r '.[].name')
702
702
-
703
703
-
# Start bars for connected outputs
704
704
-
for output in $outputs; do
705
705
-
systemctl --user start "eww-bar@$output.service" || true
706
706
-
done
707
707
-
708
708
-
# Stop bars for disconnected outputs
709
709
-
running=$(systemctl --user list-units --type=service --state=running --plain --no-legend 'eww-bar@*' | awk '{print $1}' | sed 's/eww-bar@\(.*\)\.service/\1/')
710
710
-
for output in $running; do
711
711
-
if ! echo "$outputs" | grep -qx "$output"; then
712
712
-
systemctl --user stop "eww-bar@$output.service" || true
713
713
-
fi
714
714
-
done
715
715
-
}
716
716
-
717
717
-
update_bars
718
718
-
swaymsg -t subscribe -m '["output"]' | while read -r _; do
719
719
-
sleep 0.5
720
720
-
update_bars
721
721
-
done
722
722
-
'';
723
723
-
}
724
724
-
);
725
725
-
Restart = "on-failure";
726
726
-
RestartSec = 1;
727
727
-
};
728
728
-
};
729
729
-
730
730
-
}
-6
configs/services/coms/default.nix
Reviewed
···
1
1
-
{
2
2
-
imports = [
3
3
-
./jitsi.nix
4
4
-
./murmur.nix
5
5
-
];
6
6
-
}
-31
configs/services/coms/murmur.nix
Reviewed
···
1
1
-
{ ... }:
2
2
-
{
3
3
-
security.acme.acceptTerms = true;
4
4
-
5
5
-
services.murmur = {
6
6
-
enable = true;
7
7
-
# allowHtml = false;
8
8
-
bandwidth = 10000000;
9
9
-
registerName = "lassul.us";
10
10
-
autobanTime = 30;
11
11
-
sslCert = "/var/lib/acme/lassul.us/cert.pem";
12
12
-
sslKey = "/var/lib/acme/lassul.us/key.pem";
13
13
-
extraConfig = ''
14
14
-
opusthreshold=0
15
15
-
# rememberchannelduration=10000
16
16
-
'';
17
17
-
};
18
18
-
networking.firewall.allowedTCPPorts = [ 64738 ];
19
19
-
networking.firewall.allowedUDPPorts = [ 64738 ];
20
20
-
21
21
-
services.nginx.virtualHosts."lassul.us" = {
22
22
-
enableACME = true;
23
23
-
};
24
24
-
security.acme.certs."lassul.us" = {
25
25
-
group = "lasscert";
26
26
-
};
27
27
-
users.groups.lasscert.members = [
28
28
-
"nginx"
29
29
-
"murmur"
30
30
-
];
31
31
-
}
-29
configs/services/git/default.nix
Reviewed
···
1
1
-
{ config, pkgs, ... }:
2
2
-
{
3
3
-
imports = [
4
4
-
../../git.nix
5
5
-
];
6
6
-
services.nginx.virtualHosts."cgit.lassul.us" = {
7
7
-
enableACME = true;
8
8
-
addSSL = true;
9
9
-
locations = config.services.nginx.virtualHosts.cgit.locations;
10
10
-
extraConfig = ''
11
11
-
client_max_body_size 300M;
12
12
-
client_body_timeout 2024;
13
13
-
client_header_timeout 2024;
14
14
-
15
15
-
fastcgi_buffers 16 512k;
16
16
-
fastcgi_buffer_size 512k;
17
17
-
fastcgi_read_timeout 500;
18
18
-
fastcgi_send_timeout 500;
19
19
-
'';
20
20
-
};
21
21
-
systemd.tmpfiles.settings."cgit"."/tmp/cgit".d = {
22
22
-
mode = "0755";
23
23
-
user = "git";
24
24
-
group = "git";
25
25
-
};
26
26
-
krebs.git.cgit.fcgiwrap.group.name = "git";
27
27
-
krebs.git.cgit.fcgiwrap.user.name = "git";
28
28
-
krebs.git.cgit.fcgiwrap.user.home = toString pkgs.emptyDirectory;
29
29
-
}
-23
configs/services/git/proxy.nix
Reviewed
···
1
1
-
{ ... }:
2
2
-
{
3
3
-
services.nginx.virtualHosts."cgit.lassul.us" = {
4
4
-
forceSSL = true;
5
5
-
enableACME = true;
6
6
-
acmeFallbackHost = "orange.r";
7
7
-
locations."/" = {
8
8
-
proxyPass = "http://orange.r";
9
9
-
proxyWebsockets = true;
10
10
-
recommendedProxySettings = true;
11
11
-
};
12
12
-
extraConfig = ''
13
13
-
client_max_body_size 300M;
14
14
-
client_body_timeout 2024;
15
15
-
client_header_timeout 2024;
16
16
-
17
17
-
fastcgi_buffers 16 512k;
18
18
-
fastcgi_buffer_size 512k;
19
19
-
fastcgi_read_timeout 500;
20
20
-
fastcgi_send_timeout 500;
21
21
-
'';
22
22
-
};
23
23
-
}
-25
configs/services/nixcache/default.nix
Reviewed
···
1
1
-
{ config, pkgs, ... }:
2
2
-
{
3
3
-
nixpkgs.config.packageOverrides = p: {
4
4
-
nix-serve = p.haskellPackages.nix-serve-ng;
5
5
-
};
6
6
-
7
7
-
services.nix-serve = {
8
8
-
enable = true;
9
9
-
port = 5005;
10
10
-
secretKeyFile = "${config.krebs.secret.directory}/nix-serve.key";
11
11
-
};
12
12
-
13
13
-
clan.core.vars.generators.nix-serve = {
14
14
-
files."nix-serve.key" = { };
15
15
-
files."nix-serve.pub".secret = false;
16
16
-
runtimeInputs = with pkgs; [
17
17
-
coreutils
18
18
-
nix
19
19
-
];
20
20
-
script = ''
21
21
-
exit 1 # Manual migration required from facts to vars
22
22
-
nix-store --generate-binary-cache-key cache.${config.networking.hostName} "$out"/nix-serve.key "$out"/nix-serve.pub
23
23
-
'';
24
24
-
};
25
25
-
}
-39
configs/services/site/default.nix
Reviewed
···
1
1
-
{ config, pkgs, ... }:
2
2
-
{
3
3
-
security.acme = {
4
4
-
certs."lassul.us" = {
5
5
-
group = "lasscert";
6
6
-
};
7
7
-
};
8
8
-
9
9
-
users.groups.lasscert.members = [
10
10
-
"nginx"
11
11
-
];
12
12
-
13
13
-
services.nginx.virtualHosts."lassul.us" = {
14
14
-
addSSL = true;
15
15
-
enableACME = true;
16
16
-
default = true;
17
17
-
locations."/".extraConfig = ''
18
18
-
root /srv/http/lassul.us;
19
19
-
'';
20
20
-
locations."= /hosts".extraConfig = ''
21
21
-
alias ${pkgs.krebs-hosts_combined};
22
22
-
'';
23
23
-
locations."= /retiolum.hosts".extraConfig = ''
24
24
-
alias ${pkgs.krebs-hosts-retiolum};
25
25
-
'';
26
26
-
locations."= /wireguard-key".extraConfig = ''
27
27
-
alias ${pkgs.writeText "neoprism.wg" config.krebs.hosts.neoprism.nets.wiregrill.wireguard.pubkey};
28
28
-
'';
29
29
-
locations."= /ssh.pub".extraConfig = ''
30
30
-
alias ${pkgs.writeText "pub" config.krebs.users.lass-yubikey.pubkey};
31
31
-
'';
32
32
-
locations."= /gpg.pub".extraConfig = ''
33
33
-
alias ${pkgs.writeText "pub" config.krebs.users.lass-yubikey.pgp.pubkeys.default};
34
34
-
'';
35
35
-
locations."= /ip".extraConfig = ''
36
36
-
return 200 '$remote_addr';
37
37
-
'';
38
38
-
};
39
39
-
}