From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id cD//BY5Vu2YGXAEA62LTzQ:P1 (envelope-from ) for ; Tue, 13 Aug 2024 12:46:06 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id cD//BY5Vu2YGXAEA62LTzQ (envelope-from ) for ; Tue, 13 Aug 2024 14:46:06 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=CHS+Rn2X; 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=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1723553165; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=8MLFDva6dxE2q1RVWI1N20EBs78ul1lzSMV64bq1ZWI=; b=cJ3I0V9KvTVSopPt8805WPKPlccbHbJJKbe/YTR+1oup7PftJ37VES0DNkRuKWQTg35aG4 BoBUK1TyAZMan4FcuDpOVTi244USp6PEKgU0zXAqdG2fquM6fp7mpJ1H+UqGeDZZHRWb/q 1KXfX6QZkLpmWBW/rMfqluE2+KSllTdFDTKMMbJz4xFYuFx+rS1r8FLp99Pj4j8qc8J3At aEp09Lzc6nVj24m2iTV8469PmMdPYfDTmNyZoKAyMJLEcP2Dhdy0v6E5z+AeThcI+Kv7V6 KlO/fpZuoFHPRhImxkAMR9lpPw/X7k36lrKbkMupsxMEs8zXl7J1M7yqR0ijyA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=CHS+Rn2X; 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=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1723553165; a=rsa-sha256; cv=none; b=tt6JMDe27k+CD3WIbXNQuiMLARA1ZNLUY4CbDULr/2gZd7OBqOczsTxkN8eBYzJpkPqsVe kWNWygHEqhGM+suUykZKkhNNmsZFWkZM2OyC+ZLOUpSUQptlWNvi3n7liib2IrwS8ovzY/ 3wf55dQCfcd4BfbaIv9pnoiDr29dHNbfidUMjmjVtb7lUQ7YpD/r7mHKDsF7+DmaBTpmxw eW6Y9DDB3ejyMXc3EJukFddTwFDeeVOCkUT2s7/RZN8fyzAdGkUr58w37BIgK2v/uULORL yo/CimDw6bgpbtCzhpqYtdPZrCuJa9Uin6MXQ89FSiULu0ZlRFKajFbRbXGdzA== 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 0ADFD56C62 for ; Tue, 13 Aug 2024 14:46:05 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdqto-0008OH-Jd; Tue, 13 Aug 2024 08:45:16 -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 1sdqtm-0008Nu-MD for guix-devel@gnu.org; Tue, 13 Aug 2024 08:45:14 -0400 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sdqtk-00060R-MR for guix-devel@gnu.org; Tue, 13 Aug 2024 08:45:14 -0400 Received: by mail-lj1-x243.google.com with SMTP id 38308e7fff4ca-2f149845d81so60632491fa.0 for ; Tue, 13 Aug 2024 05:45:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723553110; x=1724157910; darn=gnu.org; h=content-transfer-encoding:content-language:subject:to:from :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=8MLFDva6dxE2q1RVWI1N20EBs78ul1lzSMV64bq1ZWI=; b=CHS+Rn2XVPwvyg8TDJksV107+7ZM6zWLA+mrkeANL5Reoofmg3VoMcuD+i7s23EXar NHmu/Vsck9kIhXiuGlxZnBlV2l/IDJkH4SocFlVT703FL7YZV7Y07ieUwmEVNhvFKFuN +bWn5xY8WcerxeZvDN/Wr7sT9urVeHnHGiZtQhljCsKoMtBJL7hDdeN2GavfQm4qWMkg YkDSQJ99jUAveLlX1sFIHeEW2ZqecJZSJ48zk8VaQX1vs95trzDv6LhTyiu5OqJIQwbN Msc00EA1q0cgMFlGCohhVPLhRPK8ruVkOl8gX8wojHXHO7ZZJwbbBOAfCN9VF4YsIqXY 2S5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723553110; x=1724157910; h=content-transfer-encoding:content-language:subject:to:from :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=8MLFDva6dxE2q1RVWI1N20EBs78ul1lzSMV64bq1ZWI=; b=YFQ7lbS8qoFsLDpQvDWgQMRvvpJ21TmRVQUhVB4uXSxZX3Oga50Ev4ZOVLhyc/35l+ rikMEbMJcfFfi++7aqKIu33CoFScO1RN4+6vdVNQZbD2+75O2Xn/BZFkxJ4VBaHOJK2y rdrTFccVXPC7TUYuMFAoeA+yB9RnMBIlRNmr0e3qCHS+0gT/N7J2P2qzoXZUxVaDwsRV SIJEVFjJGukAaysL+Mkr4dQ+mEf9YHfdTSt62hho1vLXP1oY3i3yyps9OyOn+v0PrHkd Rt6F2nc2oAw4fymWBKV9RLfSeg3mgRArgD+Jkt+H4ycA+Cj4VG2GxSxdOhVWJTGHOwP8 tS2A== X-Gm-Message-State: AOJu0YyjsaVU0aCiddg/CLD121db4UJsj+hvTKphA0QpMIavOF1S9D8w u7epHXq9ddKjZ0u1G7pd1h+l2JlU01dKeU2WqBFOWvCWtMJ/C0k5s6U0Wtde X-Google-Smtp-Source: AGHT+IHFhW7LZK6G7uViC/jJEuMZEWsm24Dn/jgSjbtS/82yEdGXbBzcrypbNsT+f1FzG3Dh+HSLBw== X-Received: by 2002:a05:651c:154a:b0:2ef:2472:300a with SMTP id 38308e7fff4ca-2f2b712f15dmr23536861fa.2.1723553109084; Tue, 13 Aug 2024 05:45:09 -0700 (PDT) Received: from [127.0.0.1] ([188.168.229.48]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f29203d801sm11232571fa.89.2024.08.13.05.45.08 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Aug 2024 05:45:08 -0700 (PDT) Message-ID: <63d4684d-7e8e-437b-91f5-ce20607ab882@gmail.com> Date: Tue, 13 Aug 2024 17:45:08 +0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Nigko Yerden To: guix-devel@gnu.org Subject: Cookbook recipe from "The Repository as a Channel" section does not work for Guix with properly configured GUILE_LOAD_PATH Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::243; envelope-from=nigko.yerden@gmail.com; helo=mail-lj1-x243.google.com 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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: 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-Migadu-Queue-Id: 0ADFD56C62 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -9.77 X-Spam-Score: -9.77 X-TUID: X48m28TmkCa2 Hello Guix!, Consider a minimal test git repository [1] created in line with Cookbook recommendations [2]. It has the following file structure: . ├── content ├── .guix-channel ├── guix.scm → .guix/modules/test-repo-package.scm └── .guix     └── modules        └── test-repo-package.scm Here 'content' is a text file. '.guix-channel' includes -----------------begin------------------------------------------------------------ (channel (version 0) (directory ".guix/modules")) -----------------end-------------------------------------------------------------- and '.guix/modules/test-repo-package.scm' provides a package definition: -----------------begin------------------------------------------------------------ (define-module (test-repo-package) #:use-module (guix packages) #:use-module (guix gexp) #:use-module (guix utils) #:use-module (guix git-download) #:use-module (guix build-system copy) #:use-module (guix licenses)) (define vcs-file? ;; Return true if the given file is under version control. (or (git-predicate (dirname (dirname (current-source-directory)))) (const #t))) (define-public test-repo (package (name "test-repo") (version "1.0") (source (local-file "../.." "test-repo-checkout" #:recursive? #t #:select? vcs-file?)) (build-system copy-build-system) (arguments (list #:install-plan #~'(("content" "share/")))) (synopsis "Example: git repo as a package") (description "Example: git repo as a package") (home-page "https://example.com") (license gpl3+))) test-repo -----------------end-------------------------------------------------------------- All what this package does is to install 'content' file to '/gnu/store/..../share/content' path. 'guix build -f guix.scm' command works as expected. However, if we add the repository to the list of channels in ~/.config/guix/channels.scm file: -----------------begin------------------------------------------------------------ (list .... (channel (name 'test-channel) (url "https://gitlab.com/anigko/test-channel.git") (branch "main"))) -----------------end-------------------------------------------------------------- and run 'guix pull', the command 'guix build test-repo' will fail with an error message "No such file or directory 'content'" unless your GUILE_LOAD_PATH does not include '~/.config/guix/current/share/guile/site/3.0/' path (this is the path where a symlink to 'test-repo-package.scm' is installed by 'guix pull'). Normally GUILE_LOAD_PATH does include above-mentioned path. Indeed, the GUIX System installer injects the following snippet -----------------begin------------------------------------------------------------ eval "$(guix package --search-paths \ -p $HOME/.config/guix/current \ -p $HOME/.guix-profile \ -p /run/current-system/profile)" -----------------end-------------------------------------------------------------- into '~/.bash_profile' file, setting many environment variables, and GUILE_LOAD_PATH in particular. In this case '(local-file "../.." "test-repo-checkout" ...)' expression is run from '~/.config/guix/current/share/guile/site/3.0/test-repo-package.scm' file, which is a symlink. But '(local-file "../.." ...)' does not follow this symlink, and the 'source' field of 'test-repo' package is evaluated to '~/.config/guix/current/share/guile/site/', which is wrong of course. Here is a workaround for this behavior. From the definition of 'local-file' in guix/gexp.scm one can deduce that the executed relevant code is: (absolute-file-name "../.." (current-source-directory)) Here '(current-source-directory)' evaluates to '~/.config/guix/current/share/guile/site/3.0/'. However, if the symlink in '3.0/' directory would not target a file but another directory, say 'test-repo', containing a file 'package.scm' with the package definition, then '(current-source-directory)' will follow the symlink, that is what we want. The branch 'alt' of [1] provides a realization of the workaround: . ├── content ├── .guix-channel ├── guix.scm → .guix/modules/test-repo/package.scm └── .guix     └── modules        └── test-repo          └── package.scm In comparison with 'test-repo-package.scm' file from 'main' branch, the 'package.scm' file contains three modifications: 1. (define-module (test-repo package) 2. (define vcs-file? ;; Return true if the given file is under version control. (or (git-predicate (dirname (dirname (dirname (current-source-directory))))) (const #t))) 3. (source (local-file "../../.." "test-repo-checkout" #:recursive? #t #:select? vcs-file?)) Thus defined repository ensures that 'test-repo' package is built without errors on systems with and without properly configured GUILE_LOAD_PATH. Regards, Nigko [1] https://gitlab.com/anigko/test-channel.git [2] https://guix.gnu.org/en/cookbook/en/html_node/The-Repository-as-a-Channel.html