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 YNB5Mj7rTWaqYwAAe85BDQ:P1 (envelope-from ) for ; Wed, 22 May 2024 14:55: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 YNB5Mj7rTWaqYwAAe85BDQ (envelope-from ) for ; Wed, 22 May 2024 14:55:26 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=msavoritias.me header.s=20210930 header.b=sOmSU7AF; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=msavoritias.me (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1716382526; 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=YlU5R5L06bM86G/HikdTB1RzRHX938Aj01h3XD5jD/k=; b=dua0ynrV7WtXoppoyb50j0/S0e0Nep50r/XJ9QN1f4/7p1o7yO06zPRNsCViDEk2GFy1mF xMV26SQuoKGUaMx3cinhtQUc+hm64GWdZ210nACbInlpEhBwfKI1qDFfAa2T5fmq+1aAi1 5Q7FqBSoJ9FsXfEXl09CdMZhmFKc4Pv17funS2zrnNDdqAwymt8vVUeNlrSFgcA8BdSfrj LnoP/sKL9Hkf7P2td2Kvqn0OBbMI4ZgtQWZYcAeVA3ObiFfZ8zEHCjVpTqDtksyiRhxJ9F ls44cdDpwDhNUGMSTbrK/+CyeQsDI6v08IXs1YZUpoOXTCbfqnTiCsXRCIR4KQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=msavoritias.me header.s=20210930 header.b=sOmSU7AF; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=msavoritias.me (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1716382526; a=rsa-sha256; cv=none; b=WLEeLtX27hHIOFDU5zE9f5bp0v+BXlyJ4ONqqG4iAdG+AUFWw36tqQXlf4TuF4+Dp6LP+A cYh09H5q7hzE36bYmXI4GL5lPMU4qioV4kaQgbSlBZEXzrQ4KLHUUnyq31Djb6ZpgWS6WK GHJTZh97AXZtAywne+B1IxwPyPi6Sqg8N1Zd9PMuK8p1u3b3m3NyCT+rz/3VjrfeJYkuca iDh/MYYOytZ9XYsghi9BiID5XHcfiEW+tXCoAeAl8Z4J8AUc/P8ZlZCa4uLgQGC0ZrptnX cflxe2i21EyA0a9vAi2cDC8jeX10965DyLjsc2kmYiOKO1GOjwm8CzON46N1zA== 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 6EABEC159 for ; Wed, 22 May 2024 14:55:26 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9lUY-0003xF-Tn; Wed, 22 May 2024 08:54:50 -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 1s9lUX-0003ww-8s for guix-devel@gnu.org; Wed, 22 May 2024 08:54:49 -0400 Received: from mail.webarch.email ([81.95.52.48]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9lUV-0001qk-0O for guix-devel@gnu.org; Wed, 22 May 2024 08:54:48 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id D61E11A82E8F; Wed, 22 May 2024 13:54:34 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=msavoritias.me; s=20210930; t=1716382477; h=from:subject:date:message-id:to:mime-version:content-type: content-transfer-encoding:content-language:in-reply-to:references; bh=YlU5R5L06bM86G/HikdTB1RzRHX938Aj01h3XD5jD/k=; b=sOmSU7AFymvpEQoG9G6x95vQ5eXr4nUIPviLxbF9HaWNbcKpZQfMAbkgcTlAgfCTDZncSC rU1DZnFnYfavCBZv00885H8tdDiGQJUMDrpQYJwi4Cqz005p9Vo5QfN2F3TPDR/1mPnc5T x1OWWIVak/wYOyg06JXVxl0C2CoSyoovDSMFcx+71SyNoAX0DNPGCZG49duPriWDh8kdUn FkcpV/0i1HOPk+jxQcByZsOjSXNpC6t7VhAjuRRvdwS5+dz88xj6wSPJPW1UKyYoCPDkzR wlCx76UtLliDHqIZy4kL5/xQuBY7wnPJrd6i9PmG3DPiZr4A800htLqW1P/nOQ== Message-ID: <2d322c0e-4f82-1b3d-0af8-88f8980f34a6@fannys.me> Date: Wed, 22 May 2024 15:54:30 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: Idea for packaging rust apps Content-Language: en-US To: Murilo , guix-devel@gnu.org References: From: MSavoritias In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Last-TLS-Session-Version: TLSv1.3 Received-SPF: pass client-ip=81.95.52.48; envelope-from=email@msavoritias.me; helo=mail.webarch.email X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, NICE_REPLY_A=-1.89, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Spam-Score: -1.36 X-Migadu-Queue-Id: 6EABEC159 X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -1.36 X-TUID: s67wsfs2UkHE On 5/22/24 05:04, Murilo wrote: > Hello, I hope this is the right place for this, apologies if it isn't. > > I'm working with a friend on a cargo importer that lowers the entry barrier > and the maintainability costs for packaging rust apps in general, without > sacrificing Guix dependency tracking and reproducibility of rust packages. > > When you get used to the tool, you can pretty much package rust apps with > all the dependency chain very easily (I just packaged [1] texlab for my > channel earlier this morning in less than 5 minutes, and i can easily > update apps to the latest version in less than a minute). > > Progress is being tracked in [2] if anyone wants to check it out or > contribute to it. It is currently missing a lot of features, but we hope > to improve the user experience of the tool in the near future. > > It is a very simple tool, it essentially parses the Cargo.lock file and > extracts all the relevant information for constructing the rust package > definitions of all the cargo-inputs and the package itself, and outputs > to stdio a guile module containing all the needed cargo-input chain as > guix packages, with all the cargo-inputs self-contained and versions all > sorted out for a working final package build. > > This way a packager only needs to focus on the actual package they are > trying to build, instead of worrying about its cargo-inputs. > > Due to how cargo-inputs are organized in gnu/packages/crates-*.scm, and > some current packaging guidelines for crates on Guix, we cannot simply > contribute these self-contained packages generated directly from the > Cargo.lock, thus requiring to use the guix crate importer and spending > a lot of time fixing dependencies and worrying about other packages > breaking in the process. > > I would like to propose some discussion around a better way of organizing > the rust packages and its cargo-inputs in (gnu packages) for building > rust apps that only need sources as cargo-inputs: > > 1) Create a new directory at gnu/packages/rust/ in which a contributor > can commit self-contained rust apps scm modules. > 2.1) Add a new module at gnu/packages/rust/my-rust-app-1.scm > 2.2) Add a new module at gnu/packages/rust/my-rust-app-2.scm > 3) All package definitions inside gnu/packages/rust/*.scm which are > source-only (#:skip-build? #t) should not be exported. > 4.1) gnu/packages/crates-*.scm will not cease to exist, existing rust > apps packages that have a Cargo.lock could gradually be migrated to the > new organization > 4.2) libs which need to be built can still live in > gnu/packages/crates-*.scm > 5) A (define-public my-rust-app-1 (@@ (gnu packages rust my-rust-app-1) > my-rust-app-1)) or equivalent could be done in a (gnu packages category) > module to export the rust app in the desired category. > 6) Unlike nix (which also parses the Cargo.lock in the build system), > we don't lose the ability to make snippets for sources this way. > 7) For updating/maintaining a rust package defined this way, one would > be able to simply re-run the guix tool, and replace the > gnu/packages/rust/my-rust-app.scm file, only copying over the final > relevant package definition for the rust app with its tweaks for building, > and passing over the new cargo-inputs generated by the guix tool. > > I believe that by only changing the way things are organized and having > a guix tool that generates self-contained package definitions from > Cargo.lock, it would be possible to greatly improve the time required > for contributing new rust apps packages and maintaining them on Guix. > > Things don't need to be the way I described here, these are just my > initial thoughts after several failed attempts and wasted time trying > to contribute rust apps to Guix, I'd like to discuss workarounds and if > the benefits are greater than the disavantages for an approach like this. > > The tool we made works really well for packaging for our personal channels, > I am very satisfied with how easy it is, and I think Guix could benefit a > lot by adopting a similar approach. > > What am I missing here? Are there any disavantages to this approach? > Anything that would break from it if adopted on Guix? > Any questions or suggestions? > > Murilo > > [1] https://codeberg.org/look/saayix/commit/c7643943545d62baba80cccee1650ebf94362858 > [2] https://git.sr.ht/~look/cargo2guix Hey Murilo, Thank you for taking the initiative to do something about the rust packaging situation in Guix. Which currently less than optimal. I wanted to ask, are you also aware of the antioxidant effort? https://notabug.org/maximed/cargoless-rust-experiments I was wondering of the differences since your build system seems to still be using cargo under the hood instead of rustc. MSavoritias