From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id yJanEipzQ2WpggEAauVa8A:P1 (envelope-from ) for ; Thu, 02 Nov 2023 11:00:10 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id yJanEipzQ2WpggEAauVa8A (envelope-from ) for ; Thu, 02 Nov 2023 11:00:10 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id BD2CD138DA for ; Thu, 2 Nov 2023 11:00:08 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=elephly.net header.s=zoho header.b=Llo0p1yT; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; arc=reject ("signature check failed: fail, {[1] = sig:zohomail.com:reject}") ARC-Seal: i=2; s=key1; d=yhetil.org; t=1698919210; a=rsa-sha256; cv=fail; b=H/iu2jsUjJiZ02Og7c2dH9W58L4T1bAKAyxCaU8wh6NXI9RZXwbSO69s7TkwjploJlN8EG NsMqHmESk+yeaCFQ8uQ0TegARBviXcBB/ft8YCd0TeVkheCMIoD2LaNRc229cyvHVxILhw +kgwWHTtlhupKhMpFR4VwfLKaqiS3yyV2PjR7zEwMBsL6LAig4HpiSNiNZN4Po0sZm5HgF DfnHxjq4ckxOShLmQQX6JA7OnQwoSynx47WWIGe54q2UdLS6zSKdaMQitmPZwtfrRqNdy5 uCryJDnEQh/v3T7Smy1Tk5v7vqfgwfpRlTVg/XctZfnM1eDvlE/Pp97vjAwuug== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=elephly.net header.s=zoho header.b=Llo0p1yT; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; arc=reject ("signature check failed: fail, {[1] = sig:zohomail.com:reject}") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1698919210; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=am884MdGVInPKPe/eCrgs2XyfQmOe2c1fOvbiNuR+ac=; b=jTDGQVg+NkTlXdw0kYk7BTWuUG6hVoVrVTIaXmDnRse34h4xhCDjup1HiZTUbe3lMwuGG1 R+vN7zrhK82auzG6/34R/clysKzTlk+XBNZMwlKZJd0EEDY2YN6sb7QHo6we0P0co/EDrr GytI0eZWIOreJvI6FVTmF/Dyd2zpF6u+r7TEmNWjkM01m1WPKoQy5Oy+uwiLFOTi9G0ZDx hRmiuc9EaAdpsWA6oJRUXY8UqodvrylYlzTjFx1XoJ/ADMs8xOgmRGZms7tXCiorRtsrx5 Hge3likTFPC1GW9Z3G8eS/y5VAhMFQ5dxRDP5f4RIPY0Vesq/1GTWbefn92KIQ== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qyUUC-0007Ae-8B; Thu, 02 Nov 2023 05:59:36 -0400 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 1qyUU5-0007AK-Dr for guix-patches@gnu.org; Thu, 02 Nov 2023 05:59:29 -0400 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 1qyUU5-0008JU-64 for guix-patches@gnu.org; Thu, 02 Nov 2023 05:59:29 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qyUUc-0000cL-US for guix-patches@gnu.org; Thu, 02 Nov 2023 06:00:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#66557] [PATCH] home: services: Add goimapnotify service. References: In-Reply-To: Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 02 Nov 2023 10:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66557 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 66557@debbugs.gnu.org Received: via spool by 66557-submit@debbugs.gnu.org id=B66557.16989191902316 (code B ref 66557); Thu, 02 Nov 2023 10:00:02 +0000 Received: (at 66557) by debbugs.gnu.org; 2 Nov 2023 09:59:50 +0000 Received: from localhost ([127.0.0.1]:53958 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qyUUQ-0000bI-7p for submit@debbugs.gnu.org; Thu, 02 Nov 2023 05:59:50 -0400 Received: from sender3-of-o57.zoho.com ([136.143.184.57]:21756) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qyUUM-0000b6-Bm for 66557@debbugs.gnu.org; Thu, 02 Nov 2023 05:59:49 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1698919148; cv=none; d=zohomail.com; s=zohoarc; b=LztJ6BJW7uhw1ara1Zj+KV8dEH+Du0WtQ3zMvoGnHEAeQpYThLADFgn3IY0sehOt/K7hbM7Mx9HL4VWQp6KNI3ShWw2SCcQfSZvBNyCzWzrqA/hBPx7LgIpBdtojWKbWwNfC8qHUh9qUtCy8e3YC/6A4DMsiHvYpDT6p9hsKf18= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698919148; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=am884MdGVInPKPe/eCrgs2XyfQmOe2c1fOvbiNuR+ac=; b=BaGe3pRoNfHwno99Iu1doU5QK7+5Iq90RvERS/7uZr3pT1RWjNwtiZDb5BypQsoVSSuG2ExFeZtdEX+QEh1Kfy1TIjC0JZGdIkJLPCVgbTTD9t4TorrdreSpfXobXefjhQJgO1+QWFR/loI80hsckA56m+WLTukNRw0G/7MSA8s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1698919148; s=zoho; d=elephly.net; i=rekado@elephly.net; h=From:From:To:To:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To:Cc; bh=am884MdGVInPKPe/eCrgs2XyfQmOe2c1fOvbiNuR+ac=; b=Llo0p1yTBjBI5kS503LT+G9ocoYk/zxzPWIXn4aIrK86LfdFRXzZgUMfmxXYulfP 1sN+HTDxaaecGPQDwwWvoYGMak+nhKxrUPOtdwis9F6pB0orYhAPtjPJMmcQvoHWm4o EiLAAHOpG8W0P/h8HBcw8ccH891wXGXzesMqWVHc= Received: from localhost (215-110-142-46.pool.kielnet.net [46.142.110.215]) by mx.zohomail.com with SMTPS id 1698919145488104.9143966336178; Thu, 2 Nov 2023 02:59:05 -0700 (PDT) User-agent: mu4e 1.10.7; emacs 29.1 From: Ricardo Wurmus Date: Thu, 02 Nov 2023 09:55:15 +0100 Message-ID: <87h6m4tr15.fsf@elephly.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: BD2CD138DA X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -2.11 X-Spam-Score: -2.11 X-TUID: eso9+qRH1MR8 Hi Nils, thank you for this service! I had been looking for a goimapnotify service just a few days ago, so this will definitely come in handy. I don=E2=80=99t have the time for a comprehensive review, but I=E2=80=99ll = comment on a few things that stuck out to me. > + (password-cmd "pass my-private-email= -account") > + (on-new-mail > + (file-append mbsync "/bin/mbsync p= rivate-account")) It seems wrong to me to compose a command as a single string. Usually we separate the executable from the arguments. People who want to run the command in a shell can still do that by using =E2=80=9C/bin/sh=E2=80=9D= =E2=80=9C-c=E2=80=9D =E2=80=9Ccommand string=E2=80=9D. So I think it would be better to let these fields accept command lists. FILE-APPEND should only join the package value with the file name of the executable, but not include any arguments. I suppose these values end up in the generated configuration file as plain strings anyway, so perhaps it doesn=E2=80=99t matter much. In that c= ase please also use FILE-APPEND to embed a reference to PASS. > +(define (goimapnotify-serialize-field field-name value) > + "This is converted to JSON later, so we don't return a string here" > + #~(#$(goimapnotify-format-field field-name) . #$value)) Could this be (cons (goimapnotify-format-field field-name) value) instead? I don=E2=80=99t think we need this wrapping and unwrapping with G= -exp syntax. > +(define (prepare-configuration-for-json config fields) > + "Convert the configuration to the format expected by guile-json. > + Unset maybe-values do not appear in the configuration file." > + (filter > + (lambda (val) > + (not (unspecified? val))) > + (map > + (lambda (field) > + (let ((value ((configuration-field-getter field) config))) > + (if (maybe-value-set? value) > + ((configuration-field-serializer field) > + (configuration-field-name field) > + value) > + *unspecified*))) > + fields))) This looks a little too convoluted to me. It=E2=80=99s the IF with the *UNSPECIFIED* as the second branch (followed by the filter) that doesn=E2= =80=99t strike me as nice. Perhaps you simplify this with a fold? In any case, the filter predicate could be (negate unspecified?) instead of the lambda expression. > ; See https://gitlab.com/shackra/goimapnotify/-/blob/master/config.go?ref= _type=3Dheads#L46-62 Please don=E2=80=99t use =E2=80=9Cmaster=E2=80=9D here, because it=E2=80=99= s a moving target, so the line anchors will become out of date. Please use an arbitrary recent commit instead. Since this is a line comment please use =E2=80=9C;;=E2=80= =9D instead of =E2=80=9C;=E2=80=9D (which is used for comments in the margin). > +(define (list-of-goimapnotify-accounts? lst) > + "List is in the form of '((file-name file-like))" > + (every (lambda (element) > + (match element > + ((string ($ )) > + #t) > + (_ #f))) > + lst)) The indentation for the MATCH clauses is too deep. There are other instances of oddly deep indentation, such as the body of =E2=80=9C(define-configuration/no-serialization home-goimapnotify-configura= tion =E2=80=A6)=E2=80=9D. Are you using Emacs? Since you=E2=80=99re throwing away the first element you can reduce this to: (every (compose goimapnotify-account? second) lst) I haven=E2=80=99t looked at the documentation much, but the capitalization = of =E2=80=9CStdin=E2=80=9D and the spurious changes to seemingly empty lines i= n existing documentation stood out to me. It would be better to undo the changes to unrelated documentation in the same file. --=20 Ricardo