From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id cLViDixWIWNCFQEAbAwnHQ (envelope-from ) for ; Wed, 14 Sep 2022 06:18:52 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id GMNwDixWIWPCkQAA9RJhRA (envelope-from ) for ; Wed, 14 Sep 2022 06:18:52 +0200 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 8A99671C3 for ; Wed, 14 Sep 2022 06:18:51 +0200 (CEST) Received: from localhost ([::1]:35952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oYJrO-00019S-Jq for larch@yhetil.org; Wed, 14 Sep 2022 00:18:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49468) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYJr5-000195-3f for help-guix@gnu.org; Wed, 14 Sep 2022 00:18:35 -0400 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:39003) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYJr2-000316-HJ for help-guix@gnu.org; Wed, 14 Sep 2022 00:18:30 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id E80193200923; Wed, 14 Sep 2022 00:18:23 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 14 Sep 2022 00:18:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= philipmcgrath.com; h=cc:content-transfer-encoding:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to; s=fm2; t=1663129103; x=1663215503; bh=WZXNROR0O3rBsmG/UtIip3hy5 p6+XYkjq7Z/0zjJLn0=; b=1ikTuphIW2WT3uzGa2iY6AWL7qzCqAJu98ERy/g7V N0pARmulunH4PvFaWKucwPbOZwSo1wFOiRQaHh2KLPs0Ii7227oYg6K0ZbSyDZ/X XR8JcKYzLuNwDUeHa/e/jMKBCvp/C/IWYMiYCKD2JBvdzmkP4iBjaEAASrkPa/So R68S/VA5Ek/vCwqtgowVp2AfFFGtbx+lobGDjQwnfFwnAidhDuA1iJ3gIifsNjBX eh0Am6sgQ3xS70NWTV+VLlNvLxWoeyGB8t651PDp/rnAmMUZwvbnWDmUqwo4HLlr 8mW3VaHEvfkipVVzhUUT1tfnIJbrt8vvuV570s5ouTq/Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1663129103; x=1663215503; bh=W ZXNROR0O3rBsmG/UtIip3hy5p6+XYkjq7Z/0zjJLn0=; b=Z9+Wd16kM6rdCcqFS aKFA6wJNTtx82Vzlk8mLnTE+iX1hDvwtPUqTBPKItzoUHRO6mu1l8/H6+reyiq5M raszPeLlKLEnSlwFxYajeYRZK/nYy+n4ngj1XiB7CIQ+lmndHaSBycTWFddoVkHa sjD1pW5BqAVYeCcPZdc4e0oQRFNl9iJGMqZjRjLNOif32j7/oRI+IX2lec+VM1wH S3pswhJj7n+vcB4OqqhbvOqxaWIUVx0JAUcawuyt0VuE9dnAz8DAmAOiBmLCjca9 RP69k0qd+Ov50VYmuFrj2KD0zJqgUEqAehwASc22C/pMBqm7ItudzxQV0GJhbF97 he61Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeduhedgkeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthejredttdefjeenucfhrhhomheprfhhihhl ihhpucfotgfirhgrthhhuceophhhihhlihhpsehphhhilhhiphhmtghgrhgrthhhrdgtoh hmqeenucggtffrrghtthgvrhhnpeefhffgteejleejueetvdegtdejkeegffekudekieej leeghfelveetffevveduvdenucffohhmrghinhephhhtthhpmhhoughulhgvrghvrghilh grsghlvgdrhihouhdpvghlmhdqlhgrnhhgrdhorhhgpdhgihhthhhusgdrtghomhenucev lhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehphhhilhhiph esphhhihhlihhpmhgtghhrrghthhdrtghomh X-ME-Proxy: Feedback-ID: i2b1146f3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 14 Sep 2022 00:18:22 -0400 (EDT) Message-ID: <19dea59c-da23-d20d-7de2-b3148a4651b3@philipmcgrath.com> Date: Wed, 14 Sep 2022 00:18:21 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: Elm and Guix Content-Language: en-US To: jgart , Guix Help References: <20220913192724.GB14733@dismail.de> From: Philip McGrath In-Reply-To: <20220913192724.GB14733@dismail.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=64.147.123.21; envelope-from=philip@philipmcgrath.com; helo=wout5-smtp.messagingengine.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 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, NICE_REPLY_A=-0.628, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1663129132; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=WZXNROR0O3rBsmG/UtIip3hy5p6+XYkjq7Z/0zjJLn0=; b=C6eMaq9+2FfTxHASTYlxzowctnsGqxYJ2gQ6lDSpWx91+4PGsYZmC8vQIfaLZ9NpchSLi0 piJj++DSmZv+iuuVd+9/czTkZIE05q5jQ64gDl5Zt4fBUYp+RPbmOKupl1g7z2oO2xqgVU mkQNzlV06sxOIS2VAJkkL7Lwi6VupUXVFlOjB/LhejQJPjqBcR+VVZ94IIN9IQmBMagKM8 K1VHmhImbjgJ1BvD27hBxXNfYFFUnxdnnW9BIUDK/kCn43S4yb2OHkh3wA9cC+7EbHoOVo wfHZZdNS3sRjTi36ArVmg2fBWy5nVvYMU3lNRa4hubk0WnHsrbwXmTYEZyhw3A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663129132; a=rsa-sha256; cv=none; b=gNwFDgb54YOjpL8yIKucqkRojTpmdmpLES2JEXoKxZQDbGoQvYtXYDU8uTOWfgKZaCesRq jsmHmeaaM+02/C1UdmEvV4uKaA3s4cN9D9XL2Iu2Eadl5sJz65mPwLAzA0NHnjfkFSg2hV kOUZFcIdB8/SzzGuq+8+RHcxvpY4tWfgP8iGE5FyL2x6jh/VJOFCCOxP9u0H6FhSVCtsia j89Te7tk96BzV2o3FTFdm6Du+Gu/S9q0VkdTbUkrdb3ln/5jd3aq11Qckkwj8Ya3VJ7gFK 6N733TERkN5FFrM7+oRldqLmjpeLzk3mwGKkpLX3IugId5o4sv3koOKSsAiY6w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=fm2 header.b=1ikTuphI; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm2 header.b=Z9+Wd16k; dmarc=none; 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" X-Migadu-Spam-Score: 0.89 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=fm2 header.b=1ikTuphI; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm2 header.b=Z9+Wd16k; dmarc=none; 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" X-Migadu-Queue-Id: 8A99671C3 X-Spam-Score: 0.89 X-Migadu-Scanner: scn0.migadu.com X-TUID: Kkw714uP94dE Hi, On 9/13/22 20:27, jgart wrote: > From: jgart > To: Guix Help > Cc: Philip McGrath > Bcc: > Subject: Using elm with Guix > Reply-To: > In-Reply-To: > > Hi, > > I'v been trying to use elm with Guix at the repl and by compiling a > src/Main.elm file and elm doesn't find any of the Guix-installed dependencies: I think there are a few different things going on here. > ``` > guix-shell elm make src/Main.elm > Detected problems in 1 module. > -- MODULE NOT FOUND ----------------------------------------------- src/Main.elm > > You are trying to import a `Http` module: > > 10| import Http > ^^^^ > I checked the "dependencies" and "source-directories" listed in your elm.json, > but I cannot find it! Maybe it is a typo for one of these names? > > Set > Dict > Main > Task > > Hint: Maybe you want the `Http` module defined in the elm/http package? Running > elm install elm/http should make it available! > ``` > > Is there a way that I'm supposed to be using elm with Guix in order to > discover the dependencies. This part of the problem doesn't seem to involve Guix. As you may know, Elm "module"s (files like "Main.elm" or "Http.elm") are organized in "project"s, where a project is either a "package" or an "application". Every Elm "project" must include a file called "elm.json" declaring the project's structure and dependencies. Unlike many languages, Elm doesn't have a concept of modules outside of a project, nor of globally installed packages: when compiling `import Http` in your "src/Main.elm", Elm will look for an `Http` module that is either part of the same project---i.e. a file "src/Http.elm", unless anything is configured unusually---or in one of the Elm packages listed in the "elm.json" file. In other words, Elm never "discovers" dependencies. That's true even for the modules from "elm/core" package! What this error message is saying is that your "elm.json" file doesn't declare a dependency on the "elm/http" package, so there's no `Http` module available. You could edit the "elm.json" file by hand, but you'd have to get indirect dependencies and versions right. The command suggested in the error message: elm install elm/http will edit your "elm.json" file for you to declare the additional dependency. For a useful example, look at: guix build --source elm-todomvc > > The usage of this for elm developers using Guix looks undocumented. > > What I tried: > > ``` > guix shell elm elm-json elm-html emacs-http > > mkdir elm_play > cd elm_play > elm init > elm make src/Main.elm > ``` > Here, though, we get to some issues that do involve Guix: in particular, using `guix shell` to install `elm-json` and `elm-html` isn't (currently?) helpful for interactive development in the way you would hope. First I'll try to explain two ways of using Guix for Elm development that do work; then I'll explain the unresolved issues here. One option is to use Guix to install `elm`, but then let Elm manage other Elm packages you need for interactive development. This is analogous to using Guix to install Python or Node, then installing packages with `pip` or `npm`. (Maybe it's a little better than that, in that Elm has very stringent requirements enforced by the compiler to avoid some of the hairy problems with e.g. npm packages.) Another option is to define a Guix package for your Elm project using `local-file` in the origin, and then, instead of `elm make`, build your project with e.g.: guix build -f elm_play.scm In that case, `guix import elm` may be useful for any of your packages that aren't already in Guix, and the package definition for elm-todomvc would be a good example to imitate. In particular, either you need to make sure that your "elm.json" file matches the versions of your dependencies packaged in Guix or you should make use of the the `patch-application-dependencies` procedure as suggested in the documentation for `elm-build-system`. The problem with: guix shell elm elm-json elm-html elm-http (I assume you didn't mean `emacs-http`) is that it won't put the built Elm packages in a place where Elm can find them. Elm looks for installed packages in a single directory, either "~/.elm" (IIRC) or the value of the ELM_HOME environment variable, if it's set. We of course have functions to assemble such a directory in "guix/build/elm-build-system.scm", and we could expose them either via a package-generating function (analogous to texlive-updmap.cfg`) or even a profile hook. The deeper issue is that Elm sometimes tries to write to existing "artifacts.dat" files in ELM_HOME: this is also the cause of the caveat about multiple versions of the same Elm package not tending to coexist well in a single Guix build environment, even though that's supported at the Elm level. I haven't dug deep enough into the internals of the Elm compiler to figure out exactly what's going on. It's possible that the very limited support for working offline I patched into Elm for Guix might be enough to work around this, if you want to set up an environment with an ELM_HOME managed exclusively by Guix. Alternatively, it could be interesting to explore patching Elm further to not try to overwrite "artifacts.dat" files and look for packages in an additive way, perhaps using XDG_DATA_DIRS. If you're interested in exploring any of that, I wrote comments in "guix/build/elm-build-system.scm" and "gnu/packages/patches/elm-offline-package-registry.patch" with ideas, and IIRC there was some informative discussion upstream at and maybe related to `elm-test-rs` , and probably other places. If we came up with a nice approach, I hope upstream might be open to patches, especially since the Elm community is enthusiastic about immutability. Anyway, I hope this helps, and let me know how it goes! I'm glad the support for Elm in Guix so far is interesting, and I think having more people try it will be the best way to figure out how we might be able to improve on it. -Philip