From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id /JavGovvmmCkagEAgWs5BA (envelope-from ) for ; Tue, 11 May 2021 22:56:43 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id EFPIFYvvmmD8SgAA1q6Kng (envelope-from ) for ; Tue, 11 May 2021 20:56:43 +0000 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 2C14B1B118 for ; Tue, 11 May 2021 22:56:37 +0200 (CEST) Received: from localhost ([::1]:37890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lgZQi-0005W1-Kk for larch@yhetil.org; Tue, 11 May 2021 16:56:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgZOs-0003Vw-PX for emacs-orgmode@gnu.org; Tue, 11 May 2021 16:54:42 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:34497) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgZOq-0004U5-FD for emacs-orgmode@gnu.org; Tue, 11 May 2021 16:54:42 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id ACF5A5C002F; Tue, 11 May 2021 16:54:36 -0400 (EDT) Received: from imap11 ([10.202.2.61]) by compute6.internal (MEProxy); Tue, 11 May 2021 16:54:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unanue.mx; h= mime-version:message-id:in-reply-to:references:date:from:to:cc :subject:content-type:content-transfer-encoding; s=fm2; bh=Sw3UA 1m8t1lyIPq2BwTgF1ORjQ0bqMnhVOkmHZ3RlUM=; b=XYgYgeP6G4eHzBCMPwK1M n7DsgXcgh/lc9y2zKHcN7/Gcb7XpW6Pdjiz5dt31VYWJHN6WmoDGpdd8VeTyDHav ajf5XTPIWeEOqldLNtKXt3U7LcQcyzX0ZSwHvI1gqMOtsDsnOpP4OfpPHeQnd5G2 R0z2WQdmywcPeVP+Enzexwj4RhkPmk2Pnf3AC9kxq/ZZBap/cj89Yn5rBk41XH7v 7GPgXx++NDDS1KbDMo7TTAUF1ux7yvz8Tk75cmgz3mut31j2KEiZCAJSdc+K1fwp 1msbCqR/W2Y3RmISk7SkeV9eoqqnecclZS5h73bpPVrBBKwIWPt2cdP4JSLj376C A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=Sw3UA1m8t1lyIPq2BwTgF1ORjQ0bqMnhVOkmHZ3Rl UM=; b=PDNk97RTitOXuaF1di/CJR8lBtQFP562b9Nbrx/1CvDotggLRscM+C9Nd chCas0czjHanhApbUy+92Mo6vRcl0xcWCykaZCsvKkUzzG/hDYn6tpWnblcCBlTn DHJ/EsMNWoXZhpj1fQo/a0nW9/syjisGr51MRpivtr3VuxDrVANNRcYCq+Ym5CG8 HyyEkx3NSTWpwcStYeTlwjDrAmWiOfUQpMZbhclMwsiP3WHplNBiAqG+GKKb/EvH IApr4gKlFFgNRWfb81/njLMHirKZ6EmCy+hwgLJgSnLat/BfZ3lGqhJ/Vw2DXteD fDk2UBHfQpPPQjU6R8r7H5WmvWf7Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdehtddgudehiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkjghffffhvffutgfgse htqhertderreejnecuhfhrohhmpedfteguohhlfhhoucffvgcufghnrghnuhgvfdcuoegr ugholhhfohdoohhrghesuhhnrghnuhgvrdhmgieqnecuggftrfgrthhtvghrnhephfdtge evieeggeffuefhjeetieeludejleelgfdtjeevtdekgeehgfeiheduvdeunecuffhomhgr ihhnpeifohhrkhhinhhgrdhhohifpdguihhrvghnvhdrnhgvthdpthhhvghshhgrrhhpsh druhhspdhgihhthhhusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgr mhepmhgrihhlfhhrohhmpegrugholhhfohdoohhrghesuhhnrghnuhgvrdhmgi X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 4F14624005D; Tue, 11 May 2021 16:54:36 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-448-gae190416c7-fm-20210505.004-gae190416 Mime-Version: 1.0 Message-Id: In-Reply-To: References: <3d3611c4-17a6-4d55-875b-f566c28d297b@www.fastmail.com> Date: Tue, 11 May 2021 15:54:15 -0500 From: "Adolfo De Unanue" To: emacs-orgmode@gnu.org Subject: Re: ob-sql is not finding psql when using direnv+guix Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=66.111.4.29; envelope-from=adolfo+org@unanue.mx; helo=out5-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: MEC@stowers.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620766600; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=Sw3UA1m8t1lyIPq2BwTgF1ORjQ0bqMnhVOkmHZ3RlUM=; b=biAraPC0AjLu55dEN73Zi9CYOUtyhX6pGevoqWlV6Xz3IJF6/aC5gXd0Zp9lGjdW6BvS97 glOFAAgbrad7Q+NLZIvWfhapW0fvco05z9gOjpiWiJT7tIgvfEIbhIBNnDhIxdj72iKuKw 5R2G1VlDHYmZ7cIQj9VwVxsgLhAiuk3PK35kfXPoLYkfLaxcSbErAd/ilDYBb1ZVmdWSsm zrHhHJHjIoUrMVWFvBGGdqCTCjEOe49KmmW/KSbPCvTtPS1ITwO+BJptEndBwF4FV34Upg B+elxwLJWn4Mv68GZHSIlFz6jDMqOLs6H1e2kvaWBeEBg7JNFDZcRqyRd/8Mfw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620766600; a=rsa-sha256; cv=none; b=FDvIw89IAhX0ZUgfpkk7re+10wPflxB5ikmA+3eo1UxO6zxXqrI5J6Haerj9GiXGqzhGZJ MqvHcJcqi3QyqAZxRyh8D+YiBVEn2PiIovR8f5D7iJH1Vtb59sB957Nm3nGo8fc1ngrZ+s sVxhbgeIjFfiENXSbCn8hDyflIvpb+nd5OvJAzudfrMyN3HVQD0ghn4uuw7CIWYRJTZnhn LxsHL/yuRO4e/QsYp5CF5K12uVheHOqSUz0MiMazuJ3UaC4YxkfhqADpxXNK8jTTEj7AzG cWG9gUb2FK8WvKs/7AJURBgWXEpvTD/at84DKTck1D4Y2QmkRmFqKyIQ5mQCrQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=unanue.mx header.s=fm2 header.b=XYgYgeP6; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=PDNk97RT; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.64 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=unanue.mx header.s=fm2 header.b=XYgYgeP6; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=PDNk97RT; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 2C14B1B118 X-Spam-Score: -1.64 X-Migadu-Scanner: scn0.migadu.com X-TUID: JbmJf+xKkRYa Dear Malcom On Mon, May 10, 2021, at 13:14, Cook, Malcolm wrote: > >I am using Guix with direnv. >=20 > What is your shell? >=20 My shell is bash, originally I was using zsh and I thought that was the = problem, so I switched to bash and still not working. > How/When do you "hook direnv into your shell" (https://direnv.net/)? >=20 In the .profile file, at login. > > In an specific folder I am installing and using psql and postgresql = using direnv+guix as follows: > >use guix --manifest=3Dcdpp-manifest.scm > > > >export PGUSER=3Dfood_user > >export PGPASSWORD=3Dsome_password > >export PGDATABASE=3Dfood > > > >layout postgres >=20 > When are you doing this? >=20 > a) in the "specific folder"'s .envrc file? > b) in an org-mode shell block that you execute prior to the sql block= ? > c) ?? >=20 > Option (a) =20 > You seem to be following [Per\-project=20 > Postgres](https://jamey.thesharps.us/2019/05/29/per-project-postgres/)= =20 > but with guix instead of nix. Nice. >=20 Yep, great post. direnv + guix change the way I develop software, do dat= a science and write lectures and papers. > If you enter the directory and then call emacs, earthing should just=20= > work, no changes neede. >=20 It works for almost everything (sql-buffers, python buffers, etc), excep= t for org-babel sql blocks. I am using EXWM, so emacs is always on. > If you want to tell emacs to adopt the environment established by a=20= > .direnv, you probably want [direnv integration for=20 > emacs\.](https://github.com/wbolster/emacs-direnv) >=20 emacs-direnv was my first choice, but then I changed to envrc (https://g= ithub.com/purcell/envrc) . In both I got the error. > I've got to try this! >=20 > Cheers >=20 Please tell me how that works for you Thanks - A > > > > > >Where cdpp-manifest.scm contains the following: > > > >(specifications->manifest > >'("python" > >=C2=A0=C2=A0 "python-pandas" > >=C2=A0=C2=A0 "python-numpy" > >=C2=A0=C2=A0 "python-flask" > >=C2=A0=C2=A0 "python-graphene" > >=C2=A0=C2=A0 "postgresql" > >=C2=A0=C2=A0 "jupyter")) > > > >I am able to use sql-mode and run queries against the database, in or= der to achieve that I am using the following .dir-locals.el > > > >;;; Directory Local Variables > >;;; For more information see (info "(emacs) Directory Variables") > > > > > >((nil . > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ((projectile-project-test-cmd . "pytes= t --color=3Dno --failed-first --maxfail=3D5"))) > >(python-mode . > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 ((python-shell-buffer-name . "Python [CDPP-Inspecciones]"))) > > > >(org-mode . ( > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 (indent-tabs-mode . nil) > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 (org-src-preserve-indentation . t) > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 (org-footnote-auto-adjust . t) > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 (org-footnote-auto-label . t) > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 (ispell-local-dictionary . "spanish") > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 (org-export-allow-bind-keywords . t) > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 (org-footnote-define-inline . nil) > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 (org-footnote-section . "Footnotes"))) > > > >(sql-mode . ((sql-connection-alist . ((mydb > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 (sql-product 'postgres) > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=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=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 ) > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 ))))) > > > >But If I try to use an sql org-babel block > > > >#+begin_src sql > >select 1; > >#+end_src > > > >(I am setting the connection variables in a PROPERTY) > > > >I get the error: `psql is not found` > > > > > >I was reading about the variable sql-postgres-program, so if I set th= e following in dir-locals.el > > > >(sql-postgres-program . "/gnu/store/f2v92bkx2vfzmkl14qxj3hlmby4dy9x0-= profile/bin/psql") > > > >It works (note that psql ONLY lives inside the profile defined by dir= env+guix), but I don't like the idea of hardcode the path. > > > >Is there a better way? > > > >Ideally I will expect that the org block will read it from the enviro= nment, but is not working.=C2=A0 > > > >Thanks in advance > > >=20