From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id KKzBHutpUGYBagAAe85BDQ:P1 (envelope-from ) for ; Fri, 24 May 2024 12:20:27 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id KKzBHutpUGYBagAAe85BDQ (envelope-from ) for ; Fri, 24 May 2024 12:20:27 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=wolfsden.cz header.s=mail header.b=ryag733j; dkim=pass header.d=wolfsden.cz header.s=mail header.b=RSkqTiUt; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=wolfsden.cz ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1716546027; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=ybR/T9LsBi9nYRPqfWtRRAudIPpzW8L+g0mqBQnlFVY=; b=Drh8/gyRlXn0pfa6cU1n544fczYe0pvERs7daXUln5Qwes5jZvzmzyT+YgmVkbPnHr7prz tHGiKgqZCLdOpTciw6bJ5IIRhUfyGmMgfpFlesC2BnCCdcJc3CIQwTn3X/bRnpSEGKPPrb G+3NcdITNFI5UxhImP+5V+pB9Jp9aFIegr1svRu6yn+HqA8oSVwe11ADSqb2XreHhpvYbQ P8kmerFDvcAQKSoCaytkCQ/qPxuWk8Yz4Xli0WU1n4W6YpsqnihgdnTVjjqgkfZirU6NbB YK8UzqvgXW906gcTNLKfKAdk/3/wBCJ5yq36biiocGVlyQfFV8xQZ6RMaQbXvA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=wolfsden.cz header.s=mail header.b=ryag733j; dkim=pass header.d=wolfsden.cz header.s=mail header.b=RSkqTiUt; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=wolfsden.cz ARC-Seal: i=1; s=key1; d=yhetil.org; t=1716546027; a=rsa-sha256; cv=none; b=OLqkoEII3i1x/OyUgv2/S9aXw78j9b3RPUDcR6UaED4wSsKU7jzPWD+YJ/VoATSeQjAaE3 AmvHCrsuzfEM+MyenrDUMYRh1RItasQwrt+yrYLmZ/G+wWpNDOn8GS64TPmnUTnjxPG5LX GaPnYbe+jKkTjL+w0Dl8XfP4r0zNHMgj0vG3yLzp9/eY4Oe2Ju4L+AbUzOUp2MFyS4TUmQ PaD0c/LJEUyLKy8iP5uzDbdtmXbAjii5vMu3BapjPDjX26bEriws4cyxkjsR461YPeiUPJ FQ0QSSZlevMMkqEHYADl6xamxjN7Tcaa6sL9/oEH18VKseWV63ma3cI1AcRKvA== 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 F16E923362 for ; Fri, 24 May 2024 12:20:26 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sAS1k-00030K-NM; Fri, 24 May 2024 06:19:56 -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 <~@wolfsden.cz>) id 1sAS1d-0002te-1I for help-guix@gnu.org; Fri, 24 May 2024 06:19:50 -0400 Received: from wolfsden.cz ([37.205.8.62]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <~@wolfsden.cz>) id 1sAS1a-0001TG-EI for help-guix@gnu.org; Fri, 24 May 2024 06:19:48 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id 25FBB29863A; Fri, 24 May 2024 10:19:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1716545981; bh=jSH412LPM0JKp1OTWlQYfdD7NNQo6EKGeVgIVLKXqa0=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=ryag733jlhiZyjIZ6bJYDLSMogn7dDEi3Wv2U2BnXm2IGAeuBAq7Uf6bd/+I7bTuq 8ByA/02YLI2ZZfOKrsV892Nd0cPaelAGNOyhppA/2WnhWJ41RGWtnwxaqA5zL/XEAe omH2dUoIgueWsfIQuPNt3Y5Zm+auPUHPvpqGV6ihCZk0F+5TbTsa5Qs++xyGLOMorM qMEHHxpPakPLKG+4fNzsBlv6imXVStUiXb6L32OlrfZl19sA9dLqO/gTHYDK/mA6NE Ku8VG13v9WlQ/yhn1vHBDrUBMVQluUFPyg3Mxqk+Lh1t/ZUSA/RoPUJ+5q0VR7I3ou GJHzOcI3T4B3NcF8npOpIoRCllUTaZMLMJoIx108b9NXN5KAf0239syp3/0d27k5kC izxAik4epBUh6d6nKjt+qhfKkPmgp92ZYWWZV3w9G7yX6K6gVWixs6W92U8r5crGd+ dfaDjKPRQrs5zvS0UuOER4YrFRRQeCRHN1okwR2oqzgiKiWM02qRjBUEz3aiPSEUj7 W+ZWBR1F5zhxiAcJ9RQRhY8XfTTi1QL8VSxd/2tJTTCfv80/jCDA0y4rz8kBGREzZM +T2c3CPljvjqS2OCo2wR1WEMlhN5iwPgOpvddMRipgbRrBxR60TNXC3tmmcZwV1q3j A96hJlBUNYcqxfNm3d3GUz44= Received: from localhost (unknown [193.32.127.159]) by wolfsden.cz (Postfix) with ESMTPSA id DBA7729843F; Fri, 24 May 2024 10:19:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1716545980; bh=jSH412LPM0JKp1OTWlQYfdD7NNQo6EKGeVgIVLKXqa0=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=RSkqTiUt6S7Jt8yddUOmAW6tjl1/ZQDAQlixpg5VErJJU/vA0/koIeuqlSNrk9UTt t86Dwmq2bf3M3yjCEQOYcYaDHxM6fnqttiAoLEKUpi+dWMYKDjK5ZVz6D+hSDz1avq od4DnqiBQAPOWYBDKeUpHb5OtXM5qBdF/c7CDDXXI2B6zz/m+1rzv/yh2I0ID0Cu0B ILUk16LvTXxDbtMI0jcPXPisUjSRfXw9/1xjurfQwwm19mZshPLzWsDALUByLGd+09 UMV5f9hYCEvJKsNeu8//9CTqIqVhQn5i/X5J7sokEY86MSmLM+4bFB9xWcsIrnc9cx RdJcj3lAbOeef8zt8h+AjJ0sOMZ9WsizVQCHnnP3RnCkzzd7o0WKxsaIla32ufQq8t 95VUbL6RMJKufR0kbAZ2k+2aHX2Wc66zg+8xsljQtJBH6CTP9CaUtoDFlC75V51OC7 T5/GkuO6rzKYGPRWbz7CTng0B2u4V0bbSP9RG4yrFDee/WQ3kGYg1sf6VZQt6kdxeW X6CFdUH4LGz/SuZg2g7tcyzyJxZcI7iFxyDbNUaHKBpdwCkNq2DM57wQdKPztn/ZBg xIT3HtN07V1yeyEmYn2LPOcidNBQ8Dg0Vs9y0mwbRf+b0EclDbPrbUG74f6+5ReTv9 p21iqNMlx0jqIkLi7MxRcGus= Date: Fri, 24 May 2024 12:19:39 +0200 From: Tomas Volf <~@wolfsden.cz> To: Tristan Kohl Cc: help-guix@gnu.org Subject: Re: How to configure smartd and send notifications? Message-ID: Mail-Followup-To: Tristan Kohl , help-guix@gnu.org References: <4D873504-6540-477A-A2DB-DE293395CAFC.ref@ymail.com> <4D873504-6540-477A-A2DB-DE293395CAFC@ymail.com> <87seycu3df.fsf@lease-up.com> <87msokttht.fsf@lease-up.com> <0525BF4D-96C2-4F58-BB27-19A88DD8403E@ymail.com> <87jzjot5it.fsf@lease-up.com> <79C29ABD-8FFC-4930-A8E0-798ABF4EEB11@ymail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="HHdVWuRT1/+jzIjf" Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=37.205.8.62; envelope-from=~@wolfsden.cz; helo=wolfsden.cz X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: help-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Spam-Score: -10.50 X-Migadu-Queue-Id: F16E923362 X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -10.50 X-TUID: T+UYHTrgUb5I --HHdVWuRT1/+jzIjf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On 2024-05-23 21:25:08 +0200, Tristan Kohl via wrote: > Well look at me. So focused in my old ways on constructing a shell script that I did not even think about using Guile as the executable :D > > Thank you Thomas an Felix for your pointers! > > I read up about G-Expressions and got it almost working. But I must miss something because when executing the build result it makes the request successfully (checked return of http-get with pk and logs on the server) but still fails with this error: > > Backtrace: > 0 (primitive-load "/gnu/store/9gjnc0p...") > > ERROR: In procedure primitive-load: > Wrong type to apply: # > > > (use-module (gnu) (guix modules)) > (use-package-modules tls) > > (define smartd-send-ntfy > (program-file "smartd-send-ntfy" > (with-extensions (list gnutls) > (with-imported-modules > (source-module-closure '((web client))) > #~((use-modules (web client)) > (http-get "https://example.com")))))) I think g-exp needs to be a single expression. In other words, add `begin' in there. In your code you are basically trying to apply result of `(use-modules ...)' to result of `(http-get ...)'. Since use-modules do not return anything, you get the error above. You can test it using just plain guile and you will get the same error: guile -c '((use-modules (web client)) (http-get "https://example.org"))' I think this should work: (define smartd-send-ntfy (program-file "smartd-send-ntfy" (with-extensions (list gnutls) (with-imported-modules (source-module-closure '((web client))) #~(begin (use-modules (web client)) (http-get "https://example.com")))))) Your original code: $ guix repl Loading Guix REPL meta-commands... Increasing build verbosity... Disabling grafting... GNU Guile 3.0.9 Copyright (C) 1995-2023 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guix-user)> ,use (guix) scheme@(guix-user)> #~((use-modules (web client)) (http-get "https://example.com")) $1 = # scheme@(guix-user)> (program-file "test" $1) $2 = #< name: "test" gexp: # guile: #f path: ("/gnu/store/ff1cyww9qlra4849q6k0n30w7q67ziim-guix-module-union/share/guile/site/3.0" "/gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9/share/guile/3.0" "/gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9/share/guile/3.0" "/gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9/share/guile/site/3.0" "/gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9/share/guile/site" "/gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9/share/guile" "/home/wolf/.guix-home/profile/share/guile/site/3.0" "/run/current-system/profile/share/guile/site/3.0")> scheme@(guix-user)> ,lower $2 $3 = # /gnu/store/50m45lc93x7fayaq3y7kzi2zhjz7qwdz-test 7f6c35dd5d70> scheme@(guix-user)> ,build $3 building /gnu/store/x3rkbl47j83d5ps8r8a915blks6hfbin-test.drv... successfully built /gnu/store/x3rkbl47j83d5ps8r8a915blks6hfbin-test.drv $4 = "/gnu/store/50m45lc93x7fayaq3y7kzi2zhjz7qwdz-test" scheme@(guix-user)> (system $4) Backtrace: 0 (primitive-load "/gnu/store/50m45lc93x7fayaq3y7kzi2zhjz7qwdz-test") ERROR: In procedure primitive-load: Wrong type to apply: # $5 = 256 Now with the `begin': scheme@(guix-user)> #~(begin (use-modules (web client)) (http-get "https://example.com")) $6 = # scheme@(guix-user)> (program-file "test" $6) $7 = #< name: "test" gexp: # guile: #f path: ("/gnu/store/ff1cyww9qlra4849q6k0n30w7q67ziim-guix-module-union/share/guile/site/3.0" "/gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9/share/guile/3.0" "/gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9/share/guile/3.0" "/gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9/share/guile/site/3.0" "/gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9/share/guile/site" "/gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9/share/guile" "/home/wolf/.guix-home/profile/share/guile/site/3.0" "/run/current-system/profile/share/guile/site/3.0" "/gnu/store/s2cf4ibjw0g6npx0ia54x5xg6hzangn7-wolfsden/share/guile/site/3.0" "/gnu/store/czkzwa77lr39ayj016vhqrbhf2da2isr-nonguix/share/guile/site/3.0")> scheme@(guix-user)> ,lower $7 $8 = # /gnu/store/7ylpw11r0sbdc2z02sir5gcr552dqks6-test 7f6c3606cb40> scheme@(guix-user)> ,build $8 building /gnu/store/7xcnijz3cf4231sdg0df5hig259k38nf-test.drv... successfully built /gnu/store/7xcnijz3cf4231sdg0df5hig259k38nf-test.drv $9 = "/gnu/store/7ylpw11r0sbdc2z02sir5gcr552dqks6-test" scheme@(guix-user)> (system $9) $10 = 0 > > > On 21 May 2024 17:50:27 CEST, Tomas Volf <~@wolfsden.cz> wrote: > >On 2024-05-21 17:33:24 +0200, Tristan Kohl via wrote: > >> Hello Felix, > >> > >> my last message was not to critizise your help but rather my frustration with my own limited progress. I really appreciate the help! > >> > >> program-file at least results in a usable thing however since the script gets executed by smard I get the "command not found" in my logs. It seems like curl is not in PATH for smartd. Do I need to import something into the gexp? > >> > >> Also those env variables are defined by smartd during runtime depending on which drive produced the error. Therefore I need shell expansion/env variables and have to use system (without *) imho. > >> > >> This is the current state: > >> > >> (define-smartd-send-ntfy > >> (program-file "send-ntfy" > >> #~(system > >> (string-append "curl " "-H \"Title: $SMARTD_SUBJECT\" " ...)))) > > > >Ignoring the obvious quoting issues here (what Felix does with `getenv' seems > >much safer, and should produce the same result?), > > > >> > >> Note: when using system* the error is: > >> In execvp of curl: No such file or directory > > > >This should be solvable by using `file-append', so, basing on the system* > >variant, something like: > > > > #~(system* #$(file-append curl "/bin/curl") ) > > > >Should invoke curl by absolute path. (You need import (gnu packages curl) of > >course.) > > > >Hope this helps, > >Tomas > > > >-- > >There are only two hard things in Computer Science: > >cache invalidation, naming things and off-by-one errors. Have a nice day, Tomas -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors. --HHdVWuRT1/+jzIjf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmZQabsACgkQL7/ufbZ/ wamnzg/9EgOBY72w35jgdDAskNs/zKfRtxOhpyLdsCIyh14WXsXttyoaVAiB6FRg q16xW7/SAvmByBafA7UQOYVk/ZMtYPcbH5JyT7/Y5dY9f4niX8UjHKWoQ6bcuNO/ wby/jY/nQ6iuRJI+M9q1tWb2vYjsD/I1mqJe6m8o+EDBPK9VYL9BMvxD9JtMg71F VIhkUpjHDtN5sLHvFVtIDEi3BeWNQOerPKKMbqmZTGeoKZ3YN+LXE2sHh7ZL8z5c h+5LAUxKFv4xvqrrGVJiM3LqASmBwZ4+cW096Y+ITHHOjS+Pm37/o37RXH21hEbg DHnWC5rS47naWHoXcnlXh4CDkNWhDsttRpSJzy75frYsJzqiaPpgZJcECQOI3Nrf 3lAAtHFHDjIPN82scoUbmHTiMcNBxGlj8vNEW0xJskfX99S6XvuSj4Og9vrwDwJ9 HDXnAmlkauSf3tqeXHzvHFx+ckD5rKoR1K/jPRdEz6RPeTC72B1IpncF61F7duy8 7VZDmTJsyQU6YBrwMbvrLIV5nep26x/UrJxogckoOUqwg30UJ9VxHAZTwwdMqAKN r8FNfTAjsTD67utzQojNu3SchT/TNr7EorVeZ9DUl5+QZeU2CHIr8bc7mA6lahRc agZ7HjZxqFvKEYMeiK4PwxB3lmzCbDNfd6YVTynOfj23/F96dh8= =UwU0 -----END PGP SIGNATURE----- --HHdVWuRT1/+jzIjf--