1
1
s @{ config , pkgs , lib , self , ... } :
2
+ let
3
+ modifier = "Mod4" ;
4
+ systemctl = lib . getExe' config . systemd . package "systemctl" ;
5
+ swaymsg = lib . getExe' config . myhomecfg . wayland . windowManager . sway . package "swaymsg" ;
6
+ status = lib . getExe config . myhomecfg . programs . i3status-rust . package ;
7
+ swayr = lib . getExe config . myhomecfg . programs . swayr . package ;
8
+ pavucontrol = lib . getExe pkgs . pavucontrol ;
9
+ grim = lib . getExe pkgs . grim ;
10
+ slurp = lib . getExe pkgs . slurp ;
11
+ status-config = "${ config . myhomecfg . xdg . configHome } /i3status-rust/config-default.toml" ;
12
+ wallpaper = self + "/resources/wallpapers/wr.jpg" ;
13
+ wpctl = lib . getExe' pkgs . wireplumber "wpctl" ;
14
+ bento = lib . getExe' self . packages . ${ pkgs . system } . bbscripts "bento" ;
15
+ curl = lib . getExe pkgs . curl ;
16
+ jq = lib . getExe pkgs . jq ;
17
+ swaylock = lib . getExe config . myhomecfg . programs . swaylock . package ;
18
+ loginctl = lib . getExe' pkgs . systemd "loginctl" ;
19
+ wl-copy = lib . getExe' pkgs . wl-clipboard "wl-copy" ;
20
+ fcitx5 = lib . getExe config . i18n . inputMethod . package ;
21
+ blueman-applet = lib . getExe' pkgs . blueman "blueman-applet" ;
22
+
23
+ monitor = {
24
+ main = "Dell Inc. DELL U2718QM MYPFK89J15HL" ;
25
+ internal = "California Institute of Technology 0x1303 Unknown" ;
26
+ headless = "HEADLESS-1" ;
27
+ } ;
28
+
29
+ queryCoin = symbol : {
30
+ block = "custom" ;
31
+ command = "${ curl } --silent https://api.coinbase.com/v2/prices/${ symbol } -USD/spot | ${ jq } -r .data.amount" ;
32
+ hide_when_empty = true ;
33
+ interval = 300 ;
34
+ format = " ${ symbol } $text " ;
35
+ } ;
36
+ in
2
37
lib . mkProfile s "sway"
3
38
{
4
39
myos . desktop . enable = true ;
@@ -35,40 +70,57 @@ lib.mkProfile s "sway"
35
70
} ;
36
71
} ;
37
72
38
- myhome = { config , lib , osConfig , ... } :
39
- let
40
- modifier = config . wayland . windowManager . sway . config . modifier ;
41
- status = lib . getExe config . programs . i3status-rust . package ;
42
- swayr = lib . getExe config . programs . swayr . package ;
43
- pavucontrol = lib . getExe pkgs . pavucontrol ;
44
- grim = lib . getExe pkgs . grim ;
45
- slurp = lib . getExe pkgs . slurp ;
46
- status-config = "${ config . xdg . configHome } /i3status-rust/config-default.toml" ;
47
- wallpaper = self + "/resources/wallpapers/wr.jpg" ;
48
- wpctl = lib . getExe' pkgs . wireplumber "wpctl" ;
49
- bento = lib . getExe' self . packages . ${ pkgs . system } . bbscripts "bento" ;
50
- curl = lib . getExe pkgs . curl ;
51
- jq = lib . getExe pkgs . jq ;
52
- swaylock = lib . getExe config . programs . swaylock . package ;
53
- loginctl = lib . getExe' pkgs . systemd "loginctl" ;
54
- wl-copy = lib . getExe' pkgs . wl-clipboard "wl-copy" ;
55
- fcitx5 = lib . getExe' osConfig . i18n . inputMethod . package "fcitx5" ;
56
- blueman-applet = lib . getExe' pkgs . blueman "blueman-applet" ;
57
-
58
- monitor = {
59
- main = "Dell Inc. DELL U2718QM MYPFK89J15HL" ;
60
- side = "ICD Inc GX259F Unknown" ;
61
- internal = "California Institute of Technology 0x1303 Unknown" ;
62
- } ;
73
+ sops . secrets . sunshine-pass = {
74
+ sopsFile = self + "/secrets/secrets.yaml" ;
75
+ } ;
63
76
64
- queryCoin = symbol : {
65
- block = "custom" ;
66
- command = "${ curl } --silent https://api.coinbase.com/v2/prices/${ symbol } -USD/spot | ${ jq } -r .data.amount" ;
67
- hide_when_empty = true ;
68
- interval = 300 ;
69
- format = " ${ symbol } $text " ;
70
- } ;
71
- in
77
+ sops . secrets . sunshine-salt = {
78
+ sopsFile = self + "/secrets/secrets.yaml" ;
79
+ } ;
80
+
81
+ sops . templates . sunshine-cred = {
82
+ content = builtins . toJSON {
83
+ username = config . myos . user . mainUser ;
84
+ password = config . sops . placeholder . sunshine-pass ;
85
+ salt = config . sops . placeholder . sunshine-salt ;
86
+ } ;
87
+ owner = config . myos . user . mainUser ;
88
+ } ;
89
+
90
+ services . sunshine = {
91
+ enable = true ;
92
+ # package = (lib.addPatches pkgs.sunshine [
93
+ # (pkgs.fetchpatch {
94
+ # url = "https://github.com/LizardByte/Sunshine/pull/2885.patch";
95
+ # hash = "sha256-bMFmnHGosFOfStbeTBHxdfkYHDZFoWytMuZ9+O6W0LQ=";
96
+ # })
97
+ # ]);
98
+ autoStart = false ;
99
+ capSysAdmin = true ;
100
+ openFirewall = true ;
101
+ settings = {
102
+ # TODO wait https://github.com/LizardByte/Sunshine/pull/2885
103
+ # output_name = monitor.headless;
104
+ output_name = 2 ;
105
+ credentials_file = config . sops . templates . sunshine-cred . path ;
106
+ } ;
107
+ applications = {
108
+ apps = [
109
+ {
110
+ name = "tablet monitor" ;
111
+ auto-detach = "true" ;
112
+ prep-cmd = [
113
+ {
114
+ do = "${ swaymsg } output HEADLESS-1 enable" ;
115
+ undo = "${ swaymsg } output HEADLESS-1 disable" ;
116
+ }
117
+ ] ;
118
+ }
119
+ ] ;
120
+ } ;
121
+ } ;
122
+
123
+ myhome = { config , lib , osConfig , ... } :
72
124
{
73
125
home . pointerCursor = {
74
126
package = pkgs . adwaita-icon-theme ;
@@ -205,17 +257,19 @@ lib.mkProfile s "sway"
205
257
} ;
206
258
207
259
config = {
260
+ inherit modifier ;
261
+
208
262
workspaceAutoBackAndForth = true ;
209
263
210
- modifier = "Mod4" ;
211
264
212
265
terminal = lib . getExe config . programs . alacritty . package ;
213
266
214
267
startup = [
215
268
{ command = "emacs" ; }
269
+ { command = "\" ${ swaymsg } create_output; ${ swaymsg } output ${ monitor . headless } disable\" " ; }
216
270
] ++ ( lib . optional config . services . kanshi . enable
217
271
# workaround for https://github.com/emersion/kanshi/issues/43
218
- { command = "systemctl --user restart kanshi.service" ; always = true ; }
272
+ { command = "${ systemctl } --user restart kanshi.service" ; always = true ; }
219
273
) ++ ( lib . optional osConfig . services . blueman . enable
220
274
{ command = "${ blueman-applet } " ; always = true ; }
221
275
) ++ ( lib . optional osConfig . i18n . inputMethod . enable
@@ -265,6 +319,10 @@ lib.mkProfile s "sway"
265
319
resolution = "2160x1350" ;
266
320
scale = "1.5" ;
267
321
} ;
322
+ "${ monitor . headless } " = {
323
+ resolution = "2800x1752@60Hz" ;
324
+ scale = "2.0" ;
325
+ } ;
268
326
} ;
269
327
270
328
workspaceOutputAssign = [
@@ -276,7 +334,7 @@ lib.mkProfile s "sway"
276
334
{ workspace = "6" ; output = monitor . internal ; }
277
335
{ workspace = "7" ; output = monitor . internal ; }
278
336
{ workspace = "8" ; output = monitor . internal ; }
279
- { workspace = "9" ; output = monitor . internal ; }
337
+ { workspace = "9" ; output = monitor . headless ; }
280
338
] ;
281
339
282
340
input = {
@@ -339,7 +397,7 @@ lib.mkProfile s "sway"
339
397
timeouts = [
340
398
{
341
399
timeout = 3600 ;
342
- command = "systemctl suspend" ;
400
+ command = "${ systemctl } suspend" ;
343
401
}
344
402
] ;
345
403
events = [
@@ -366,6 +424,10 @@ lib.mkProfile s "sway"
366
424
position = "0,0" ;
367
425
scale = 1.5 ;
368
426
}
427
+ {
428
+ criteria = "${ monitor . headless } " ;
429
+ status = "disable" ;
430
+ }
369
431
] ;
370
432
}
371
433
{
@@ -381,6 +443,10 @@ lib.mkProfile s "sway"
381
443
position = "1920,0" ;
382
444
scale = 1.5 ;
383
445
}
446
+ {
447
+ criteria = "${ monitor . headless } " ;
448
+ status = "disable" ;
449
+ }
384
450
] ;
385
451
}
386
452
] ;
0 commit comments