From patchwork Sun Mar 9 06:37:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zacchaeus Scheffer X-Patchwork-Id: 39962 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 2F2BE27BBEA; Sun, 9 Mar 2025 06:38:37 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED,URIBL_SBL_A autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 2A15027BBE2 for ; Sun, 9 Mar 2025 06:38:34 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1trAIW-0002B2-T7; Sun, 09 Mar 2025 01:38:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1trAIU-0002Aa-I7 for guix-patches@gnu.org; Sun, 09 Mar 2025 01:38:02 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1trAIU-0001Pk-77 for guix-patches@gnu.org; Sun, 09 Mar 2025 01:38:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:In-Reply-To:References:Subject; bh=dD9HlNFRTHbkPP9NgjgAe8wX2t8dJXuL1oZUCXTZfSk=; b=rkzQDpVOxVXd5gd+eQOxYTbqEze3DXI4o9gHUHce4upMSqkA5ATa9qiJSMuhfzkxy8l0SlU92XL82zg6eRU15w91J2f9GMODbTl9pP+VjN0/IqJ9nTh1tXo3A8XM4xQU6TVrRlKOkcJeyypXAbVid6U53GR2ACIElRzuWJ0QfAeY6qD8ozF23MgAHoMVaO8rPcSRkkd7Hrwe888GLzgVXjbFl6Toc+yUHQxPdhItUFMllCBQBrpItkBFL3befQ8FKcCgfz3YVs6iaPOMrhwG5zmXpD+lGn6wxW+NIoXYcc9gHUipLdtip93bVs2iFRfpz4HjW+90ZAdCPjFpUp7CsQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1trAIT-00074f-W9 for guix-patches@gnu.org; Sun, 09 Mar 2025 01:38:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#76379] [PATCH v4] services: syncthing: Improve Syncthnig code standard compliance. References: <87bjv087rn.fsf@zacchae.us> In-Reply-To: <87bjv087rn.fsf@zacchae.us> Resent-From: Zacchaeus Scheffer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 09 Mar 2025 06:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 76379 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 76379@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Bruno Victal , Gabriel Santos , Leo Famulari Received: via spool by 76379-submit@debbugs.gnu.org id=B76379.174150225227142 (code B ref 76379); Sun, 09 Mar 2025 06:38:01 +0000 Received: (at 76379) by debbugs.gnu.org; 9 Mar 2025 06:37:32 +0000 Received: from localhost ([127.0.0.1]:57824 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1trAHx-00073c-F2 for submit@debbugs.gnu.org; Sun, 09 Mar 2025 01:37:32 -0500 Received: from [47.204.136.169] (port=47876 helo=hun.zacchae.us) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1trAHt-00073D-1P for 76379@debbugs.gnu.org; Sun, 09 Mar 2025 01:37:28 -0500 DKIM-Signature: v=1; a=ed25519-sha256; q=dns/txt; c=relaxed/relaxed; d=zacchae.us; s=my_ed_sel; h=Content-Type:MIME-Version:Message-ID:Date:CC: Subject:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=dD9HlNFRTHbkPP9NgjgAe8wX2t8dJXuL1oZUCXTZfSk=; i=zacchae.us; b=aI4LPJqGph1D YudUKXKRh49FAtkZBOWfQbpMQwjrJ3KAIrCrpx/+V5ZDkQ1Q2O7vGFkeS3oaECH3bMTooJkvAw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zacchae.us; s=my_rsa_sel; h=Content-Type:MIME-Version:Message-ID:Date:CC:Subject:To:From: Sender:Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=dD9HlNFRTHbkPP9NgjgAe8wX2t8dJXuL1oZUCXTZfSk=; i=zacchae.us; b=HHNQvpku+mUv lgcnX1GfF0nvfrgth7+ogEcjgXCdN07GBZC1Imkg0PlAjrwg143Nae7m1tq7XUDUi+DTbA6p7DPWY TMQiW4MD7oIHrenngRx8LURv5lJqHA2hEGZycsMsErZ5b+3Q+gwFi7SAUjyrRhTSTQxgIrv7kKcvm pBs8PofLdNlz9f7kECByOz7iDIF8qKX4MzeOfLuCdeXqCUOX9PyYTGQXtVSJ+2sGreMIUnCoMIcY6 dRF/69ivCLMmNXpq2PdifknMNiTwh4mbEICx/Cv8Z7m51YCUYFNpl2EBQtIXAe0Fzo2Cut7oi6YLJ 5tx5k/80y+Nqy7mttOmezg==; Received: from localhost.home ([127.0.0.1]:38532 helo=hun) by hun.zacchae.us with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1trAHi-000000001Qe-1qfz; Sun, 09 Mar 2025 01:37:14 -0500 From: Zacchaeus Scheffer Date: Sun, 09 Mar 2025 01:37:14 -0500 Message-ID: <871pv6k8v9.fsf@zacchae.us> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From 2767e3776817375ed9e53beaac3744c12b43d5d7 Mon Sep 17 00:00:00 2001 From: Zacchaeus Date: Mon, 17 Feb 2025 15:19:19 -0800 Subject: [PATCH v4] services: syncthing: Improve Syncthnig code standard compliance. * gnu/services/syncthing.scm: (syncthing-config-file, syncthing-folder, syncthing-device, syncthing-folder-device): Rename fields to avoid abbreviation, boolean values switched to use #t or #f, numbers no longer provided as strings, config directory moved to ~/.local/state/syncthing * doc/guix.texi: (syncthing-service-type): Update documentation to reflect these changes. Change-Id: I01c059e13658a0d1ad38aaebca3dcb0a268bbdba --- After 75959 was pushed, a few compliance issues were pointed out. This patch (76379) addresses the code issues (v1), as well as some additional (v2) documentation (v3) fixes. This version (v4) also updates the config file path to use the more modern ~/.local/state/syncthing path. I considered trying to implement something to ensure config is placed in $XDG_STATE_HOME/syncthing/, but looking elswhere in Guix, it seems it is the norm to hard-code XDG paths without checking environment variables; this fact is bad, but outside the scope of this patch. Finally, this patch (v4) no longer abuses sanitizers to facilitate serialization. The backwards incompatible consequences of this patch are as follows: - some variable names have been expanded out. reconfigure with an old config will complain about incorrect record names - the previous version of this patch may have (76379) may have created files in ~/.config/syncthing. In which case, the user should delete those files, or move them to ~/.local/state/syncthing The most troubling issue is the last one. Luckily this mirrors the behaviour of Syncthing over time in a convenient way: especially old Syncthing installs (independant of 76379) also put files in ~/.config/syncthing/. The wording in the documentation on this is intentionally ambiguous: > Old Syncthing installs may have files in ... Is that refering to super old Syncthing raw installs, or the new old Syncthing installs? The answer is that it doesn't matter. If your syncthing files are in ~/.config/syncthing, the solution is to move those files into ~/.local/state/syncthing Useful commands for testing home service: # copy the config into the cwd guix shell -D guix -CPW -- ./pre-inst-env guix home container --share=$HOME/tmp/guix home.scm -- cp $HOME/.local/state/syncthing/config.xml $HOME/tmp/guix/config.xml # diff it with the config you expected it to be in guix shell libxml2 bash -- bash -c "XMLLINT_INDENT=' ' xmllint --format config.xml > indent && XMLLINT_INDENT=' ' xmllint --format $HOME/.local/state/syncthing/config.xml | diff indent - && rm indent" # also, you can poke around guix shell -D guix -CPW -- ./pre-inst-env guix home container --share=$HOME/tmp/guix home.scm # check logs, ensure grep syncthing .local/state/shepherd/shepherd.log # syncthing service should be running herd status | grep syncthing # should show syncthing running ps -e | grep syncthing # should be empty ls -l .config/syncthing # should have the syncthing files ls -l .local/state/syncthing Useful command for testing system service: guix shell -D guix -CPW -- ./pre-inst-env guix system container igor-cheat.scm sudo /gnu/store/ifwxygjzpm6rldq8p2hhnlc06vkm6p00-run-container eikcaz- doc/guix.texi | 288 +++++++++++++------------- gnu/services/syncthing.scm | 402 +++++++++++++++++++------------------ 2 files changed, 358 insertions(+), 332 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 7d8a5243ed..975f4f7fb6 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -22917,6 +22917,15 @@ common configuration and data directory (@code{--home} in @uref{https://docs.syncthing.net/users/syncthing.html}) to @file{/var/lib/syncthing-}. +When used as a home service, syncthing configuration will be populated +in @file{~/.local/state/syncthing/}. Old Syncthing installs may have +files in @file{$XDG_CONFIG_HOME/syncthing/} (usually +@file{~/.config/syncthing/}), which will override configuration in +@file{~/.local/state/syncthing} managed by this service. In such +cases, you should move the contents of +@file{$XDG_CONFIG_HOME/syncthing/} into +@file{~/.local/state/syncthing/}. + @end table @end deftp @@ -22947,11 +22956,11 @@ Data type representing the configuration file read by the Syncthing daemon. @table @asis -@item @code{folders} (default: @var{(list (syncthing-folder (id "default") (label "Default Folder") (path "~/Sync")))} +@item @code{folders} (default: @code{(list (syncthing-folder (id "default") (label "Default Folder") (path "~/Sync")))} The default here is the same as Syncthing's default. The value should be a list of @code{syncthing-folder}s. -@item @code{devices} (default: @var{'()} +@item @code{devices} (default: @code{'()} This should be a list of @code{syncthing-device}s. Guix will automatically add any devices specified in any `folders' to this list. There are instances when you want to connect to a device despite not @@ -22961,108 +22970,108 @@ here. If multiple versions of the same device (as determined by comparing device ID) are discovered, the one in this list is prioritized. Otherwise, the first instance in the first folder is used. -@item @code{gui-enabled} (default: @var{"true"}) +@item @code{gui-enabled?} (default: @code{#t}) By default, any user on the computer can access the GUI and make changes to Syncthing. If you leave this enabled, you should probably set @code{gui-user} and @code{gui-password} (see below). -@item @code{gui-tls} (default: @var{"false"}) -@item @code{gui-debugging} (default: @var{"false"}) -@item @code{gui-send-basic-auth-prompt} (default: @var{"false"}) -@item @code{gui-address} (default: @var{"127.0.0.1:8384"}) -@item @code{gui-user} (default: @var{#f}) -@item @code{gui-password} (default: @var{#f}) +@item @code{gui-tls?} (default: @code{#f}) +@item @code{gui-debugging?} (default: @code{#f}) +@item @code{gui-send-basic-authorization-prompt?} (default: @code{#f}) +@item @code{gui-address} (default: @code{"127.0.0.1:8384"}) +@item @code{gui-user} (default: @code{#f}) +@item @code{gui-password} (default: @code{#f}) A bcrypt hash of the GUI password. Remember that this will be globally exposed in @file{/gnu/store}. -@item @code{gui-apikey} (default: @var{#f}) +@item @code{gui-apikey} (default: @code{#f}) You must specify this to use the Syncthing REST interface. This key is kept in @file{/gnu/store} and is accessible to all users of the system. -@item @code{gui-theme} (default: @var{"default"}) -@item @code{ldap-enabled} (default: @var{#f}) -@item @code{ldap-address} (default: @var{""}) -@item @code{ldap-bind-dn} (default: @var{""}) -@item @code{ldap-transport} (default: @var{""}) -@item @code{ldap-insecure-skip-verify} (default: @var{""}) -@item @code{ldap-search-base-dn} (default: @var{""}) -@item @code{ldap-search-filter} (default: @var{""}) -@item @code{listen-address} (default: @var{"default"}) -@item @code{global-announce-server} (default: @var{"default"}) -@item @code{global-announce-enabled} (default: @var{"true"}) +@item @code{gui-theme} (default: @code{"default"}) +@item @code{ldap-enabled?} (default: @code{#f}) +@item @code{ldap-address} (default: @code{""}) +@item @code{ldap-bind-dn} (default: @code{""}) +@item @code{ldap-transport} (default: @code{""}) +@item @code{ldap-insecure-skip-verify} (default: @code{""}) +@item @code{ldap-search-base-dn} (default: @code{""}) +@item @code{ldap-search-filter} (default: @code{""}) +@item @code{listen-address} (default: @code{"default"}) +@item @code{global-announce-server} (default: @code{"default"}) +@item @code{global-announce-enabled?} (default: @code{#t}) Global discovery servers can be used to help connect devices at unknown IP addresses by storing the last known IP address. -@item @code{local-announce-enabled} (default: @var{"true"}) +@item @code{local-announce-enabled?} (default: @code{#t}) This makes devices find each other very easily on the same LAN. Often, this will allow you to just plug an Ethernet between two devices, or connect one device to the other's hotspot and start syncing. -@item @code{local-announce-port} (default: @var{"21027"}) -@item @code{local-announce-mcaddr} (default: @var{"[ff12::8384]:21027"}) -@item @code{max-send-kbps} (default: @var{"0"}) -@item @code{max-recv-kbps} (default: @var{"0"}) -@item @code{reconnection-interval-s} (default: @var{"60"}) -@item @code{relays-enabled} (default: @var{"true"}) +@item @code{local-announce-port} (default: @code{21027}) +@item @code{local-announce-mac-address} (default: @code{"[ff12::8384]:21027"}) +@item @code{max-send-kbps} (default: @code{0}) +@item @code{max-receive-kbps} (default: @code{0}) +@item @code{reconnection-interval-seconds} (default: @code{60}) +@item @code{relays-enabled?} (default: @code{#t}) This option allows your Syncthing instance to use a global network of @uref{https://docs.syncthing.net/users/relaying.html, relays} to enable syncing between devices when all other methods fail. As always, Syncthing traffic is encrypted in transport and the relays are unable to decrypt it. -@item @code{relay-reconnect-interval-m} (default: @var{"10"}) -@item @code{start-browser} (default: @var{"true"}) -@item @code{nat-enabled} (default: @var{"true"}) -@item @code{nat-lease-minutes} (default: @var{"60"}) -@item @code{nat-renewal-minutes} (default: @var{"30"}) -@item @code{nat-timeout-seconds} (default: @var{"10"}) -@item @code{ur-accepted} (default: @var{"0"}) -Options whose names begin with `ur-' control usage reporting. Set to -1 +@item @code{relay-reconnect-interval-minutes} (default: @code{10}) +@item @code{start-browser?} (default: @code{#t}) +@item @code{nat-enabled?} (default: @code{#t}) +@item @code{nat-lease-minutes} (default: @code{60}) +@item @code{nat-renewal-minutes} (default: @code{30}) +@item @code{nat-timeout-seconds} (default: @code{10}) +@item @code{usage-reporting-accepted} (default: @code{0}) +Options whose names begin with `usage-reporting-' control usage reporting. Set to -1 to disable, or to a positive value to enable. The default (0) disables reporting, but causes a usage reporting consent prompt to be displayed in the Syncthing GUI. -@item @code{ur-seen} (default: @var{"0"}) -@item @code{ur-unique-id} (default: @var{""}) -@item @code{ur-url} (default: @var{"https://data.syncthing.net/newdata"}) -@item @code{ur-post-insecurely} (default: @var{"false"}) -@item @code{ur-initial-delay-s} (default: @var{"1800"}) -@item @code{auto-upgrade-interval-h} (default: @var{"12"}) -@item @code{upgrade-to-pre-releases} (default: @var{"false"}) -@item @code{keep-temporaries-h} (default: @var{"24"}) -@item @code{cache-ignored-files} (default: @var{"false"}) -@item @code{progress-update-interval-s} (default: @var{"5"}) -@item @code{limit-bandwidth-in-lan} (default: @var{"false"}) -@item @code{min-home-disk-free-unit} (default: @var{"%"}) -@item @code{min-home-disk-free} (default: @var{"1"}) -@item @code{releases-url} (default: @var{"https://upgrades.syncthing.net/meta.json"}) -@item @code{overwrite-remote-device-names-on-connect} (default: @var{"false"}) -@item @code{temp-index-min-blocks} (default: @var{"10"}) -@item @code{unacked-notification-id} (default: @var{"authenticationUserAndPassword"}) -@item @code{traffic-class} (default: @var{"0"}) -@item @code{set-low-priority} (default: @var{"true"}) -@item @code{max-folder-concurrency} (default: @var{"0"}) -@item @code{crash-reporting-url} (default: @var{"https://crash.syncthing.net/newcrash"}) -@item @code{crash-reporting-enabled} (default: @var{"true"}) -@item @code{stun-keepalive-start-s} (default: @var{"180"}) -@item @code{stun-keepalive-min-s} (default: @var{"20"}) -@item @code{stun-server} (default: @var{"default"}) -@item @code{database-tuning} (default: @var{"auto"}) -@item @code{max-concurrent-incoming-request-kib} (default: @var{"0"}) -@item @code{announce-lan-addresses} (default: @var{"true"}) -@item @code{send-full-index-on-upgrade} (default: @var{"false"}) -@item @code{connection-limit-enough} (default: @var{"0"}) -@item @code{connection-limit-max} (default: @var{"0"}) -@item @code{insecure-allow-old-tls-versions} (default: @var{"false"}) -@item @code{connection-priority-tcp-lan} (default: @var{"10"}) -@item @code{connection-priority-quic-lan} (default: @var{"20"}) -@item @code{connection-priority-tcp-wan} (default: @var{"30"}) -@item @code{connection-priority-quic-wan} (default: @var{"40"}) -@item @code{connection-priority-relay} (default: @var{"50"}) -@item @code{connection-priority-upgrade-threshold} (default: @var{"0"}) -@item @code{default-folder} (default: @var{(syncthing-folder (label ""))}) -@item @code{default-device} (default: @var{(syncthing-device (id ""))}) -@item @code{default-ignores} (default: @var{"")}) +@item @code{usage-reporting-seen} (default: @code{0}) +@item @code{usage-reporting-unique-id} (default: @code{""}) +@item @code{usage-reporting-url} (default: @code{"https://data.syncthing.net/newdata"}) +@item @code{usage-reporting-post-insecurely?} (default: @code{#f}) +@item @code{usage-reporting-initial-delay-seconds} (default: @code{1800}) +@item @code{auto-upgrade-interval-hours} (default: @code{12}) +@item @code{upgrade-to-pre-releases?} (default: @code{#f}) +@item @code{keep-temporaries-hours} (default: @code{24}) +@item @code{cache-ignored-files?} (default: @code{#f}) +@item @code{progress-update-interval-seconds} (default: @code{5}) +@item @code{limit-bandwidth-in-lan?} (default: @code{#f}) +@item @code{min-home-disk-free-unit} (default: @code{"%"}) +@item @code{min-home-disk-free} (default: @code{1}) +@item @code{releases-url} (default: @code{"https://upgrades.syncthing.net/meta.json"}) +@item @code{overwrite-remote-device-names-on-connect?} (default: @code{#f}) +@item @code{temp-index-min-blocks} (default: @code{10}) +@item @code{unacked-notification-id} (default: @code{"authenticationUserAndPassword"}) +@item @code{traffic-class} (default: @code{0}) +@item @code{set-low-priority?} (default: @code{#t}) +@item @code{max-folder-concurrency} (default: @code{0}) +@item @code{crash-reporting-url} (default: @code{"https://crash.syncthing.net/newcrash"}) +@item @code{crash-reporting-enabled?} (default: @code{#t}) +@item @code{stun-keepalive-start-seconds} (default: @code{180}) +@item @code{stun-keepalive-min-seconds} (default: @code{20}) +@item @code{stun-server} (default: @code{"default"}) +@item @code{database-tuning} (default: @code{"auto"}) +@item @code{max-concurrent-incoming-request-kib} (default: @code{0}) +@item @code{announce-lan-addresses?} (default: @code{#t}) +@item @code{send-full-index-on-upgrade?} (default: @code{#f}) +@item @code{connection-limit-enough} (default: @code{0}) +@item @code{connection-limit-max} (default: @code{0}) +@item @code{insecure-allow-old-tls-versions?} (default: @code{#f}) +@item @code{connection-priority-tcp-lan} (default: @code{10}) +@item @code{connection-priority-quic-lan} (default: @code{20}) +@item @code{connection-priority-tcp-wan} (default: @code{30}) +@item @code{connection-priority-quic-wan} (default: @code{40}) +@item @code{connection-priority-relay} (default: @code{50}) +@item @code{connection-priority-upgrade-threshold} (default: @code{0}) +@item @code{default-folder} (default: @code{(syncthing-folder (label ""))}) +@itemx @code{default-device} (default: @code{(syncthing-device (id ""))}) +@itemx @code{default-ignores} (default: @code{"")}) Options whose names begin with `default-' above do not affect folders and devices added through the Guix configuration interface. They will, however, affect folders and devices that are added through the Syncthing @@ -23075,7 +23084,7 @@ GUI, by an @code{introducer}, or a device with Data type representing a folder to be synchronized. @table @asis -@item @code{id} (default: @var{#f}) +@item @code{id} (default: @code{#f}) This ID cannot match the ID of any other folder on this device. If left unspecified, it will default to the label (see below). @@ -23085,56 +23094,57 @@ A human readable label for the folder. @item @code{path} The path at which to store this folder. -@item @code{type} (default: @var{"sendreceive"}) -@item @code{rescan-interval-s} (default: @var{"3600"}) -@item @code{fs-watcher-enabled} (default: @var{"true"}) -@item @code{fs-watcher-delay-s} (default: @var{"10"}) -@item @code{ignore-perms} (default: @var{"false"}) -@item @code{auto-normalize} (default: @var{"true"}) -@item @code{devices} (default: @var{'()}) +@item @code{type} (default: @code{"sendreceive"}) +@item @code{rescan-interval-seconds} (default: @code{3600}) +@item @code{file-system-watcher-enabled?} (default: @code{#t}) +@item @code{file-system-watcher-delay-seconds} (default: @code{10}) +@item @code{file-system-watcher-timeout-seconds} (default: @code{0}) +@item @code{ignore-permissions?} (default: @code{#f}) +@item @code{auto-normalize?} (default: @code{#t}) +@item @code{devices} (default: @code{'()}) This should be a list of other Syncthing devices. You do not need to specify the current device. Each device can be listed as a a @code{syncthing-device} record or a @code{syncthing-folder-device} record if you want files to be encrypted on disk. See below. -@item @code{filesystem-type} (default: @var{"basic"}) -@item @code{min-disk-free-unit} (default: @var{"%"}) -@item @code{min-disk-free} (default: @var{"1"}) -@item @code{versioning-type} (default: @var{#f}) -@item @code{versioning-fs-path} (default: @var{""}) -@item @code{versioning-fs-type} (default: @var{"basic"}) -@item @code{versioning-cleanup-interval-s} (default: @var{"3600"}) -@item @code{versioning-cleanout-days} (default: @var{#f}) -@item @code{versioning-keep} (default: @var{#f}) -@item @code{versioning-max-age} (default: @var{#f}) -@item @code{versioning-command} (default: @var{#f}) -@item @code{copiers} (default: @var{"0"}) -@item @code{puller-max-pending-kib} (default: @var{"0"}) -@item @code{hashers} (default: @var{"0"}) -@item @code{order} (default: @var{"random"}) -@item @code{ignore-delete} (default: @var{"false"}) -@item @code{scan-progress-interval-s} (default: @var{"0"}) -@item @code{puller-pause-s} (default: @var{"0"}) -@item @code{max-conflicts} (default: @var{"10"}) -@item @code{disable-sparse-files} (default: @var{"false"}) -@item @code{disable-temp-indexes} (default: @var{"false"}) -@item @code{paused} (default: @var{"false"}) -@item @code{weak-hash-threshold-pct} (default: @var{"25"}) -@item @code{marker-name} (default: @var{".stfolder"}) -@item @code{copy-ownership-from-parent} (default: @var{"false"}) -@item @code{mod-time-window-s} (default: @var{"0"}) -@item @code{max-concurrent-writes} (default: @var{"2"}) -@item @code{disable-fsync} (default: @var{"false"}) -@item @code{block-pull-order} (default: @var{"standard"}) -@item @code{copy-range-method} (default: @var{"standard"}) -@item @code{case-sensitive-fs} (default: @var{"false"}) -@item @code{junctions-as-dirs} (default: @var{"false"}) -@item @code{sync-ownership} (default: @var{"false"}) -@item @code{send-ownership} (default: @var{"false"}) -@item @code{sync-xattrs} (default: @var{"false"}) -@item @code{send-xattrs} (default: @var{"false"}) -@item @code{xattr-filter-max-single-entry-size} (default: @var{"1024"}) -@item @code{xattr-filter-max-total-size} (default: @var{"4096")}) +@item @code{filesystem-type} (default: @code{"basic"}) +@item @code{min-disk-free-unit} (default: @code{"%"}) +@item @code{min-disk-free} (default: @code{1}) +@item @code{versioning-type} (default: @code{#f}) +@item @code{versioning-file-system-path} (default: @code{""}) +@item @code{versioning-file-system-type} (default: @code{"basic"}) +@item @code{versioning-cleanup-interval-seconds} (default: @code{3600}) +@item @code{versioning-cleanout-days} (default: @code{#f}) +@item @code{versioning-keep} (default: @code{#f}) +@item @code{versioning-max-age} (default: @code{#f}) +@item @code{versioning-command} (default: @code{#f}) +@item @code{copiers} (default: @code{0}) +@item @code{puller-max-pending-kib} (default: @code{0}) +@item @code{hashers} (default: @code{0}) +@item @code{order} (default: @code{"random"}) +@item @code{ignore-delete?} (default: @code{#f}) +@item @code{scan-progress-interval-seconds} (default: @code{0}) +@item @code{puller-pause-seconds} (default: @code{0}) +@item @code{max-conflicts} (default: @code{10}) +@item @code{disable-sparse-files?} (default: @code{#f}) +@item @code{disable-temp-indexes?} (default: @code{#f}) +@item @code{paused?} (default: @code{#f}) +@item @code{weak-hash-threshold-percentage} (default: @code{25}) +@item @code{marker-name} (default: @code{".stfolder"}) +@item @code{copy-ownership-from-parent?} (default: @code{#f}) +@item @code{mod-time-window-seconds} (default: @code{0}) +@item @code{max-concurrent-writes} (default: @code{2}) +@item @code{disable-fsync?} (default: @code{#f}) +@item @code{block-pull-order} (default: @code{"standard"}) +@item @code{copy-range-method} (default: @code{"standard"}) +@item @code{case-sensitive-file-system?} (default: @code{#f}) +@item @code{junctions-as-dirs?} (default: @code{#f}) +@item @code{sync-ownership?} (default: @code{#f}) +@item @code{send-ownership?} (default: @code{#f}) +@item @code{sync-xattrs?} (default: @code{#f}) +@item @code{send-xattrs?} (default: @code{#f}) +@item @code{xattr-filter-max-single-entry-size} (default: @code{1024}) +@item @code{xattr-filter-max-total-size} (default: @code{4096}) @end table @end deftp @@ -23147,28 +23157,28 @@ A long hash representing the keys generated by Syncthing on the first launch. You can obtain this from the Syncthing GUI or by inspecting an existing Syncthing configuration file. -@item @code{name} (default: @var{""}) +@item @code{name} (default: @code{""}) A human readable device name for viewing in the GUI or in Scheme. -@item @code{compression} (default: @var{"metadata"}) -@item @code{introducer} (default: @var{"false"}) -@item @code{skip-introduction-removals} (default: @var{"false"}) -@item @code{introduced-by} (default: @var{""}) -@item @code{addresses} (default: @var{'("dynamic")}) +@item @code{compression} (default: @code{"metadata"}) +@item @code{introducer?} (default: @code{#f}) +@item @code{skip-introduction-removals?} (default: @code{#f}) +@item @code{introduced-by} (default: @code{""}) +@item @code{addresses} (default: @code{'("dynamic")}) List of addresses at which to search for this device. When the special value ``dynamic'' is included, Syncthing will search for the device locally as well as via the Syncthing project's @uref{https://docs.syncthing.net/users/security.html#global-discovery, global discovery} servers. -@item @code{paused} (default: @var{"false"}) -@item @code{auto-accept-folders} (default: @var{"false"}) -@item @code{max-send-kbps} (default: @var{"0"}) -@item @code{max-recv-kbps} (default: @var{"0"}) -@item @code{max-request-kib} (default: @var{"0"}) -@item @code{untrusted} (default: @var{"false"}) -@item @code{remote-gui-port} (default: @var{"0"}) -@item @code{num-connections} (default: @var{"0")}) +@item @code{paused?} (default: @code{#f}) +@item @code{auto-accept-folders?} (default: @code{#f}) +@item @code{max-send-kbps} (default: @code{0}) +@item @code{max-receive-kbps} (default: @code{0}) +@item @code{max-request-kib} (default: @code{0}) +@item @code{untrusted?} (default: @code{#f}) +@item @code{remote-gui-port} (default: @code{0}) +@item @code{num-connections} (default: @code{0}) @end table @end deftp @@ -23189,14 +23199,14 @@ If you don't need to use these options, then you can just use @item @code{device} The @code{syncthing-device} for which this configuration applies. -@item @code{introduced-by} (default: @var{""}) +@item @code{introduced-by} (default: @code{""}) The name of the device that "introduced" our device to the device sharing this folder. This is only used when "introduced" devices are removed by the introducer. See @uref{https://docs.syncthing.net/users/introducer.html, Syncthing introductions}. -@item @code{encryption-password} (default: @var{""}) +@item @code{encryption-password} (default: @code{""}) The password used to encrypt data that is synchronized to untrusted devices. diff --git a/gnu/services/syncthing.scm b/gnu/services/syncthing.scm index efafec8f73..96bf79bb7a 100644 --- a/gnu/services/syncthing.scm +++ b/gnu/services/syncthing.scm @@ -47,44 +47,51 @@ (define-module (gnu services syncthing) ;;; ;;; Code: +(define (bool->xml-string bool) + ;; add compatibility for the short duration where #f was specified as + ;; "false" + (if (string? bool) bool + ;; the expected case + (if bool "true" "false"))) + (define-record-type* syncthing-device make-syncthing-device syncthing-device? (id syncthing-device-id) (name syncthing-device-name (default "")) (compression syncthing-device-compression (default "metadata")) - (introducer syncthing-device-introducer (default "false")) - (skip-introduction-removals syncthing-device-skip-introduction-removals (default "false")) + (introducer? syncthing-device-introducer? (default #f)) + (skip-introduction-removals? syncthing-device-skip-introduction-removals? (default #f)) (introduced-by syncthing-device-introduced-by (default "")) (addresses syncthing-device-addresses (default '("dynamic"))) - (paused syncthing-device-paused (default "false")) - (auto-accept-folders syncthing-device-auto-accept-folders (default "false")) - (max-send-kbps syncthing-device-max-send-kbps (default "0")) - (max-recv-kbps syncthing-device-max-recv-kbps (default "0")) - (max-request-kib syncthing-device-max-request-kib (default "0")) - (untrusted syncthing-device-untrusted (default "false")) - (remote-gui-port syncthing-device-remote-gui-port (default "0")) - (num-connections syncthing-device-num-connections (default "0"))) + (paused? syncthing-device-paused? (default #f)) + (auto-accept-folders? syncthing-device-auto-accept-folders? (default #f)) + (max-send-kbps syncthing-device-max-send-kbps (default 0)) + (max-receive-kbps syncthing-device-max-receive-kbps (default 0)) + (max-request-kib syncthing-device-max-request-kib (default 0)) + (untrusted? syncthing-device-untrusted? (default #f)) + (remote-gui-port syncthing-device-remote-gui-port (default 0)) + (num-connections syncthing-device-num-connections (default 0))) (define syncthing-device->sxml (match-record-lambda (id - name compression introducer skip-introduction-removals introduced-by - addresses paused auto-accept-folders max-send-kbps max-recv-kbps - max-request-kib untrusted remote-gui-port num-connections) + name compression introducer? skip-introduction-removals? introduced-by + addresses paused? auto-accept-folders? max-send-kbps max-receive-kbps + max-request-kib untrusted? remote-gui-port num-connections) `(device (@ (id ,id) (name ,name) (compression ,compression) - (introducer ,introducer) - (skipIntroductionRemovals ,skip-introduction-removals) + (introducer ,(bool->xml-string introducer?)) + (skipIntroductionRemovals ,(bool->xml-string skip-introduction-removals?)) (introducedBy ,introduced-by)) ,@(map (lambda (address) `(address ,address)) addresses) - (paused ,paused) - (autoAcceptFolders ,auto-accept-folders) + (paused ,(bool->xml-string paused?)) + (autoAcceptFolders ,(bool->xml-string auto-accept-folders?)) (maxSendKbps ,max-send-kbps) - (maxRecvKbps ,max-recv-kbps) + (maxRecvKbps ,max-receive-kbps) (maxRequestKiB ,max-request-kib) - (untrusted ,untrusted) + (untrusted ,(bool->xml-string untrusted?)) (remoteGUIPort ,remote-gui-port) (numConnections ,num-connections)))) @@ -109,12 +116,12 @@ (define-record-type* (label syncthing-folder-label) (path syncthing-folder-path) (type syncthing-folder-type (default "sendreceive")) - (rescan-interval-s syncthing-folder-rescan-interval-s (default "3600")) - (fs-watcher-enabled syncthing-folder-fs-watcher-enabled (default "true")) - (fs-watcher-delay-s syncthing-folder-fs-watcher-delay-s (default "10")) - (fs-watcher-timeout-s syncthing-folder-fs-watcher-timeout-s (default "0")) - (ignore-perms syncthing-folder-ignore-perms (default "false")) - (auto-normalize syncthing-folder-auto-normalize (default "true")) + (rescan-interval-seconds syncthing-folder-rescan-interval-seconds (default 3600)) + (file-system-watcher-enabled? syncthing-folder-file-system-watcher-enabled? (default #t)) + (file-system-watcher-delay-seconds syncthing-folder-file-system-watcher-delay-seconds (default 10)) + (file-system-watcher-timeout-seconds syncthing-folder-file-system-watcher-timeout-seconds (default 0)) + (ignore-permissions? syncthing-folder-ignore-permissions? (default #f)) + (auto-normalize? syncthing-folder-auto-normalize? (default #t)) (devices syncthing-folder-devices (default '()) (sanitize (lambda (folder-device-list) (map (lambda (device) @@ -124,42 +131,42 @@ (define-record-type* folder-device-list)))) (filesystem-type syncthing-folder-filesystem-type (default "basic")) (min-disk-free-unit syncthing-folder-min-disk-free-unit (default "%")) - (min-disk-free syncthing-folder-min-disk-free (default "1")) + (min-disk-free syncthing-folder-min-disk-free (default 1)) (versioning-type syncthing-folder-versioning-type (default #f)) - (versioning-fs-path syncthing-folder-versioning-fs-path (default "")) - (versioning-fs-type syncthing-folder-versioning-fs-type (default "basic")) - (versioning-cleanup-interval-s syncthing-folder-versioning-cleanup-interval-s (default "3600")) + (versioning-file-system-path syncthing-folder-versioning-file-system-path (default "")) + (versioning-file-system-type syncthing-folder-versioning-file-system-type (default "basic")) + (versioning-cleanup-interval-seconds syncthing-folder-versioning-cleanup-interval-seconds (default 3600)) (versioning-cleanout-days syncthing-folder-versioning-cleanout-days (default #f)) (versioning-keep syncthing-folder-versioning-keep (default #f)) (versioning-max-age syncthing-folder-versioning-max-age (default #f)) (versioning-command syncthing-folder-versioning-command (default #f)) - (copiers syncthing-folder-copiers (default "0")) - (puller-max-pending-kib syncthing-folder-puller-max-pending-kib (default "0")) - (hashers syncthing-folder-hashers (default "0")) + (copiers syncthing-folder-copiers (default 0)) + (puller-max-pending-kib syncthing-folder-puller-max-pending-kib (default 0)) + (hashers syncthing-folder-hashers (default 0)) (order syncthing-folder-order (default "random")) - (ignore-delete syncthing-folder-ignore-delete (default "false")) - (scan-progress-interval-s syncthing-folder-scan-progress-interval-s (default "0")) - (puller-pause-s syncthing-folder-puller-pause-s (default "0")) - (max-conflicts syncthing-folder-max-conflicts (default "10")) - (disable-sparse-files syncthing-folder-disable-sparse-files (default "false")) - (disable-temp-indexes syncthing-folder-disable-temp-indexes (default "false")) - (paused syncthing-folder-paused (default "false")) - (weak-hash-threshold-pct syncthing-folder-weak-hash-threshold-pct (default "25")) + (ignore-delete? syncthing-folder-ignore-delete? (default #f)) + (scan-progress-interval-seconds syncthing-folder-scan-progress-interval-seconds (default 0)) + (puller-pause-seconds syncthing-folder-puller-pause-seconds (default 0)) + (max-conflicts syncthing-folder-max-conflicts (default 10)) + (disable-sparse-files? syncthing-folder-disable-sparse-files? (default #f)) + (disable-temp-indexes? syncthing-folder-disable-temp-indexes? (default #f)) + (paused? syncthing-folder-paused? (default #f)) + (weak-hash-threshold-percentage syncthing-folder-weak-hash-threshold-percentage (default 25)) (marker-name syncthing-folder-marker-name (default ".stfolder")) - (copy-ownership-from-parent syncthing-folder-copy-ownership-from-parent (default "false")) - (mod-time-window-s syncthing-folder-mod-time-window-s (default "0")) - (max-concurrent-writes syncthing-folder-max-concurrent-writes (default "2")) - (disable-fsync syncthing-folder-disable-fsync (default "false")) + (copy-ownership-from-parent? syncthing-folder-copy-ownership-from-parent? (default #f)) + (mod-time-window-seconds syncthing-folder-mod-time-window-seconds (default 0)) + (max-concurrent-writes syncthing-folder-max-concurrent-writes (default 2)) + (disable-fsync? syncthing-folder-disable-fsync? (default #f)) (block-pull-order syncthing-folder-block-pull-order (default "standard")) (copy-range-method syncthing-folder-copy-range-method (default "standard")) - (case-sensitive-fs syncthing-folder-case-sensitive-fs (default "false")) - (junctions-as-dirs syncthing-folder-junctions-as-dirs (default "false")) - (sync-ownership syncthing-folder-sync-ownership (default "false")) - (send-ownership syncthing-folder-send-ownership (default "false")) - (sync-xattrs syncthing-folder-sync-xattrs (default "false")) - (send-xattrs syncthing-folder-send-xattrs (default "false")) - (xattr-filter-max-single-entry-size syncthing-folder-xattr-filter-max-single-entry-size (default "1024")) - (xattr-filter-max-total-size syncthing-folder-xattr-filter-max-total-size (default "4096"))) + (case-sensitive-file-system? syncthing-folder-case-sensitive-file-system? (default #f)) + (junctions-as-dirs? syncthing-folder-junctions-as-dirs? (default #f)) + (sync-ownership? syncthing-folder-sync-ownership? (default #f)) + (send-ownership? syncthing-folder-send-ownership? (default #f)) + (sync-xattrs? syncthing-folder-sync-xattrs? (default #f)) + (send-xattrs? syncthing-folder-send-xattrs? (default #f)) + (xattr-filter-max-single-entry-size syncthing-folder-xattr-filter-max-single-entry-size (default 1024)) + (xattr-filter-max-total-size syncthing-folder-xattr-filter-max-total-size (default 4096))) ;; Some parameters, when empty, are fully omitted from the config file. It is ;; unknown if this causes a functional difference, but stick to the normal @@ -170,27 +177,32 @@ (define (maybe-param symbol value) (define syncthing-folder->sxml (match-record-lambda (id - label path type rescan-interval-s fs-watcher-enabled fs-watcher-delay-s - fs-watcher-timeout-s ignore-perms auto-normalize devices filesystem-type - min-disk-free-unit min-disk-free versioning-type versioning-fs-path - versioning-fs-type versioning-cleanup-interval-s versioning-cleanout-days + label path type rescan-interval-seconds file-system-watcher-enabled? + file-system-watcher-delay-seconds file-system-watcher-timeout-seconds + ignore-permissions? auto-normalize? devices filesystem-type + min-disk-free-unit min-disk-free versioning-type + versioning-file-system-path versioning-file-system-type + versioning-cleanup-interval-seconds versioning-cleanout-days versioning-keep versioning-max-age versioning-command copiers - puller-max-pending-kib hashers order ignore-delete scan-progress-interval-s - puller-pause-s max-conflicts disable-sparse-files disable-temp-indexes paused - weak-hash-threshold-pct marker-name copy-ownership-from-parent mod-time-window-s - max-concurrent-writes disable-fsync block-pull-order copy-range-method - case-sensitive-fs junctions-as-dirs sync-ownership send-ownership sync-xattrs - send-xattrs xattr-filter-max-single-entry-size xattr-filter-max-total-size) + puller-max-pending-kib hashers order ignore-delete? + scan-progress-interval-seconds puller-pause-seconds max-conflicts + disable-sparse-files? disable-temp-indexes? paused? + weak-hash-threshold-percentage marker-name copy-ownership-from-parent? + mod-time-window-seconds max-concurrent-writes disable-fsync? + block-pull-order copy-range-method case-sensitive-file-system? + junctions-as-dirs? sync-ownership? send-ownership? sync-xattrs? + send-xattrs? xattr-filter-max-single-entry-size + xattr-filter-max-total-size) `(folder (@ (id ,(if id id label)) (label ,label) (path ,path) (type ,type) - (rescanIntervalS ,rescan-interval-s) - (fsWatcherEnabled ,fs-watcher-enabled) - (fsWatcherDelayS ,fs-watcher-delay-s) - (fsWatcherTimeoutS ,fs-watcher-timeout-s) - (ignorePerms ,ignore-perms) - (autoNormalize ,auto-normalize)) + (rescanIntervalS ,rescan-interval-seconds) + (fsWatcherEnabled ,(bool->xml-string file-system-watcher-enabled?)) + (fsWatcherDelayS ,file-system-watcher-delay-seconds) + (fsWatcherTimeoutS ,file-system-watcher-timeout-seconds) + (ignorePerms ,(bool->xml-string ignore-permissions?)) + (autoNormalize ,(bool->xml-string auto-normalize?))) (filesystemType ,filesystem-type) ,@(map syncthing-folder-device->sxml devices) @@ -203,34 +215,34 @@ (define syncthing-folder->sxml ,@(maybe-param 'keep versioning-keep) ,@(maybe-param 'maxAge versioning-max-age) ,@(maybe-param 'command versioning-command) - (cleanupIntervalS ,versioning-cleanup-interval-s) - (fsPath ,versioning-fs-path) - (fsType ,versioning-fs-type)) + (cleanupIntervalS ,versioning-cleanup-interval-seconds) + (fsPath ,versioning-file-system-path) + (fsType ,versioning-file-system-type)) (copiers ,copiers) (pullerMaxPendingKiB ,puller-max-pending-kib) (hashers ,hashers) (order ,order) - (ignoreDelete ,ignore-delete) - (scanProgressIntervalS ,scan-progress-interval-s) - (pullerPauseS ,puller-pause-s) + (ignoreDelete ,(bool->xml-string ignore-delete?)) + (scanProgressIntervalS ,scan-progress-interval-seconds) + (pullerPauseS ,puller-pause-seconds) (maxConflicts ,max-conflicts) - (disableSparseFiles ,disable-sparse-files) - (disableTempIndexes ,disable-temp-indexes) - (paused ,paused) - (weakHashThresholdPct ,weak-hash-threshold-pct) + (disableSparseFiles ,(bool->xml-string disable-sparse-files?)) + (disableTempIndexes ,(bool->xml-string disable-temp-indexes?)) + (paused ,(bool->xml-string paused?)) + (weakHashThresholdPct ,weak-hash-threshold-percentage) (markerName ,marker-name) - (copyOwnershipFromParent ,copy-ownership-from-parent) - (modTimeWindowS ,mod-time-window-s) + (copyOwnershipFromParent ,(bool->xml-string copy-ownership-from-parent?)) + (modTimeWindowS ,mod-time-window-seconds) (maxConcurrentWrites ,max-concurrent-writes) - (disableFsync ,disable-fsync) + (disableFsync ,(bool->xml-string disable-fsync?)) (blockPullOrder ,block-pull-order) (copyRangeMethod ,copy-range-method) - (caseSensitiveFS ,case-sensitive-fs) - (junctionsAsDirs ,junctions-as-dirs) - (syncOwnership ,sync-ownership) - (sendOwnership ,send-ownership) - (syncXattrs ,sync-xattrs) - (sendXattrs ,send-xattrs) + (caseSensitiveFS ,(bool->xml-string case-sensitive-file-system?)) + (junctionsAsDirs ,(bool->xml-string junctions-as-dirs?)) + (syncOwnership ,(bool->xml-string sync-ownership?)) + (sendOwnership ,(bool->xml-string send-ownership?)) + (syncXattrs ,(bool->xml-string sync-xattrs?)) + (sendXattrs ,(bool->xml-string send-xattrs?)) (xattrFilter (maxSingleEntrySize ,xattr-filter-max-single-entry-size) (maxTotalSize ,xattr-filter-max-total-size))))) @@ -244,16 +256,16 @@ (define-record-type* (path "~/Sync"))))) (devices syncthing-config-devices (default '())) - (gui-enabled syncthing-config-gui-enabled (default "true")) - (gui-tls syncthing-config-gui-tls (default "false")) - (gui-debugging syncthing-config-gui-debugging (default "false")) - (gui-send-basic-auth-prompt syncthing-config-gui-send-basic-auth-prompt (default "false")) + (gui-enabled? syncthing-config-gui-enabled? (default #t)) + (gui-tls? syncthing-config-gui-tls? (default #f)) + (gui-debugging? syncthing-config-gui-debugging? (default #f)) + (gui-send-basic-authorization-prompt? syncthing-config-gui-send-basic-authorization-prompt? (default #f)) (gui-address syncthing-config-gui-address (default "127.0.0.1:8384")) (gui-user syncthing-config-gui-user (default #f)) (gui-password syncthing-config-gui-password (default #f)) (gui-apikey syncthing-config-gui-apikey (default #f)) (gui-theme syncthing-config-gui-theme (default "default")) - (ldap-enabled syncthing-config-ldap-enabled (default #f)) + (ldap-enabled? syncthing-config-ldap-enabled? (default #f)) (ldap-address syncthing-config-ldap-address (default "")) (ldap-bind-dn syncthing-config-ldap-bind-dn (default "")) (ldap-transport syncthing-config-ldap-transport (default "")) @@ -262,59 +274,59 @@ (define-record-type* (ldap-search-filter syncthing-config-ldap-search-filter (default "")) (listen-address syncthing-config-listen-address (default "default")) (global-announce-server syncthing-config-global-announce-server (default "default")) - (global-announce-enabled syncthing-config-global-announce-enabled (default "true")) - (local-announce-enabled syncthing-config-local-announce-enabled (default "true")) - (local-announce-port syncthing-config-local-announce-port (default "21027")) - (local-announce-mcaddr syncthing-config-local-announce-mcaddr (default "[ff12::8384]:21027")) - (max-send-kbps syncthing-config-max-send-kbps (default "0")) - (max-recv-kbps syncthing-config-max-recv-kbps (default "0")) - (reconnection-interval-s syncthing-config-reconnection-interval-s (default "60")) - (relays-enabled syncthing-config-relays-enabled (default "true")) - (relay-reconnect-interval-m syncthing-config-relay-reconnect-interval-m (default "10")) - (start-browser syncthing-config-start-browser (default "true")) - (nat-enabled syncthing-config-nat-enabled (default "true")) - (nat-lease-minutes syncthing-config-nat-lease-minutes (default "60")) - (nat-renewal-minutes syncthing-config-nat-renewal-minutes (default "30")) - (nat-timeout-seconds syncthing-config-nat-timeout-seconds (default "10")) - (ur-accepted syncthing-config-ur-accepted (default "0")) - (ur-seen syncthing-config-ur-seen (default "0")) - (ur-unique-id syncthing-config-ur-unique-id (default "")) - (ur-url syncthing-config-ur-url (default "https://data.syncthing.net/newdata")) - (ur-post-insecurely syncthing-config-ur-post-insecurely (default "false")) - (ur-initial-delay-s syncthing-config-ur-initial-delay-s (default "1800")) - (auto-upgrade-interval-h syncthing-config-auto-upgrade-interval-h (default "12")) - (upgrade-to-pre-releases syncthing-config-upgrade-to-pre-releases (default "false")) - (keep-temporaries-h syncthing-config-keep-temporaries-h (default "24")) - (cache-ignored-files syncthing-config-cache-ignored-files (default "false")) - (progress-update-interval-s syncthing-config-progress-update-interval-s (default "5")) - (limit-bandwidth-in-lan syncthing-config-limit-bandwidth-in-lan (default "false")) + (global-announce-enabled? syncthing-config-global-announce-enabled? (default #t)) + (local-announce-enabled? syncthing-config-local-announce-enabled? (default #t)) + (local-announce-port syncthing-config-local-announce-port (default 21027)) + (local-announce-mac-address syncthing-config-local-announce-mac-address (default "[ff12::8384]:21027")) + (max-send-kbps syncthing-config-max-send-kbps (default 0)) + (max-receive-kbps syncthing-config-max-receive-kbps (default 0)) + (reconnection-interval-seconds syncthing-config-reconnection-interval-seconds (default 60)) + (relays-enabled? syncthing-config-relays-enabled? (default #t)) + (relay-reconnect-interval-minutes syncthing-config-relay-reconnect-interval-minutes (default 10)) + (start-browser? syncthing-config-start-browser? (default #t)) + (nat-enabled? syncthing-config-nat-enabled? (default #t)) + (nat-lease-minutes syncthing-config-nat-lease-minutes (default 60)) + (nat-renewal-minutes syncthing-config-nat-renewal-minutes (default 30)) + (nat-timeout-seconds syncthing-config-nat-timeout-seconds (default 10)) + (usage-reporting-accepted syncthing-config-usage-reporting-accepted (default 0)) + (usage-reporting-seen syncthing-config-usage-reporting-seen (default 0)) + (usage-reporting-unique-id syncthing-config-usage-reporting-unique-id (default "")) + (usage-reporting-url syncthing-config-usage-reporting-url (default "https://data.syncthing.net/newdata")) + (usage-reporting-post-insecurely? syncthing-config-usage-reporting-post-insecurely? (default #f)) + (usage-reporting-initial-delay-seconds syncthing-config-usage-reporting-initial-delay-seconds (default 1800)) + (auto-upgrade-interval-hours syncthing-config-auto-upgrade-interval-hours (default 12)) + (upgrade-to-pre-releases? syncthing-config-upgrade-to-pre-releases? (default #f)) + (keep-temporaries-hours syncthing-config-keep-temporaries-hours (default 24)) + (cache-ignored-files? syncthing-config-cache-ignored-files? (default #f)) + (progress-update-interval-seconds syncthing-config-progress-update-interval-seconds (default 5)) + (limit-bandwidth-in-lan? syncthing-config-limit-bandwidth-in-lan? (default #f)) (min-home-disk-free-unit syncthing-config-min-home-disk-free-unit (default "%")) - (min-home-disk-free syncthing-config-min-home-disk-free (default "1")) + (min-home-disk-free syncthing-config-min-home-disk-free (default 1)) (releases-url syncthing-config-releases-url (default "https://upgrades.syncthing.net/meta.json")) - (overwrite-remote-device-names-on-connect syncthing-config-overwrite-remote-device-names-on-connect (default "false")) - (temp-index-min-blocks syncthing-config-temp-index-min-blocks (default "10")) + (overwrite-remote-device-names-on-connect? syncthing-config-overwrite-remote-device-names-on-connect? (default #f)) + (temp-index-min-blocks syncthing-config-temp-index-min-blocks (default 10)) (unacked-notification-id syncthing-config-unacked-notification-id (default "authenticationUserAndPassword")) - (traffic-class syncthing-config-traffic-class (default "0")) - (set-low-priority syncthing-config-set-low-priority (default "true")) - (max-folder-concurrency syncthing-config-max-folder-concurrency (default "0")) + (traffic-class syncthing-config-traffic-class (default 0)) + (set-low-priority? syncthing-config-set-low-priority? (default #t)) + (max-folder-concurrency syncthing-config-max-folder-concurrency (default 0)) (crash-reporting-url syncthing-config-crash-reporting-url (default "https://crash.syncthing.net/newcrash")) - (crash-reporting-enabled syncthing-config-crash-reporting-enabled (default "true")) - (stun-keepalive-start-s syncthing-config-stun-keepalive-start-s (default "180")) - (stun-keepalive-min-s syncthing-config-stun-keepalive-min-s (default "20")) + (crash-reporting-enabled? syncthing-config-crash-reporting-enabled? (default #t)) + (stun-keepalive-start-seconds syncthing-config-stun-keepalive-start-seconds (default 180)) + (stun-keepalive-min-seconds syncthing-config-stun-keepalive-min-seconds (default 20)) (stun-server syncthing-config-stun-server (default "default")) (database-tuning syncthing-config-database-tuning (default "auto")) - (max-concurrent-incoming-request-kib syncthing-config-max-concurrent-incoming-request-kib (default "0")) - (announce-lan-addresses syncthing-config-announce-lan-addresses (default "true")) - (send-full-index-on-upgrade syncthing-config-send-full-index-on-upgrade (default "false")) - (connection-limit-enough syncthing-config-connection-limit-enough (default "0")) - (connection-limit-max syncthing-config-connection-limit-max (default "0")) - (insecure-allow-old-tlsVersions syncthing-config-insecure-allow-old-tlsVersions (default "false")) - (connection-priority-tcp-lan syncthing-config-connection-priority-tcp-lan (default "10")) - (connection-priority-quic-lan syncthing-config-connection-priority-quic-lan (default "20")) - (connection-priority-tcp-wan syncthing-config-connection-priority-tcp-wan (default "30")) - (connection-priority-quic-wan syncthing-config-connection-priority-quic-wan (default "40")) - (connection-priority-relay syncthing-config-connection-priority-relay (default "50")) - (connection-priority-upgrade-threshold syncthing-config-connection-priority-upgrade-threshold (default "0")) + (max-concurrent-incoming-request-kib syncthing-config-max-concurrent-incoming-request-kib (default 0)) + (announce-lan-addresses? syncthing-config-announce-lan-addresses? (default #t)) + (send-full-index-on-upgrade? syncthing-config-send-full-index-on-upgrade? (default #f)) + (connection-limit-enough syncthing-config-connection-limit-enough (default 0)) + (connection-limit-max syncthing-config-connection-limit-max (default 0)) + (insecure-allow-old-tls-versions? syncthing-config-insecure-allow-old-tls-versions? (default #f)) + (connection-priority-tcp-lan syncthing-config-connection-priority-tcp-lan (default 10)) + (connection-priority-quic-lan syncthing-config-connection-priority-quic-lan (default 20)) + (connection-priority-tcp-wan syncthing-config-connection-priority-tcp-wan (default 30)) + (connection-priority-quic-wan syncthing-config-connection-priority-quic-wan (default 40)) + (connection-priority-relay syncthing-config-connection-priority-relay (default 50)) + (connection-priority-upgrade-threshold syncthing-config-connection-priority-upgrade-threshold (default 0)) (default-folder syncthing-config-default-folder (default (syncthing-folder (label "") (path "~")))) (default-device syncthing-config-default-device @@ -324,25 +336,30 @@ (define-record-type* (define syncthing-config-file->sxml (match-record-lambda (folders - devices gui-enabled gui-tls gui-debugging gui-send-basic-auth-prompt - gui-address gui-user gui-password gui-apikey gui-theme ldap-enabled - ldap-address ldap-bind-dn ldap-transport ldap-insecure-skip-verify - ldap-search-base-dn ldap-search-filter listen-address global-announce-server - global-announce-enabled local-announce-enabled local-announce-port - local-announce-mcaddr max-send-kbps max-recv-kbps reconnection-interval-s - relays-enabled relay-reconnect-interval-m start-browser nat-enabled - nat-lease-minutes nat-renewal-minutes nat-timeout-seconds ur-accepted - ur-seen ur-unique-id ur-url ur-post-insecurely ur-initial-delay-s - auto-upgrade-interval-h upgrade-to-pre-releases keep-temporaries-h - cache-ignored-files progress-update-interval-s limit-bandwidth-in-lan + devices gui-enabled? gui-tls? gui-debugging? + gui-send-basic-authorization-prompt? gui-address gui-user gui-password + gui-apikey gui-theme ldap-enabled? ldap-address ldap-bind-dn + ldap-transport ldap-insecure-skip-verify ldap-search-base-dn + ldap-search-filter listen-address global-announce-server + global-announce-enabled? local-announce-enabled? local-announce-port + local-announce-mac-address max-send-kbps max-receive-kbps + reconnection-interval-seconds relays-enabled? + relay-reconnect-interval-minutes start-browser? nat-enabled? + nat-lease-minutes nat-renewal-minutes nat-timeout-seconds + usage-reporting-accepted usage-reporting-seen usage-reporting-unique-id + usage-reporting-url usage-reporting-post-insecurely? + usage-reporting-initial-delay-seconds auto-upgrade-interval-hours + upgrade-to-pre-releases? keep-temporaries-hours cache-ignored-files? + progress-update-interval-seconds limit-bandwidth-in-lan? min-home-disk-free-unit min-home-disk-free releases-url - overwrite-remote-device-names-on-connect temp-index-min-blocks - unacked-notification-id traffic-class set-low-priority max-folder-concurrency - crash-reporting-url crash-reporting-enabled stun-keepalive-start-s - stun-keepalive-min-s stun-server database-tuning - max-concurrent-incoming-request-kib announce-lan-addresses - send-full-index-on-upgrade connection-limit-enough connection-limit-max - insecure-allow-old-tlsVersions connection-priority-tcp-lan + overwrite-remote-device-names-on-connect? temp-index-min-blocks + unacked-notification-id traffic-class set-low-priority? + max-folder-concurrency crash-reporting-url crash-reporting-enabled? + stun-keepalive-start-seconds stun-keepalive-min-seconds stun-server + database-tuning max-concurrent-incoming-request-kib + announce-lan-addresses? send-full-index-on-upgrade? + connection-limit-enough connection-limit-max + insecure-allow-old-tls-versions? connection-priority-tcp-lan connection-priority-quic-lan connection-priority-tcp-wan connection-priority-quic-wan connection-priority-relay connection-priority-upgrade-threshold default-folder default-device @@ -364,16 +381,16 @@ (define syncthing-config-file->sxml (lambda (device1 device2) (string= (syncthing-device-id device1) (syncthing-device-id device2))))) - (gui (@ (enabled ,gui-enabled) - (tls ,gui-tls) - (debugging ,gui-debugging) - (sendBasicAuthPrompt ,gui-send-basic-auth-prompt)) + (gui (@ (enabled ,(bool->xml-string gui-enabled?)) + (tls ,(bool->xml-string gui-tls?)) + (debugging ,(bool->xml-string gui-debugging?)) + (sendBasicAuthPrompt ,(bool->xml-string gui-send-basic-authorization-prompt?))) (address ,gui-address) ,@(if gui-user `((user ,gui-user)) '()) ,@(if gui-password `((password ,gui-password)) '()) ,@(if gui-apikey `((apikey ,gui-apikey)) '()) (theme ,gui-theme)) - (ldap ,(if ldap-enabled + (ldap ,(if ldap-enabled? `((address ,ldap-address) (bindDN ,ldap-bind-dn) ,@(if ldap-transport @@ -391,53 +408,53 @@ (define syncthing-config-file->sxml "")) (options (listenAddress ,listen-address) (globalAnnounceServer ,global-announce-server) - (globalAnnounceEnabled ,global-announce-enabled) - (localAnnounceEnabled ,local-announce-enabled) + (globalAnnounceEnabled ,(bool->xml-string global-announce-enabled?)) + (localAnnounceEnabled ,(bool->xml-string local-announce-enabled?)) (localAnnouncePort ,local-announce-port) - (localAnnounceMCAddr ,local-announce-mcaddr) + (localAnnounceMCAddr ,local-announce-mac-address) (maxSendKbps ,max-send-kbps) - (maxRecvKbps ,max-recv-kbps) - (reconnectionIntervalS ,reconnection-interval-s) - (relaysEnabled ,relays-enabled) - (relayReconnectIntervalM ,relay-reconnect-interval-m) - (startBrowser ,start-browser) - (natEnabled ,nat-enabled) + (maxRecvKbps ,max-receive-kbps) + (reconnectionIntervalS ,reconnection-interval-seconds) + (relaysEnabled ,(bool->xml-string relays-enabled?)) + (relayReconnectIntervalM ,relay-reconnect-interval-minutes) + (startBrowser ,(bool->xml-string start-browser?)) + (natEnabled ,(bool->xml-string nat-enabled?)) (natLeaseMinutes ,nat-lease-minutes) (natRenewalMinutes ,nat-renewal-minutes) (natTimeoutSeconds ,nat-timeout-seconds) - (urAccepted ,ur-accepted) - (urSeen ,ur-seen) - (urUniqueID ,ur-unique-id) - (urURL ,ur-url) - (urPostInsecurely ,ur-post-insecurely) - (urInitialDelayS ,ur-initial-delay-s) - (autoUpgradeIntervalH ,auto-upgrade-interval-h) - (upgradeToPreReleases ,upgrade-to-pre-releases) - (keepTemporariesH ,keep-temporaries-h) - (cacheIgnoredFiles ,cache-ignored-files) - (progressUpdateIntervalS ,progress-update-interval-s) - (limitBandwidthInLan ,limit-bandwidth-in-lan) + (urAccepted ,usage-reporting-accepted) + (urSeen ,usage-reporting-seen) + (urUniqueID ,usage-reporting-unique-id) + (urURL ,usage-reporting-url) + (urPostInsecurely ,(bool->xml-string usage-reporting-post-insecurely?)) + (urInitialDelayS ,usage-reporting-initial-delay-seconds) + (autoUpgradeIntervalH ,auto-upgrade-interval-hours) + (upgradeToPreReleases ,(bool->xml-string upgrade-to-pre-releases?)) + (keepTemporariesH ,keep-temporaries-hours) + (cacheIgnoredFiles ,(bool->xml-string cache-ignored-files?)) + (progressUpdateIntervalS ,progress-update-interval-seconds) + (limitBandwidthInLan ,(bool->xml-string limit-bandwidth-in-lan?)) (minHomeDiskFree (@ (unit ,min-home-disk-free-unit)) ,min-home-disk-free) (releasesURL ,releases-url) - (overwriteRemoteDeviceNamesOnConnect ,overwrite-remote-device-names-on-connect) + (overwriteRemoteDeviceNamesOnConnect ,(bool->xml-string overwrite-remote-device-names-on-connect?)) (tempIndexMinBlocks ,temp-index-min-blocks) (unackedNotificationID ,unacked-notification-id) (trafficClass ,traffic-class) - (setLowPriority ,set-low-priority) + (setLowPriority ,(bool->xml-string set-low-priority?)) (maxFolderConcurrency ,max-folder-concurrency) (crashReportingURL ,crash-reporting-url) - (crashReportingEnabled ,crash-reporting-enabled) - (stunKeepaliveStartS ,stun-keepalive-start-s) - (stunKeepaliveMinS ,stun-keepalive-min-s) + (crashReportingEnabled ,(bool->xml-string crash-reporting-enabled?)) + (stunKeepaliveStartS ,stun-keepalive-start-seconds) + (stunKeepaliveMinS ,stun-keepalive-min-seconds) (stunServer ,stun-server) (databaseTuning ,database-tuning) (maxConcurrentIncomingRequestKiB ,max-concurrent-incoming-request-kib) - (announceLANAddresses ,announce-lan-addresses) - (sendFullIndexOnUpgrade ,send-full-index-on-upgrade) + (announceLANAddresses ,(bool->xml-string announce-lan-addresses?)) + (sendFullIndexOnUpgrade ,(bool->xml-string send-full-index-on-upgrade?)) (connectionLimitEnough ,connection-limit-enough) (connectionLimitMax ,connection-limit-max) - (insecureAllowOldTLSVersions ,insecure-allow-old-tlsVersions) + (insecureAllowOldTLSVersions ,(bool->xml-string insecure-allow-old-tls-versions?)) (connectionPriorityTcpLan ,connection-priority-tcp-lan) (connectionPriorityQuicLan ,connection-priority-quic-lan) (connectionPriorityTcpWan ,connection-priority-tcp-wan) @@ -532,7 +549,6 @@ (define syncthing-shepherd-service (respawn? #f) (stop #~(make-kill-destructor)))))) - (define syncthing-files-service (match-record-lambda (config-file user home home-service?) (if config-file @@ -541,7 +557,7 @@ (define syncthing-files-service ;; and the skeletons to never be applied to that user's home. In such ;; cases, put the config at /var/lib/syncthing-/config.xml `((,(if home-service? - ".config/syncthing/config.xml" + ".local/state/syncthing/config.xml" (string-append "/var/lib/syncthing-" user "/config.xml")) ,(if (file-like? config-file) config-file