-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add basic declarative syncthing configuration
Syncs default folder and custom Steam artwork with my server for now Also adds syncthingtray
- Loading branch information
Showing
5 changed files
with
226 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
{ | ||
lib, | ||
pkgs, | ||
... | ||
} @ args: let | ||
# inherit (inputs.home-manager.lib) hm; | ||
inherit (pkgs) syncthingtray; | ||
syncthing = args.osConfig.services.syncthing.package; | ||
in | ||
lib.mkIf (args ? osConfig && args.osConfig.services.syncthing.enable) { | ||
services.syncthing.tray.enable = true; | ||
systemd.user.services.syncthingtray = { | ||
Service.ExecStartPre = pkgs.writeShellScript "setup-syncthingtray" '' | ||
cat <<EOF >> ~/.config/syncthingtray.ini | ||
[General] | ||
v=${pkgs.syncthingtray.version} | ||
[startup] | ||
considerForReconnect=false | ||
considerLauncherForReconnect=false | ||
showButton=false | ||
showLauncherButton=false | ||
stopOnMetered=false | ||
stopServiceOnMetered=false | ||
syncthingArgs="serve --no-browser --logflags=3" | ||
syncthingAutostart=false | ||
syncthingPath=syncthing | ||
syncthingUnit=syncthing.service | ||
systemUnit=false | ||
useLibSyncthing=false | ||
[tray] | ||
connections\1\apiKey=@ByteArray($(${syncthing}/bin/syncthing cli config dump-json | nu --stdin --commands 'from json | get gui.apiKey')) | ||
connections\1\authEnabled=false | ||
connections\1\autoConnect=true | ||
connections\1\devStatsPollInterval=60000 | ||
connections\1\diskEventLimit=200 | ||
connections\1\errorsPollInterval=30000 | ||
connections\1\httpsCertPath=/home/lpchaim/.config/syncthing/https-cert.pem | ||
connections\1\label=Primary instance | ||
connections\1\longPollingTimeout=0 | ||
connections\1\password= | ||
connections\1\pauseOnMetered=false | ||
connections\1\reconnectInterval=30000 | ||
connections\1\requestTimeout=0 | ||
connections\1\statusComputionFlags=59 | ||
connections\1\syncthingUrl=http://127.0.0.1:8384 | ||
connections\1\trafficPollInterval=5000 | ||
connections\1\userName= | ||
connections\size=1 | ||
dbusNotifications=true | ||
distinguishTrayIcons=false | ||
frameStyle=16 | ||
ignoreInavailabilityAfterStart=15 | ||
notifyOnDisconnect=true | ||
notifyOnErrors=true | ||
notifyOnLauncherErrors=true | ||
notifyOnLocalSyncComplete=false | ||
notifyOnNewDeviceConnects=false | ||
notifyOnNewDirectoryShared=false | ||
notifyOnRemoteSyncComplete=false | ||
positioning\assumedIconPos=@Point(0 0) | ||
positioning\useAssumedIconPosition=false | ||
positioning\useCursorPos=true | ||
preferIconsFromTheme=false | ||
showSyncthingNotifications=true | ||
showTabTexts=true | ||
showTraffic=true | ||
statusIcons="#ff26b6db,#ff0882c8,#ffffffff;#ffdb3c26,#ffc80828,#ffffffff;#ffc9ce3b,#ffebb83b,#ffffffff;#ff2d9d69,#ff2d9d69,#ffffffff;#ff26b6db,#ff0882c8,#ffffffff;#ff26b6db,#ff0882c8,#ffffffff;#ffa9a9a9,#ff58656c,#ffffffff;#ffa9a9a9,#ff58656c,#ffffffff" | ||
statusIconsRenderSize=@Size(32 32) | ||
statusIconsStrokeWidth=0 | ||
tabPos=1 | ||
trayIcons="#ff26b6db,#ff0882c8,#ffffffff;#ffdb3c26,#ffc80828,#ffffffff;#ffc9ce3b,#ffebb83b,#ffffffff;#ff2d9d69,#ff2d9d69,#ffffffff;#ff26b6db,#ff0882c8,#ffffffff;#ff26b6db,#ff0882c8,#ffffffff;#ffa9a9a9,#ff58656c,#ffffffff;#ffa9a9a9,#ff58656c,#ffffffff" | ||
trayIconsRenderSize=@Size(32 32) | ||
trayIconsStrokeWidth=0 | ||
trayMenuSize=@Size(575 475) | ||
usePaletteForStatusIcons=false | ||
usePaletteForTrayIcons=false | ||
windowType=0 | ||
[webview] | ||
customCommand= | ||
disabled=false | ||
mode=0 | ||
qt\customfont=false | ||
qt\customicontheme=false | ||
qt\customlocale=false | ||
qt\custompalette=false | ||
qt\customstylesheet=false | ||
qt\customwidgetstyle=false | ||
qt\font="Sans Serif,9,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" | ||
qt\icontheme=hicolor | ||
qt\iconthemepath= | ||
qt\locale=en_US | ||
qt\palette=@Variant(\0\0\0\x44\x1\x1\xff\xff\0\0\0\0\0\0\0\0\x1\x1\xff\xff\xef\xef\xef\xef\xef\xef\0\0\x1\x1\xff\xff\xff\xff\xff\xff\xff\xff\0\0\x1\x1\xff\xff\xcb\x4\xcb\x4\xcb\x4\0\0\x1\x1\xff\xff\x9f\xf4\x9f\xf4\x9f\xf4\0\0\x1\x1\xff\xff\xb8\x90\xb8\x90\xb8\x90\0\0\x1\x1\xff\xff\0\0\0\0\0\0\0\0\x1\x1\xff\xff\xff\xff\xff\xff\xff\xff\0\0\x1\x1\xff\xff\0\0\0\0\0\0\0\0\x1\x1\xff\xff\xff\xff\xff\xff\xff\xff\0\0\x1\x1\xff\xff\xef\xef\xef\xef\xef\xef\0\0\x1\x1\xff\xffv{v{v{\0\0\x1\x1\xff\xff\x30\x30\x8c\x8c\xc6\xc6\0\0\x1\x1\xff\xff\xff\xff\xff\xff\xff\xff\0\0\x1\x1\xff\xff\0\0\0\0\xff\xff\0\0\x1\x1\xff\xff\xff\xff\0\0\xff\xff\0\0\x1\x1\xff\xff\xf7\xf7\xf7\xf7\xf7\xf7\0\0\x1\x1\xff\xff\xbe\xbe\xbe\xbe\xbe\xbe\0\0\x1\x1\xff\xff\xef\xef\xef\xef\xef\xef\0\0\x1\x1\xff\xff\xff\xff\xff\xff\xff\xff\0\0\x1\x1\xff\xff\xcb\x4\xcb\x4\xcb\x4\0\0\x1\x1\xff\xff\xbe\xbe\xbe\xbe\xbe\xbe\0\0\x1\x1\xff\xff\xb8\x90\xb8\x90\xb8\x90\0\0\x1\x1\xff\xff\xbe\xbe\xbe\xbe\xbe\xbe\0\0\x1\x1\xff\xff\xff\xff\xff\xff\xff\xff\0\0\x1\x1\xff\xff\xbe\xbe\xbe\xbe\xbe\xbe\0\0\x1\x1\xff\xff\xef\xef\xef\xef\xef\xef\0\0\x1\x1\xff\xff\xef\xef\xef\xef\xef\xef\0\0\x1\x1\xff\xff\xb1\xb8\xb1\xb8\xb1\xb8\0\0\x1\x1\xff\xff\x91\x91\x91\x91\x91\x91\0\0\x1\x1\xff\xff\xff\xff\xff\xff\xff\xff\0\0\x1\x1\xff\xff\0\0\0\0\xff\xff\0\0\x1\x1\xff\xff\xff\xff\0\0\xff\xff\0\0\x1\x1\xff\xff\xf7\xf7\xf7\xf7\xf7\xf7\0\0\x1\x1\xff\xff\0\0\0\0\0\0\0\0\x1\x1\xff\xff\xef\xef\xef\xef\xef\xef\0\0\x1\x1\xff\xff\xff\xff\xff\xff\xff\xff\0\0\x1\x1\xff\xff\xcb\x4\xcb\x4\xcb\x4\0\0\x1\x1\xff\xff\x9f\xf4\x9f\xf4\x9f\xf4\0\0\x1\x1\xff\xff\xb8\x90\xb8\x90\xb8\x90\0\0\x1\x1\xff\xff\0\0\0\0\0\0\0\0\x1\x1\xff\xff\xff\xff\xff\xff\xff\xff\0\0\x1\x1\xff\xff\0\0\0\0\0\0\0\0\x1\x1\xff\xff\xff\xff\xff\xff\xff\xff\0\0\x1\x1\xff\xff\xef\xef\xef\xef\xef\xef\0\0\x1\x1\xff\xffv{v{v{\0\0\x1\x1\xff\xff\x30\x30\x8c\x8c\xc6\xc6\0\0\x1\x1\xff\xff\xff\xff\xff\xff\xff\xff\0\0\x1\x1\xff\xff\0\0\0\0\xff\xff\0\0\x1\x1\xff\xff\xff\xff\0\0\xff\xff\0\0\x1\x1\xff\xff\xf7\xf7\xf7\xf7\xf7\xf7\0\0) | ||
qt\plugindir= | ||
qt\stylesheetpath= | ||
qt\trpath= | ||
qt\widgetstyle= | ||
EOF | ||
''; | ||
Unit.X-Restart-Triggers = [syncthing syncthingtray]; | ||
Unit.X-SwitchMethod = "restart"; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{ | ||
config, | ||
inputs, | ||
lib, | ||
... | ||
}: let | ||
inherit (lib.lpchaim.shared) defaults; | ||
|
||
home = "/home/${defaults.name.user}"; | ||
sopsFile = "${inputs.self}/secrets/hosts/${config.networking.hostName}.yaml"; | ||
in | ||
lib.mkIf (lib.pathExists sopsFile) { | ||
sops.secrets = { | ||
"syncthing/cert" = { | ||
inherit sopsFile; | ||
mode = "0440"; | ||
}; | ||
"syncthing/key" = { | ||
inherit sopsFile; | ||
mode = "0440"; | ||
}; | ||
}; | ||
|
||
systemd.services.syncthing.preStart = let | ||
paths = builtins.attrNames config.services.syncthing.settings.folders; | ||
commands = map (p: "mkdir -p '${p}'") paths; | ||
script = builtins.concatStringsSep "\n" commands; | ||
in | ||
script; | ||
|
||
services.syncthing = { | ||
enable = true; | ||
relay.enable = true; | ||
openDefaultPorts = true; | ||
user = defaults.name.user; | ||
group = defaults.name.user; | ||
cert = config.sops.secrets."syncthing/cert".path; | ||
key = config.sops.secrets."syncthing/key".path; | ||
dataDir = "${home}/Syncthing"; | ||
configDir = "${home}/.config/syncthing"; | ||
settings = { | ||
gui.theme = "black"; | ||
options.relaysEnabled = true; | ||
options.urAccepted = -1; | ||
startBrowser = false; | ||
folders = let | ||
allDevices = builtins.attrNames config.services.syncthing.settings.devices; | ||
in { | ||
"${home}/Sync" = { | ||
id = "default"; | ||
label = "Default Folder"; | ||
type = "sendreceive"; | ||
versioning = null; | ||
devices = allDevices; | ||
}; | ||
"${home}/.steam/steam/userdata/85204334/config/grid" = { | ||
id = "steam-custom-icons"; | ||
label = "Steam/Custom Icons"; | ||
type = "sendreceive"; | ||
versioning = null; | ||
devices = allDevices; | ||
}; | ||
}; | ||
devices = { | ||
desktop.id = "Q7UXFUW-Q4QWALL-AVBRBPW-Y2S44CV-IR4H3V4-OT2GH4V-6WCXBR4-STJXFQJ"; | ||
desktop.name = "Desktop"; | ||
server.id = "X5LHXQ6-NOCD2NO-RQ7FPLO-WFLLFRE-5BTTVL6-XLH3DAV-4ZIYI47-EEOVYAK"; | ||
server.name = "Server"; | ||
}; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
syncthing: | ||
cert: ENC[AES256_GCM,data:0WeUAZidnJXEDumpWQ+h/UsW6ae3kCPLtJKKbqK3IktVrkklE/3RPli+1q4IRZq0wvXwLIGFKYkynCZhxgM286ITo9rbCKv+Jg7Nz/1gNeExZ+dWgAlHwy5PTYBwp0TTBjwUxjxsIvpphvJwWil7LPbabBaeTY3sHmYvIcAD1hycQDwsLQL0h6Lj6dEZrzQYOg+NsdT9eL28xA1x4Ij/U3qAMHZViY2INpo1ZK+QBEQ3eIIF4/wyPFqHZxk6JqNYTiHr1K0d1HWFHrCWRI/Vke3nKFifnQ3OWAFGhr6edfFTQj9y8wZwZHUEBaNhmUwYdTOWoByL6uCzSiwOUwAz69Bfxt1yrPPEwmpZYwZ6ULmfFKTCtVJX1dIwna6xbVfDZiHrI6lWpKDfrTecDb28tXoKQHG9FauQwf/9XTc4Ny/LaHM0Pu/ovSE3R3aEF2rtELnMWRizrdzNNMq7E58OEvrRSDVLWWZiRLtHmCsmWdaY741EtQQ0tz+bZXEVKwIdxvrglq5eafQBKeW/VGbkYa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wRzQ8JgmZVQicfWQ==,type:str] | ||
sops: | ||
kms: [] | ||
gcp_kms: [] | ||
azure_kv: [] | ||
hc_vault: [] | ||
age: | ||
- recipient: age1tq2gcmu4hd4sd89hl7szhd0z8vg6tx9hk3xsvuljm9gsj7n0l4nsl6ad4u | ||
enc: | | ||
-----BEGIN AGE ENCRYPTED FILE----- | ||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBKdXc3R1NzOExVVTZhY0xJ | ||
OUhXNkZiN2pEdDFRUEJwMWM5cmYzSGFNVTFJCmlIQ1M0cEVJV0MySTM2amVhczJI | ||
YTFyR0ZyQ0dXV2xYUXJncHROTzBIWHcKLS0tIGpaM1A4TkllQTFFSEgrUFpVTWZC | ||
ZkZBSFRGSjBjZUlseXNpeGlDVzdRcE0KPs1GIdC02sW1+xw7dfx0ruXcR5VMhnxy | ||
86ioofd+eTyDXr7qAPZ/NBbwN5G/IMT0xxCzsX3oZ1PjM4VKre7eqQ== | ||
-----END AGE ENCRYPTED FILE----- | ||
- recipient: age10fa7ce7w6q0ppk5l2gvg6d02g9cmj26rpt00ct54d4latqsnwajs90a43h | ||
enc: | | ||
-----BEGIN AGE ENCRYPTED FILE----- | ||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBpbElDNG9VNkhiUzF4VXJB | ||
K1JMb2ZHSCtsTHdjeFJzMEpiRmxGQUl6NVhVCnZNS3AwWTNITERueGpGZEFjckF2 | ||
aStwcUs3QTk4YTY5Q08wWm1IeG1aZUUKLS0tIDdITEdUamZIM0N4bk10Vk92V0lJ | ||
bTY5dnczdTdkRVBVT0t1ZklyUDd6YWsKwwuYi45ibAA0WEXBYupTeeo2DUy2ZhGW | ||
XUglq1UB4Jynps8D7BlFrCnvdJ/d2rfQXkfYZ5MV6MSqtpbChNCCHA== | ||
-----END AGE ENCRYPTED FILE----- | ||
- recipient: age1a90s9rr2t82vlx4q757pvqm88nh572567hssycczv2t5rjhzudmsvqdjuv | ||
enc: | | ||
-----BEGIN AGE ENCRYPTED FILE----- | ||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSB3aEpjdmxqbTAxbDAzWUxH | ||
RzhCZVl2Z2FtRmtxQkRvbkpJNkxIQnJjR0QwCldPSUVTM3NNVS9iS2g0bm12Zkxj | ||
WGZLalJKeUZVL0dGeDZZR3Fob092UlUKLS0tIDJkL1dwYVRDbThFb3JnbkRqbmlN | ||
cWRIeElnNWZqSzRZQWI3eEUvRVd5UjQKcN7ne7wQXcvKhqrNS1xe4wISn2Ykb5Yx | ||
EITcdR6FSX/v4TvTGxFiq5SJkxbssVzadoIzyPIxGiYaoeMY/hdCjw== | ||
-----END AGE ENCRYPTED FILE----- | ||
lastmodified: "2024-10-06T00:19:47Z" | ||
mac: ENC[AES256_GCM,data:T6EAlyxfQHNvEvqPo9RjHLkyTpSDo3w85MNnTjJoKH9MCcshb1UjbNacQ2NZa95562BTndKB+LU4U6iUf0P9q4nBif3M7GxXyFyObmflqOTpZvxKelsYawqF5aNRnQmAT2voen0EoQ9VYp7XLYKaeZgP5tk4qGqKfcvwmYzPI2c=,iv:XtyEWIwto7kQD1ba21YxWdzQaF3XPTrhvSLuzmvxWnc=,tag:yQvcEp/20xj1coTsg0nHuw==,type:str] | ||
pgp: [] | ||
unencrypted_suffix: _unencrypted | ||
version: 3.9.0 |