From unknown Wed Jun 18 23:09:43 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#78378 <78378@debbugs.gnu.org> To: bug#78378 <78378@debbugs.gnu.org> Subject: Status: [PATCH 0/2] home: services: Build "files" union allowing dangling symlinks. Reply-To: bug#78378 <78378@debbugs.gnu.org> Date: Thu, 19 Jun 2025 06:09:43 +0000 retitle 78378 [PATCH 0/2] home: services: Build "files" union allowing dang= ling symlinks. reassign 78378 guix-patches submitter 78378 Sergey Trofimov severity 78378 normal tag 78378 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sun May 11 12:01:13 2025 Received: (at submit) by debbugs.gnu.org; 11 May 2025 16:01:13 +0000 Received: from localhost ([127.0.0.1]:38389 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uE973-0004ed-2f for submit@debbugs.gnu.org; Sun, 11 May 2025 12:01:13 -0400 Received: from lists.gnu.org ([2001:470:142::17]:45124) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uE96z-0004e4-Fh for submit@debbugs.gnu.org; Sun, 11 May 2025 12:01:11 -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 1uE96p-0006PA-K8 for guix-patches@gnu.org; Sun, 11 May 2025 12:01:00 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uE96n-0006RK-Pj for guix-patches@gnu.org; Sun, 11 May 2025 12:00:59 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3a1f5d2d91eso1778945f8f.1 for ; Sun, 11 May 2025 09:00:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sarg.org.ru; s=google; t=1746979254; x=1747584054; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=8qgO2G0X0NesHalB84kPF9tpCB5tx4Uf2fYgITSpWDM=; b=PBDISLq8kxF9QWMwWFr94hhBv/8vEVj3Tj61vDQrG5WTSXpWvuoXfABDJ0Vinvi4PY +gB+Fd1BUZdxmZD/ijm9MGpG3d0Gzvp1LhpFYKEbGdvjWVFdbeMwMvRmcqXKHf7qlMNz ao66y2o5jI8+GceUEYHbQDFW4NLkawEQiGYeCNrN7fuhzPfuDpAdbIyEdlsWO/C4Qd6R 3y8PAs3LJ1KEBLgwb5aX6Eo8+mnpkyXpVSQOCj64a8+Vzi0XHallSF/IWMSUtbaQtw6p GK8W2Z1H+T6aCG1Gi6wdNeD3I2ixNjYRfJF+7kzxlGY16/ZqvyiRQ5alTjqoXyS4tC6c D5rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746979254; x=1747584054; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8qgO2G0X0NesHalB84kPF9tpCB5tx4Uf2fYgITSpWDM=; b=RcmxRu1gnrYg8T2NauxyE+0YGqwTwiw3M33sX83AFRcc1JXUUFX21wvaLHl6cyBInL Vt7C7pyDmvf08XUpq9sD7YEDxJzCqETn4/T/hAWAhBVB52MvkzaaIS29dIFmCgw6P+r2 8745Ksnw1WS8aEKdykPv/JSEogr9WgPr+GQraEaiLYjFScnz9bdFoTKkr+La7/XSwGCa kQ8MkVouhnA2PXMYiZSux1cSDgwPXiZ2FXmXzZGLOSDuB+f0MOG5WGD5E7Pk7vLTslka oxuBo4HfY21yVjVdmUILMll3wcZtIPCexENs30V6RFP9CLlO8x5/W2Ip4QluZyniIGx0 0bWQ== X-Gm-Message-State: AOJu0YxqKPUprFB5RJFnD2xcC197Bmk7vs2i52EYEbzHVx4y6kcWY5sy T9XB91i3OjVy8yi7lRJhGUL7YzOCVisf90i8UgUJjdThi/lAH1EvSo4rggbluxka/nldvtJXLUp tpQo= X-Gm-Gg: ASbGncusTxYbjjsgVWJ6FHYCSv94MecS9cgvRkoVFwmh5xgYhWRqg3eNr1t+0znR8Cy 9PE85eoUhbRmXlQuMSWn6nDNsKg0795ab0sMRi07VeaYNU/+weuFn7ZlsbJC4fPKTMwFJs++OTl mBZh3edp1EfPRqnKnqNYrXfr5u0s/SG5cSf7ahHsU5wJPupnl3uidkyMwaQn7tWHbuIgrGQ7zBl HqmCRa6hn6OwjVk57AOiEMHQ+JOfFjpr7G1495UogZGxXCRHooI5j+lyNgbgyppTAapLB44aQ3j zwzrFoCfkD4xi1hV+936R22tXvENRh2jc7w50XVTqwOzxsOM X-Google-Smtp-Source: AGHT+IEFagRRqYepS9ZTuq6+50PYKI6uRIocKtz4BKPhnVjd3HwIf0/iVLHbbHp4pbktbp1Xs0f1xg== X-Received: by 2002:a05:6000:1a86:b0:3a2:1d3:defb with SMTP id ffacd0b85a97d-3a201d3e04emr2822622f8f.36.1746979254373; Sun, 11 May 2025 09:00:54 -0700 (PDT) Received: from localhost ([2a02:2454:a095:5600:a64e:31ff:fe38:fd6c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a1f57de0ddsm9471542f8f.7.2025.05.11.09.00.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 May 2025 09:00:53 -0700 (PDT) From: Sergey Trofimov To: guix-patches@gnu.org Subject: [PATCH 0/2] home: services: Build "files" union allowing dangling symlinks. Date: Sun, 11 May 2025 18:00:50 +0200 Message-ID: X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 X-Debbugs-Cc: Andrew Tropin , Hilton Chain , Janneke Nieuwenhuizen , Ludovic Courtès , Tanguy Le Carrour Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=sarg@sarg.org.ru; helo=mail-wr1-x436.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit Cc: Sergey Trofimov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) This patch enables guix home users to create arbitrary symlinks in their home environment. I.e. a user having "/storage" directory (probably residing on another disk partition) could symlink e.g. "~/.mail" from "/storage/data/mail". Sergey Trofimov (2): gexp: Add symlink-to procedure. home: services: Build "files" union allowing dangling symlinks. doc/guix.texi | 11 +++++++++++ gnu/home/services.scm | 16 +++++++++++++++- guix/gexp.scm | 5 +++++ tests/guix-home.sh | 8 +++++++- 4 files changed, 38 insertions(+), 2 deletions(-) base-commit: f6363db18636172f959e2709982bbe09b411c3d8 -- 2.49.0 From debbugs-submit-bounces@debbugs.gnu.org Sun May 11 12:09:12 2025 Received: (at 78378) by debbugs.gnu.org; 11 May 2025 16:09:12 +0000 Received: from localhost ([127.0.0.1]:38553 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uE9El-0005OP-98 for submit@debbugs.gnu.org; Sun, 11 May 2025 12:09:12 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:48525) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uE9Eg-0005NZ-QK for 78378@debbugs.gnu.org; Sun, 11 May 2025 12:09:08 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3a1d8c09674so1641534f8f.1 for <78378@debbugs.gnu.org>; Sun, 11 May 2025 09:09:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sarg.org.ru; s=google; t=1746979740; x=1747584540; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ax91e9t/AlSRpm4kQJtUIFhEfbclQC5FYEIaAlzqJT4=; b=PNEW0NjIjmiQDhaLEuy8w+Uy9NsC0ls2KYrpDoYZVxTQU+KDLpsuVjQ3k7RMH+elLt 8jXEIWrfh4RL4gXq2qIeoYbr+BHU5qySC33KGoSXwlOlE336Gbh7AmzHrpan5ODjsOxg ocp6zL54sfttROP0o5kWiUOdT0PZZ4ewnmlM2ik+XfYlk45cfzEQ4Wp9gawZDGIH/I5B KYL8eBedku4gCLEIi8OCdkIPuzcUua9bN2RWZURh4E4l6VX6oDqXnTViz7AV+WTa8/U5 AqeoKTwsLUjx/PQa9FX5ZyDBnRYfiRpfIxMns7m5ECdvSBkjm8tMWsf0xkjfA5TmQ5My ndVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746979740; x=1747584540; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ax91e9t/AlSRpm4kQJtUIFhEfbclQC5FYEIaAlzqJT4=; b=PWKvQgdE7SIPENDMMMzmfqMAM/Q3J3gzXH1hwP3YgYeBuEq50DKip4/FmLLg9ZVVNV BY61ikTzAzPJSPKL6HM3CM1UZF5VkETVV6pCr+gaq6J0XKNMaRhE2ips53+ovPS5/G7a 5WsQXiYZj8KgzYFlO7zOQKBXrJUeMYKsRYlUxQ0Ir8EGQRrWqyGNruEhx0MQPPwReRjT bXLMA+zpPaxGJEeJeaBJ86ug1I8M7HsTTwHkKNlbcfYYsbtHYKmEu8H6sO/BUg/vv794 YJsYukeaYvsN3PXtivtyTvBPPTxfyBryJZ94pBj31q3XW2RPRE1gQcAbnXoxypJ69Ozp NrsQ== X-Gm-Message-State: AOJu0YwW31VIaJQncDH6nHD22mU/AKwhHzeg5pijfbaKJN4UnfdoWi3D 5lx3D+i+S3NS+3RFs/CY1f/jUdHXW01BzYG1IrlDcZkZYw/UwEkL4y6pYuOI6whDEvKjQmQONmM OOmF0Vg== X-Gm-Gg: ASbGncuPwP9FUbGjek9Wrmf0xJxVgzm9994lJTBrqNolgG1VAPneu7AEEuOpFjr91MO IE077ha+MApmFwSuIV2K1T2VBoJaPLCw0l+xC9G6OiB7q58GO6kVWEE4ndQFD29pW49pgek4E9+ Mb5hWxh6rP2C2pNGiT7+y3zStXZbRxOnRronZD/IQ9qRLWb0Z3Rbb8FEYxJh7FHF10oXAzoCWX8 RGigkr7u0DWurx24Z214mIdlv3dr1oPJJfnWZZvYoGUDUD6Oo/4IMEeIBTV8W0SL7eMikZV5g/W dL+OzzXnsxCFFDhbzN5ST8vt2Lqg+ET3CdU7YgI5XE/BlS5N X-Google-Smtp-Source: AGHT+IGiKkAKdxjdRVasiBL2x+RmopYZceJWT8AQHYlPc0kixeFtXAgl5kg5cFvTJLlbyFxbgSECZQ== X-Received: by 2002:a05:6000:4287:b0:3a0:b635:ea40 with SMTP id ffacd0b85a97d-3a1f64a3e3dmr9042241f8f.55.1746979740134; Sun, 11 May 2025 09:09:00 -0700 (PDT) Received: from localhost ([2a02:2454:a095:5600:a64e:31ff:fe38:fd6c]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-442cd32f194sm140218445e9.10.2025.05.11.09.08.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 May 2025 09:08:59 -0700 (PDT) From: Sergey Trofimov To: 78378@debbugs.gnu.org Subject: [PATCH 1/2] gexp: Add symlink-to procedure. Date: Sun, 11 May 2025 18:08:02 +0200 Message-ID: <043c83e23cd42da9c61d0e4f5bf5fb7299332a49.1746978699.git.sarg@sarg.org.ru> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: MIME-Version: 1.0 X-Debbugs-Cc: Christopher Baines , Gabriel Wicki , Josselin Poiret , Ludovic Courtès , Mathieu Othacehe , Maxim Cournoyer , Simon Tournier , Tobias Geerinckx-Rice Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 78378 Cc: Sergey Trofimov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * guix/gexp.scm (symlink-to): New procedure. * doc/guix.texi (G-Expressions): Document it. Change-Id: I7c1ba3a29a4e5350cb4f196185b7171c4750b6b8 --- doc/guix.texi | 11 +++++++++++ guix/gexp.scm | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index cbc4dd0fc9..ebc8a5e5d3 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -12689,6 +12689,17 @@ G-Expressions This yields an @code{etc} directory containing these two files. @end deffn +@deffn {Procedure} symlink-to target +Return a @code{} that is a symbolic link to target. +Note, that the target does not need to exist at the build time. One of +uses is to put arbitrary symlinks into user's home: + +@lisp +(service home-files-service-type + `(("Sync" ,(symlink-to "/storage/Sync")))) +@end lisp +@end deffn + @deffn {Procedure} directory-union name things Return a directory that is the union of @var{things}, where @var{things} is a list of file-like objects denoting directories. For example: diff --git a/guix/gexp.scm b/guix/gexp.scm index 8dd746eee0..ef83c671ec 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -119,6 +119,7 @@ (define-module (guix gexp) file-union directory-union references-file + symlink-to imported-files imported-modules @@ -2181,6 +2182,10 @@ (define* (file-union name files #:key guile) files))))) #:guile guile)) +(define (symlink-to target) + "Return an object that is a symlink to TARGET." + (computed-file "link" (gexp (symlink (ungexp target) (ungexp output))))) + (define* (directory-union name things #:key (copy? #f) (quiet? #f) (resolve-collision 'resolve-collision/default)) -- 2.49.0 From debbugs-submit-bounces@debbugs.gnu.org Sun May 11 12:09:13 2025 Received: (at 78378) by debbugs.gnu.org; 11 May 2025 16:09:13 +0000 Received: from localhost ([127.0.0.1]:38555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uE9Em-0005Oa-67 for submit@debbugs.gnu.org; Sun, 11 May 2025 12:09:13 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:51655) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uE9Ei-0005Nu-Ad for 78378@debbugs.gnu.org; Sun, 11 May 2025 12:09:09 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-43d04ea9d9aso19087125e9.3 for <78378@debbugs.gnu.org>; Sun, 11 May 2025 09:09:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sarg.org.ru; s=google; t=1746979742; x=1747584542; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mdskQKIIoSminOuv9j+kfMd2WgDop1LivqG6bQ6o550=; b=SQrkKsyWzFoy4i1DyGcQGHybUxEYPIfT2JUtMpBvZBop5eJPUMaT+h4u9bkSHCsiIN ZoihmRbYQju0VOZkfA2i3f622IoQ6deg/SQd0nXaDiwfKJnx3EPMOyJhb+m/CtZ0C4+N B59zzQHjm8UJC82UzW3QMc9OaoZluRZxK0HDsbQ+ZQl0pDhIqQHhVG+Vcbfxb81ibuYf V/rT0mQ4BWJC1oK1uMTYhmP7uA51/DU1NXhVVgPngLGu3/VXrUj2G+8syxfzfd2RZzXB SEt19jvwtcSk+qFDAWZEZlxmFe7NOLoAPdO3R+CoVj7xHhdhVRsQrhbavgH5p1L6ERvl p9dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746979742; x=1747584542; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mdskQKIIoSminOuv9j+kfMd2WgDop1LivqG6bQ6o550=; b=OvfEbVeRUhb9yUKuE4eUEGNdnG5PK0CvILJeJvxAWwXdAq4SFtCegVBAowWkNbkLdW XrEqw1myhmzmbiIiWXDFWs0oCHsOpouh937K4J5rhYTsQyXq/bBm2EZQHGq9teci4HRi dsr3yDMnsEYQy+1OCqz5vDVVrN/qyhZaQNU9gzOfn6S9llB7ow1DgYuY1sDPrKTp/cSk EoOyD7zd4e/u/m/6YUb2tLnXuftbid/7BlaAvIqCV4exj9VEfBS7yYhG1+wA7JOTOhMm zryhQh4BSYbdYM6laPMe4L5wT7h3mTeJaRU6enqBDWTwBlREw1cQbIetC11cS7qzIRQf onZw== X-Gm-Message-State: AOJu0YwqcjdQs6rP34bBucHNvBk8DL/Ddgnr3WtbQoV2Ll/FigslFMuu P/zvs/OiAkQASv0OZx1FgZ3STd80Uq4FdoY1IjfI4khzVuhJtzYo2pOgvCMytZlENCILNVkt8XI sBlpVIQ== X-Gm-Gg: ASbGncth+q4svgGCTbOusmNR5nmGDE93EHtrtqUTH7aXpyRBijWThdFrh7EbJgQZBhX P2hWaBAtdTjErASpzM84vaXPIBsvEcJRS2J//YqCQXINoGHDqObfl4zV3nJBygn3jJBxquqdtSi XP5C39BZuORNAszGuP/Iyor6Nfs2D8SjNlmdCPWbleR1nzW/Z4N+rL4QofM+E+pulhD1gNzHrV2 U0i0DDq5+oPDhbtcILeHl8tQgTrFExjmCRkdXzaIWoVuzlqtc1NkwgLMWG+6gwVLqzbIVaZN1Do 73AldYWdIiiK+EtT1GyzO3vu58aBKEEz7SmG5yUMjCI6YnDT X-Google-Smtp-Source: AGHT+IGa688OqUTDDFypz+B7z04KPq6idA5Gj7aPH6hmUXC6xmgzRQ5DTkWQHrZgmx1wftOZlsaPWQ== X-Received: by 2002:a05:600c:4e45:b0:43d:46de:b0eb with SMTP id 5b1f17b1804b1-442d6d44814mr90075195e9.12.1746979741757; Sun, 11 May 2025 09:09:01 -0700 (PDT) Received: from localhost ([2a02:2454:a095:5600:a64e:31ff:fe38:fd6c]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-442d687bdc0sm95318115e9.39.2025.05.11.09.09.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 May 2025 09:09:01 -0700 (PDT) From: Sergey Trofimov To: 78378@debbugs.gnu.org Subject: [PATCH 2/2] home: services: Build "files" union allowing dangling symlinks. Date: Sun, 11 May 2025 18:08:03 +0200 Message-ID: X-Mailer: git-send-email 2.49.0 In-Reply-To: References: MIME-Version: 1.0 X-Debbugs-Cc: Andrew Tropin , Hilton Chain , Janneke Nieuwenhuizen , Ludovic Courtès , Tanguy Le Carrour Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 78378 Cc: Sergey Trofimov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/home/services.scm (files->files-directory): Build file union without checking for existence of included items. * tests/guix-home.sh: Verify symlinking files out of store works. Change-Id: I94054003f4a6be944252ce7a397cf56f0b979554 --- gnu/home/services.scm | 16 +++++++++++++++- tests/guix-home.sh | 8 +++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/gnu/home/services.scm b/gnu/home/services.scm index 2342dc5e07..55f9365922 100644 --- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -343,7 +343,21 @@ (define (files->files-directory files) ;; leading to a build failure of "files.drv". (assert-no-duplicates files) - (file-union "files" files)) + ;; Compute the file-union allowing dangling symlinks + ;; This enables creating symlinks to locations out of store + (computed-file + "files" + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils) + (ice-9 match)) + (mkdir #$output) + (chdir #$output) + (for-each (match-lambda + ((target source) + (mkdir-p (dirname target)) + (symlink source target))) + '#$files))))) ;; Used by symlink-manager (define home-files-directory "files") diff --git a/tests/guix-home.sh b/tests/guix-home.sh index dbfe7dbd48..b8d90196f1 100644 --- a/tests/guix-home.sh +++ b/tests/guix-home.sh @@ -73,7 +73,9 @@ trap 'chmod -Rf +w "$test_directory"; rm -rf "$test_directory"' EXIT (list `(".config/test.conf" ,(plain-file "tmp-file.txt" - "the content of ~/.config/test.conf")))) + "the content of ~/.config/test.conf")) + + `("symlink" ,(symlink-to "")))) (service home-bash-service-type (home-bash-configuration @@ -104,6 +106,7 @@ trap 'chmod -Rf +w "$test_directory"; rm -rf "$test_directory"' EXIT "# the content of bashrc-test-config.sh")))))))) EOF + sed -i "s,,$test_directory," home.scm echo -n "# dot-bashrc test file for guix home" > "dot-bashrc" # Check whether the graph commands work as expected. @@ -126,6 +129,7 @@ EOF guix home container home.scm -- cat '~/.config/test.conf' | \ grep "the content of" guix home container home.scm -- test -h '~/.bashrc' + guix home container home.scm -- test -h '~/symlink' test "$(guix home container home.scm -- id -u)" = 1000 guix home container home.scm -- test -f '$HOME/sample/home.scm' && false guix home container home.scm --expose="$PWD=$HOME/sample" -- \ @@ -153,6 +157,8 @@ EOF test -d "${HOME}/.guix-home" test -h "${HOME}/.bash_profile" test -h "${HOME}/.bashrc" + test -h "${HOME}/symlink" + test "$(readlink -f $HOME/symlink)" == "$test_directory" grep 'alias run="guix shell"' "$HOME/.bashrc" grep "alias path='echo \$PATH'" "$HOME/.bashrc" test "$(tail -n 2 "${HOME}/.bashrc")" == "\ -- 2.49.0 From debbugs-submit-bounces@debbugs.gnu.org Mon May 12 03:49:21 2025 Received: (at 78378) by debbugs.gnu.org; 12 May 2025 07:49:21 +0000 Received: from localhost ([127.0.0.1]:49735 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uENub-0000GG-Al for submit@debbugs.gnu.org; Mon, 12 May 2025 03:49:21 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:46184) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uENuY-0000Fu-JR for 78378@debbugs.gnu.org; Mon, 12 May 2025 03:49:19 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-739b3fe7ce8so3643116b3a.0 for <78378@debbugs.gnu.org>; Mon, 12 May 2025 00:49:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747036152; x=1747640952; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=NM5jAhpmBG+OggdSqRJZhaa+xX6F0Qaia9zBKlgVjQs=; b=DWXzbTv+6CbKRSr4Catj2JGwKAVo/LWogruVsp5ZTR6LeQoA+h6s7U8BZQ9ujvXVs6 loKkRRP+IB2DJUO01Z3gSzuXeLWI5aWmv3DcFyZQtmupA/Ynh+a3x9U+IhDOeynzH+c5 +XF9uHOtZHK1ye2ZdDHetmlBw8utwO9DQL1QJ+kGj1ZEbFxD6lDEi0s/ayIfk54K9V0G tMJSbYNC0vRa41TKX/gDtimmghCDi86Wl8fooDCq1HfClUeg7H4Ar1XAzsAasQG68Svh 3ITOKe+vF+PZBkcu8h5kzGJz61kMn8gFwHa7vNaqdx/ao52wBAJ5yP4l2ERZUMeE5rZK ZEEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747036152; x=1747640952; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=NM5jAhpmBG+OggdSqRJZhaa+xX6F0Qaia9zBKlgVjQs=; b=uWcp5NeY3hMUpzmt4V6t9AiWB1bdwCqFZWKwlPAYttHZRMi3+VLLs470J+tBKUU4wp 5zPnQcXHYL9e8idzv8EH+1tUoZ2U/+Ma6HKfrQboGVtLR9uWyskGlaA0Y2chmvMB/10v Dqilv9Bi/SIwIq+iYrvD11/YqGb1h2Q7mxmhr80hIbZp2aGcGGziwvgRS50/KkMyD0VV 4ksJfktYaRBDlxrI/4myRFSBJt/5xyHPAd6kJfJH5qKTxgsPzGZW+VYUnlu5q0p391mu x09MXbmYBhacojiSd4fXRqJ3PqOGM8RL/XMmD8IYkRefcxK9gics/VGhETxE2wvnoq+Z wYFg== X-Gm-Message-State: AOJu0Yx4eDKNT1SeGt3IpVBO+VJutl8q21sAy8E8jXNBFoWn6FgKhYOl zHGyEMnHoUZFRHC9hP7mYNJrchNh6YdZf+lT3lNhR42gJ7Uke/57 X-Gm-Gg: ASbGncu2MkQm1ws6WETGIqyHuep04Wlp9/8yVbWjsoAV2+XMT+W4iKVww17B3Xhde89 PWifDL85uUMgAJwKXIYVyayr4uel0tLCgKrpKtK7tlm8vNAmYbUDFR5pDBmL8o7U/8f/O0Ecrz+ O6k1os+/jZa6EVAQIkNEh1URTEEgIPZtymDJDguvqfx/ClGiVoZG37RxJzlnkQHGNINez6rpki+ kmPBt5AF4bxodUR40chTAUMcqfzJex8G0qXxV8QrT5pm4mmwGl6S7ebXHZQwbFX/d9h11tf7jmI gU6Cwe0g1QtsOoJ55YohAqhoXLg1M/OkAco3mMebbviD1TgGQA== X-Google-Smtp-Source: AGHT+IFfFRZmVBq9xWy4JT7AvERzTC37zLv0W5fxz0ehTW0rgq6czK0vyH27QyvOqPlRgMDbrrAOmg== X-Received: by 2002:a17:90b:1a88:b0:2ff:5a9d:937f with SMTP id 98e67ed59e1d1-30c3d62db46mr19051174a91.24.1747036152169; Mon, 12 May 2025 00:49:12 -0700 (PDT) Received: from terra ([2405:6586:be0:0:83c8:d31d:2cec:f542]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b234ad4205dsm4982123a12.44.2025.05.12.00.49.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 May 2025 00:49:11 -0700 (PDT) From: Maxim Cournoyer To: Sergey Trofimov Subject: Re: [bug#78378] [PATCH 1/2] gexp: Add symlink-to procedure. In-Reply-To: <043c83e23cd42da9c61d0e4f5bf5fb7299332a49.1746978699.git.sarg@sarg.org.ru> (Sergey Trofimov's message of "Sun, 11 May 2025 18:08:02 +0200") References: <043c83e23cd42da9c61d0e4f5bf5fb7299332a49.1746978699.git.sarg@sarg.org.ru> Date: Mon, 12 May 2025 16:49:08 +0900 Message-ID: <87o6vyqnez.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 78378 Cc: Josselin Poiret , Tobias Geerinckx-Rice , Simon Tournier , Mathieu Othacehe , Ludovic =?utf-8?Q?Court=C3=A8s?= , Gabriel Wicki , 78378@debbugs.gnu.org, Christopher Baines X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Sergey Trofimov writes: > * guix/gexp.scm (symlink-to): New procedure. > * doc/guix.texi (G-Expressions): Document it. > > Change-Id: I7c1ba3a29a4e5350cb4f196185b7171c4750b6b8 Reviewed-by: Maxim Cournoyer -- Thanks, Maxim From debbugs-submit-bounces@debbugs.gnu.org Sun May 18 17:03:34 2025 Received: (at 78378) by debbugs.gnu.org; 18 May 2025 21:03:35 +0000 Received: from localhost ([127.0.0.1]:60967 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uGlAU-0007al-Hk for submit@debbugs.gnu.org; Sun, 18 May 2025 17:03:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51774) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uGlAD-0007Yy-Nc for 78378@debbugs.gnu.org; Sun, 18 May 2025 17:03:18 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uGlA6-0002Jl-44; Sun, 18 May 2025 17:03:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=sTOdH4RywLY1quPG8dXyBGoS8Qd1+RC5ui2AIXkA1hQ=; b=rzhXhkkIboijnmsXz2HY WFREPDnf3fB7CCuwuHAvWq5Vg4ga6ADE5kkayPrg31WXQGv6+uvr+tA8+lpzznRFavOaLevx0jG65 L+2rXqZeMDtjimvRepFFO2W3DMGXjB4kUTfEcD5JJ4DI7Uiu9yfiV2c+GGJmuZ3mjEMyP87ZpOEWM uCgSyAyX18hpyyZv7Xa2oEGExJ9uHBq/o/WLJeTfr+xKg2uk/xD6RaUQjJ9VqwZ/vHtbBRWLqypvF YcZ2uEvxv386dT19xfoXtVK3IAXR3NNNUTnVAPJq0DDeF9wNi2T8IhYPs4fSbictBnzsW2Yj8A+X0 WMfm4TbzpoO2yw==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Sergey Trofimov Subject: Re: [bug#78378] [PATCH 2/2] home: services: Build "files" union allowing dangling symlinks. In-Reply-To: (Sergey Trofimov's message of "Sun, 11 May 2025 18:08:03 +0200") References: Date: Sun, 18 May 2025 22:28:30 +0200 Message-ID: <87h61hll3l.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78378 Cc: Hilton Chain , Janneke Nieuwenhuizen , Tanguy Le Carrour , 78378@debbugs.gnu.org, Andrew Tropin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Sergey, Sergey Trofimov writes: > * gnu/home/services.scm (files->files-directory): Build file union > without checking for existence of included items. > > * tests/guix-home.sh: Verify symlinking files out of store works. > > Change-Id: I94054003f4a6be944252ce7a397cf56f0b979554 [...] > @@ -343,7 +343,21 @@ (define (files->files-directory files) > ;; leading to a build failure of "files.drv". > (assert-no-duplicates files) >=20=20 > - (file-union "files" files)) > + ;; Compute the file-union allowing dangling symlinks > + ;; This enables creating symlinks to locations out of store > + (computed-file > + "files" > + (with-imported-modules '((guix build utils)) > + #~(begin > + (use-modules (guix build utils) > + (ice-9 match)) > + (mkdir #$output) > + (chdir #$output) > + (for-each (match-lambda > + ((target source) > + (mkdir-p (dirname target)) > + (symlink source target))) > + '#$files))))) Instead of more or less duplicating =E2=80=98file-union=E2=80=99, how about= adding a #:dangling-symlinks? argument to =E2=80=98file-union=E2=80=99 that would de= fault to #f? When set to #t, the =E2=80=98stat=E2=80=99 call would not be emitted. That would reduce code duplication and make the intent clearer IMO. Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Mon May 19 05:50:39 2025 Received: (at 78378) by debbugs.gnu.org; 19 May 2025 09:50:39 +0000 Received: from localhost ([127.0.0.1]:37559 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uGx8o-0005l0-VT for submit@debbugs.gnu.org; Mon, 19 May 2025 05:50:39 -0400 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]:54406) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uGx8g-0005k7-NG for 78378@debbugs.gnu.org; Mon, 19 May 2025 05:50:32 -0400 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-ad55d6aeb07so240860066b.0 for <78378@debbugs.gnu.org>; Mon, 19 May 2025 02:50:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sarg.org.ru; s=google; t=1747648224; x=1748253024; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=SrN96xUvUy7tvRb2XELDKg3EjfqqHlsfKZtP1sQeIao=; b=FnT06H3YeX85kQtuOia0zDuKYHAD0i3aFDo3AMmnQlebdUpfx7ZkpehPED3+2hnbQ0 owHopnJn2pQrFILWlnMmKqm7d241JlNJqlBgO7pXS3bPSeu57lHraJXPTqeD7fkCUNA5 lrHGjuE6xwAgQ2ejNrSrR98tu6bZg30X/xdCdtSKde3WqJgtyo7SiqpEN64l+vdgAP/m FEhFAqRAa9GokYoGWUDWou7E/84lKEu5FAOnCsjINAo0yq5rCE99h+27kahThQOXDnjl YeODVctYHkkMeCFmorRY6BbREgfMKUFFU1o4/1VUAe61Pgb+Zy+AyzalzLJjpnBMTXQb h93w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747648224; x=1748253024; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SrN96xUvUy7tvRb2XELDKg3EjfqqHlsfKZtP1sQeIao=; b=XTGzuFQXLiVhDmViyX9Tc2msM7C7jVPnYY5/rqjld/s/0OVUUsX40G9p3epYa3m0vz hXiY7K8TL32jRG3qk9wWK85SkgYlryEY/gQEXliS7gx5IfQGcHk+nsNKjMhK22nfW+tb MAphDlozmRFYxQfvQMt2E+3pzLjDkXxYuAyJ9m4mdcXO+pXjaujQwrJZa4kDa2CLAN8N 8pKaByXMnKPMKILzLz701va2XRJVqOmJIWpa52SpYq5gAz7yMKK4bIXMAvvldTBcg4/J IJkMVMP0JxShwn6GmAYkqbG5u4jiW3ZjHBbpbfnOaHHpUeHuVmPGNwtQC1z9puxb9WId G83Q== X-Gm-Message-State: AOJu0YxDYpSHrg9H9Yd3kH+TktbapGA7o2njGJRpX0xKZgZ2MZsy+z6Y b5m9MFNOCq4nbf1OuOVeooZyS8mZQvYQJkvIcpdGWbuo3y0LCQMEMlvN/qSZkwYeps/OUBJ2lL0 SoNgOL/vdaA== X-Gm-Gg: ASbGncuAi0WufWlHeD/+42b30Q9a4ddJCxMLOXhY5D812KSVo01ItivLdKFAdRNHxa8 DKZDzmHlVmq4T158Fr0o/mB9UDd3Q3iO2Qwq2a2L3A33xYBaaHrZjg+rdL36s4VgViqxpHw4aFC M8q1Abk6qfjOY7hbztwrz7LN7SlE6DfkYgg1iRjNjSIWI9cLbM8xeRvlsD+rry7D4W8BbvdIaOW AaYB/jrlEpbr/b7MbscxNQAcZ6Yonxspo8VL6phmkItMRsk69RxEGo3mvWxbVH2Ssyw637wIN25 Zu3bJgGapmlJ2ZjtsfHMAqQNQyoug1r6rzkKZ5aARNXCbEuyUQ== X-Google-Smtp-Source: AGHT+IGdw84OVaDs15C0JnnNwpA06QyDPlUH+/jLC8xMO0bEphVUXVd/xnIer1Zb1MWS7SxobBrUFA== X-Received: by 2002:a17:907:9803:b0:ad5:3156:2c06 with SMTP id a640c23a62f3a-ad536bdf940mr861699966b.28.1747648223736; Mon, 19 May 2025 02:50:23 -0700 (PDT) Received: from localhost ([2a02:2454:a095:5600:a64e:31ff:fe38:fd6c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ad52d278adcsm561225266b.84.2025.05.19.02.50.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 May 2025 02:50:23 -0700 (PDT) From: Sergey Trofimov To: 78378@debbugs.gnu.org Subject: [PATCH v1 1/3] gexp: Allow file-unions with dangling symlinks. Date: Mon, 19 May 2025 11:50:08 +0200 Message-ID: <40e225a93a488b887fc770effe8f856c62620d28.1747647920.git.sarg@sarg.org.ru> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 X-Debbugs-Cc: Sergey Trofimov , Maxim Cournoyer , Ludovic Courtès , Christopher Baines , Gabriel Wicki , Josselin Poiret , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 78378 Cc: Sergey Trofimov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * guix/gexp.scm (file-union): Add #:dangling-symlinks? parameter. Change-Id: I09d44ec785fd7141b02dee2d8dc23ccc499aa933 --- doc/guix.texi | 12 +++++++----- guix/gexp.scm | 19 ++++++++++--------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index fd86551787..ef8504bb3e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -12673,11 +12673,13 @@ G-Expressions This is the declarative counterpart of @code{text-file*}. @end deffn -@deffn {Procedure} file-union name files -Return a @code{} that builds a directory containing all of @var{files}. -Each item in @var{files} must be a two-element list where the first element is the -file name to use in the new directory, and the second element is a gexp -denoting the target file. Here's an example: +@deffn {Procedure} file-union name files [#:dangling-symlinks? #f] +Return a @code{} that builds a directory containing all +of @var{files}. Each item in @var{files} must be a two-element list +where the first element is the file name to use in the new directory, +and the second element is a gexp denoting the target file. +@code{#:dangling-symlinks?} controls if gexps must lower to an existing +file. Here's an example: @lisp (file-union "etc" diff --git a/guix/gexp.scm b/guix/gexp.scm index 8dd746eee0..85d049e26a 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -2144,7 +2144,7 @@ (define* (mixed-text-file name #:key guile #:rest text) (computed-file name build #:guile guile)) -(define* (file-union name files #:key guile) +(define* (file-union name files #:key guile (dangling-symlinks? #f)) "Return a that builds a directory containing all of FILES. Each item in FILES must be a two-element list where the first element is the file name to use in the new directory, and the second element is a gexp @@ -2170,14 +2170,15 @@ (define* (file-union name files #:key guile) (map (match-lambda ((target source) (gexp - (begin - ;; Stat the source to abort early if it does - ;; not exist. - (stat (ungexp source)) - - (mkdir-p (dirname (ungexp target))) - (symlink (ungexp source) - (ungexp target)))))) + (let ((source (ungexp source)) + (target (ungexp target))) + (unless (or (ungexp dangling-symlinks?) + (stat source #f)) + (error (format #f "~a points to inexistent file or dangling symlink ~a" + target source))) + + (mkdir-p (dirname target)) + (symlink source target))))) files))))) #:guile guile)) base-commit: 450a361532573a02389530a6a80b7821683ed41b -- 2.49.0 From debbugs-submit-bounces@debbugs.gnu.org Mon May 19 05:50:40 2025 Received: (at 78378) by debbugs.gnu.org; 19 May 2025 09:50:40 +0000 Received: from localhost ([127.0.0.1]:37561 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uGx8p-0005l8-Rh for submit@debbugs.gnu.org; Mon, 19 May 2025 05:50:40 -0400 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]:54749) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uGx8j-0005kI-5i for 78378@debbugs.gnu.org; Mon, 19 May 2025 05:50:33 -0400 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5fc8c68dc9fso7903512a12.1 for <78378@debbugs.gnu.org>; Mon, 19 May 2025 02:50:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sarg.org.ru; s=google; t=1747648226; x=1748253026; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=17spmlx2jvVFmon0wWik5mH70YrXX0bY6FGy2m7lYNs=; b=SY0hQL1Ttgz0nsiJb2zr14PC1gcP02/mkGm6iVmc+cT2LBNqZXH5rKS/cxRyZPEDmr 1gE4AMP1plSn5nxjzzgOMju4CLgMluJ3A2cGf8xizf0WbzIeuWz7bAQSnFkocptehlr2 3R5ZlhemaqcrqRAdvLLR/4GPLEaM2woZ1/NDi6x0gG79L7JRxV0BgbaAEBxSNyPSLERa BF9erLnJd29dYM2z1BeEy18lQV2bHzQYspvdZ/aS3vwR1nmHjL0cEW8uleEgGPyWGtoT MIAQdOheGWbNV8Hs2dulxcDyNP1i3EsMNYdvoBSX5FltZNLJWib2Xu9aaMydD2Bmnc7d UhyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747648226; x=1748253026; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=17spmlx2jvVFmon0wWik5mH70YrXX0bY6FGy2m7lYNs=; b=veLTEmPb6ENJHXBQZRqAFRssBq0yGv9Bz1cLWblAyqoZwrj8EAalSmWqNqKc4/jpWs D2MnG3/VlzKEFNGs015JcA5b9T5yiHFrOn955sSnPLj2Xld9fhk1xA7+8gnSTdVTb8z5 ZlcoEyq7SfOhRlrhWaz9LEvnYNqZwyLsZF71S+riCjD1wSRSzy1d+YgPAtNGw35fF+yI LoSstTPyFOGiEKyTtMeJbtyXDlwoSevTczEvXafAmj4ODeqXpLHQGemJUsJkh8C2+IjN G+oAUQUtlepBIQ7XzTbgFVPwT3Ddg4c5eIy/7ut+/L125VkDECBioNdLRbqfnynaBzXZ wsew== X-Gm-Message-State: AOJu0YxyLU4zGQH1yyDnNHwriNznUigR+50nghQyUdNYAf6OzgFmtNhY IjdJeXraaZRmxD4in906fR+xgWuFLdXQaCPGaZS/KsEX6TKmIZtnl7DjZVYVf80Jp3Alv5i/jgN XasC1sDttgA== X-Gm-Gg: ASbGncvVhNx4i/845UkNGa6X6dQ7+TcNfJxVJI7AYWyzzygy0dD1kCUdr9jvkHn9VZD vM8KPae/pUz3bRL8HzehGNRQ2s0EmkXC80wBLFJognGsauKP3mA4UBg5ImQ7YrhPlHzEMVdk1UW JpbsEcrL7H/0Gh8brXq9lELv9QwVS3KxG/9h1Hes2GyaPCpVNfdsWwUrbFtx5kDeH+RzmQ17v1E UTdzN6THs8LP1vZRRh088XUtfMS2Rk9Ha45leWM2yRHbQUucXYfpl6FapS8AAkOIeJI15Jx4Zq3 xODErf25jRUNKardBef3NEjpxHVJk7AEzFSA2hi5FcWnrQPE3OMuAUxBQbVg X-Google-Smtp-Source: AGHT+IFopxG1dF9ofAs1rFb+SJYtkNtj7keth1htjYw+b90y97ADjahTZjr9YmPg78OQZZm9o5ihsA== X-Received: by 2002:a17:907:1c2a:b0:ad2:40f4:c251 with SMTP id a640c23a62f3a-ad536bdff0bmr986460666b.35.1747648226561; Mon, 19 May 2025 02:50:26 -0700 (PDT) Received: from localhost ([2a02:2454:a095:5600:a64e:31ff:fe38:fd6c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ad52d4382d7sm560856166b.117.2025.05.19.02.50.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 May 2025 02:50:26 -0700 (PDT) From: Sergey Trofimov To: 78378@debbugs.gnu.org Subject: [PATCH v1 2/3] gexp: Add symlink-to procedure. Date: Mon, 19 May 2025 11:50:09 +0200 Message-ID: X-Mailer: git-send-email 2.49.0 In-Reply-To: <40e225a93a488b887fc770effe8f856c62620d28.1747647920.git.sarg@sarg.org.ru> References: <40e225a93a488b887fc770effe8f856c62620d28.1747647920.git.sarg@sarg.org.ru> MIME-Version: 1.0 X-Debbugs-Cc: Sergey Trofimov , Maxim Cournoyer , Ludovic Courtès , Christopher Baines , Gabriel Wicki , Josselin Poiret , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 78378 Cc: Sergey Trofimov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * guix/gexp.scm (symlink-to): New procedure. * doc/guix.texi (G-Expressions): Document it. Change-Id: I7c1ba3a29a4e5350cb4f196185b7171c4750b6b8 --- doc/guix.texi | 11 +++++++++++ guix/gexp.scm | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index ef8504bb3e..02f472246a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -12692,6 +12692,17 @@ G-Expressions This yields an @code{etc} directory containing these two files. @end deffn +@deffn {Procedure} symlink-to target +Return a @code{} that is a symbolic link to target. +Note, that the target does not need to exist at the build time. One of +uses is to put arbitrary symlinks into user's home: + +@lisp +(service home-files-service-type + `(("Sync" ,(symlink-to "/storage/Sync")))) +@end lisp +@end deffn + @deffn {Procedure} directory-union name things Return a directory that is the union of @var{things}, where @var{things} is a list of file-like objects denoting directories. For example: diff --git a/guix/gexp.scm b/guix/gexp.scm index 85d049e26a..5cb5e8e4e4 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -119,6 +119,7 @@ (define-module (guix gexp) file-union directory-union references-file + symlink-to imported-files imported-modules @@ -2182,6 +2183,10 @@ (define* (file-union name files #:key guile (dangling-symlinks? #f)) files))))) #:guile guile)) +(define (symlink-to target) + "Return an object that is a symlink to TARGET." + (computed-file "link" (gexp (symlink (ungexp target) (ungexp output))))) + (define* (directory-union name things #:key (copy? #f) (quiet? #f) (resolve-collision 'resolve-collision/default)) -- 2.49.0 From debbugs-submit-bounces@debbugs.gnu.org Mon May 19 05:50:51 2025 Received: (at 78378) by debbugs.gnu.org; 19 May 2025 09:50:51 +0000 Received: from localhost ([127.0.0.1]:37563 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uGx90-0005lc-F3 for submit@debbugs.gnu.org; Mon, 19 May 2025 05:50:51 -0400 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]:54406) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uGx8l-0005kQ-6m for 78378@debbugs.gnu.org; Mon, 19 May 2025 05:50:35 -0400 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-ad55d6aeb07so240878366b.0 for <78378@debbugs.gnu.org>; Mon, 19 May 2025 02:50:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sarg.org.ru; s=google; t=1747648228; x=1748253028; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lbTmUpMeznC1BlH4SjtP8GdmpGUFySP6Pqj1HcPA1fc=; b=W755QXwhuvcgnwcaUgUYEEvn8K/ZcPJYV39F4qeCBVGQoqJ31L8rBrAoUaC6a6FmLO BR8kAGYm0lkefw0Ysayz9mTkC8kKDCkNk05PV/q+kCz1cJ3IML7kaQRdK31AKnJwPTkg PKmujui8eLUdbykGubHpsWKSkUWQm1TQkYGka7eZVUXUS0WZmYR+NauahS69OFE4mCX3 0tpHDWQHrziSstokQXXFFTRj/ltNZc6F97DcU3AtiTNQmdf0vAbX9BtkB/e9U1TEdOWk CFhjIKTw+2zFoaUFg79EAFrW4VcjSG3ZPtksbng1gh6pyPJF+eUryzseXKFVOJhiX70U KO3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747648228; x=1748253028; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lbTmUpMeznC1BlH4SjtP8GdmpGUFySP6Pqj1HcPA1fc=; b=HyJwuJafnrwq2Bf7snwOmG7y+VP10jckGwblkkNn8f6Kew21jDeVuI26mA4gtIDycA IREK2fJPgLiize1UNwURoPMFh1URKBWeYRukfxCUDK2iWFTuy0GK6y8drApM7aXbYRqB +MO6tVCPznrK6BrHPrqHj+h5AP2u6euzOquUKkQx5Id944YghnGMYIFRqslvYOBp7LxI eaWKqIFN9biNPaUlk9kbAQY63t1gN+u1Pjkx5tepL8avJiaa7np2aUvAU46/raszYxdd THy+bFkPLZ/CywIBC9IiagxzbjcrunWbbTO4jUC7K8og9hwVqOiXQ10NeImYmtNU2D9H R1Kw== X-Gm-Message-State: AOJu0Yw9taOKpD0YxmPmO3X5HnLmTBUDMAny3IhOzTdGojXHb91XSN/G V9v+zeOB0QHIZULenU32d0TM8bbqd7lpFO85L8ShhEcXxols1ZE7jzH8Ih7tAcVjc7r2p2TBCvV hJ7T99BfFsQ== X-Gm-Gg: ASbGncs0/GcGeOYZRdF1tZJfvZdhzPJY3rAKDQYH1ZxASSKztzhxptkIQ9uLjNCA9/7 Uczwu0e+wpa7Z/7CUpT5hYTkt6J2IOpDUiCsQQ9XDEQojm8ii9aGDsr7cxZeVWq5q44euPF6jVq dlb5eiwG+XqX9QN44AcJ2BWtEX/jn6BVZPxljvIF7YuGlyRtMO30Es2hKXn6TG8dnzMjn+AgrQy lskzH/Gt+O5zHHSgdOg623wFgfCUEylMXo2Tf8rbeCt0oBXfoOBE2Dmt2cenElVZKKujBYmLALm d3H1o28p+ESdqJMq87+gldinVBLynWc8BjeLlDJbUmU8VI1pRQ== X-Google-Smtp-Source: AGHT+IEEjp9d5TSx+/lBv8rBnZt6y1NEbL4AHEU12phUK1GOf+GFAZO4aovkqsjcQSXVcAGLk7py0w== X-Received: by 2002:a17:907:e916:b0:ac7:c7cd:ac39 with SMTP id a640c23a62f3a-ad536b82a85mr899881866b.24.1747648228541; Mon, 19 May 2025 02:50:28 -0700 (PDT) Received: from localhost ([2a02:2454:a095:5600:a64e:31ff:fe38:fd6c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ad52d438384sm571442866b.106.2025.05.19.02.50.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 May 2025 02:50:28 -0700 (PDT) From: Sergey Trofimov To: 78378@debbugs.gnu.org Subject: [PATCH v1 3/3] home: services: Build "files" union allowing dangling symlinks. Date: Mon, 19 May 2025 11:50:10 +0200 Message-ID: X-Mailer: git-send-email 2.49.0 In-Reply-To: <40e225a93a488b887fc770effe8f856c62620d28.1747647920.git.sarg@sarg.org.ru> References: <40e225a93a488b887fc770effe8f856c62620d28.1747647920.git.sarg@sarg.org.ru> MIME-Version: 1.0 X-Debbugs-Cc: Sergey Trofimov , Maxim Cournoyer , Ludovic Courtès , Andrew Tropin , Hilton Chain , Janneke Nieuwenhuizen , Tanguy Le Carrour Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 78378 Cc: Sergey Trofimov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/home/services.scm (files->files-directory): Build file union without checking for existence of included items. * tests/guix-home.sh: Verify symlinking files out of store works. Change-Id: I94054003f4a6be944252ce7a397cf56f0b979554 --- gnu/home/services.scm | 3 ++- tests/guix-home.sh | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gnu/home/services.scm b/gnu/home/services.scm index 2342dc5e07..c09e6cdadd 100644 --- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -343,7 +343,8 @@ (define (files->files-directory files) ;; leading to a build failure of "files.drv". (assert-no-duplicates files) - (file-union "files" files)) + ;; Allow symlinks to locations out of store + (file-union "files" files #:dangling-symlinks? #t)) ;; Used by symlink-manager (define home-files-directory "files") diff --git a/tests/guix-home.sh b/tests/guix-home.sh index dbfe7dbd48..b8d90196f1 100644 --- a/tests/guix-home.sh +++ b/tests/guix-home.sh @@ -73,7 +73,9 @@ trap 'chmod -Rf +w "$test_directory"; rm -rf "$test_directory"' EXIT (list `(".config/test.conf" ,(plain-file "tmp-file.txt" - "the content of ~/.config/test.conf")))) + "the content of ~/.config/test.conf")) + + `("symlink" ,(symlink-to "")))) (service home-bash-service-type (home-bash-configuration @@ -104,6 +106,7 @@ trap 'chmod -Rf +w "$test_directory"; rm -rf "$test_directory"' EXIT "# the content of bashrc-test-config.sh")))))))) EOF + sed -i "s,,$test_directory," home.scm echo -n "# dot-bashrc test file for guix home" > "dot-bashrc" # Check whether the graph commands work as expected. @@ -126,6 +129,7 @@ EOF guix home container home.scm -- cat '~/.config/test.conf' | \ grep "the content of" guix home container home.scm -- test -h '~/.bashrc' + guix home container home.scm -- test -h '~/symlink' test "$(guix home container home.scm -- id -u)" = 1000 guix home container home.scm -- test -f '$HOME/sample/home.scm' && false guix home container home.scm --expose="$PWD=$HOME/sample" -- \ @@ -153,6 +157,8 @@ EOF test -d "${HOME}/.guix-home" test -h "${HOME}/.bash_profile" test -h "${HOME}/.bashrc" + test -h "${HOME}/symlink" + test "$(readlink -f $HOME/symlink)" == "$test_directory" grep 'alias run="guix shell"' "$HOME/.bashrc" grep "alias path='echo \$PATH'" "$HOME/.bashrc" test "$(tail -n 2 "${HOME}/.bashrc")" == "\ -- 2.49.0 From debbugs-submit-bounces@debbugs.gnu.org Mon May 19 06:00:41 2025 Received: (at 78378) by debbugs.gnu.org; 19 May 2025 10:00:41 +0000 Received: from localhost ([127.0.0.1]:37618 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uGxIW-0006Ih-Ra for submit@debbugs.gnu.org; Mon, 19 May 2025 06:00:41 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:51239) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uGxIT-0006IK-TT for 78378@debbugs.gnu.org; Mon, 19 May 2025 06:00:38 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-43d0618746bso32693235e9.2 for <78378@debbugs.gnu.org>; Mon, 19 May 2025 03:00:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sarg.org.ru; s=google; t=1747648832; x=1748253632; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:user-agent :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=96mAZ5Xz/3RUDgNKFceI+pqgzSYeNb70gy6kCqwjr6Q=; b=R/YUKOXSmyHmcv3Ami3hQd8ii+jn2+4/ptC+vFXHUEc/uQG6Dyv4E5wQvxQUHajiao M31xaMNOCP3k3H8evImANPvm64yEfzR6WIlm3EXdnx90HPFqy53Wrt1Fv9nAvR44aB+t ig3qoS9hRK1ftwtcZmiFXPcuAZddAZhYJtqnHuwQIdO8mB5rV6vkB5ifFv/5vMKb/M8p ZlwYhTg8gkMpyrrIFeutEwx/jQIbxDlKCsj/tY73Uo6bEYxSaOX5FTbDPKCtV7iSFBy6 TvGrCFvXwiP9c1SXTSzM9sQryGYINvNfCO0zDN3phr6b7cEJ1rJe1WtoEr/ZFCP9RifF E90g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747648832; x=1748253632; h=content-transfer-encoding:mime-version:message-id:date:user-agent :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=96mAZ5Xz/3RUDgNKFceI+pqgzSYeNb70gy6kCqwjr6Q=; b=avbYsK+sxs7aaLbs1MBDitVWLmWQ9XZbC+wmYBZ5rVsy+xi0Ho+GPgr5TPZu/I8UmX TzDZiDcyYKqeyU0yXRnd0cG35XHwurKtVhu8YmeH7FtsPVfx4oPsV2K4QP2L1pjHJOmH 90n4IpBsBtK4IoBd/3xXvkSBdYYMJPge69uMF4CT5mHcenUbrvwgd5yWnggKXuGU0a39 4GOIGhOHQdO1M0QCGjvMbZz5EEDQCpZsJuecgi2t1UjG3hfpS/nNFUgkiBVoCfWZ8teg 6k3Z1WnkuQ5o3T/Ce/4XG1ubIuuaOWeSkTc3sRmxDEIW/j1lWXozGcTsflgXG8oAwGH3 Cuog== X-Gm-Message-State: AOJu0YxQ62qeIZ0dQAGnadkk996j2WIhCu1qV9S3tk1DviY38/mNg3Bz Hlc2ea3Z5CO4HBy5v7Fi1J48hZGIUAaNaxzE95L44NWuusMNYURdxSPJMu+kshVnyFQ= X-Gm-Gg: ASbGnctd2NeAYVigoYD3Bwp05L7uvyghx7EdH0e/ggAzSQxJzzUZU/NudELYKLOLRyn gRFWNRbCqwgHCpdn42cUDc2PZ/dvqvcSZRjvMlSSMTDzLmJ0kUgvJp9yjE1STzF2uygX1imW5T2 ZBN+eaVlxXXfyp0b1VT55LdCcrpggsAtn3NzF8hzRChs3mr/AhaDGlj4ayZBJGNRpRYpfTy4EKQ jiz4H7yIJZxTC31efSVhYsNSbTnQejy+kvUooqRQmtLCTshadqLGRqhb2lkpEuCvpRAYElJA0Xq LHdKPP3piDsDrHTeMtOOJT5ZUWXuqevz900bYb3nIWShrscsjg== X-Google-Smtp-Source: AGHT+IE+g8JTYp/ZJh2eo2Of+qjWRFmt2aO3EzEtDvGjLKRoxe/SdLwYiGJnVPs0dhXjEnnZ503MOA== X-Received: by 2002:a05:600c:3c82:b0:43c:fffc:7886 with SMTP id 5b1f17b1804b1-445229b431cmr41925235e9.8.1747648831780; Mon, 19 May 2025 03:00:31 -0700 (PDT) Received: from localhost ([2a02:2454:a095:5600:a64e:31ff:fe38:fd6c]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-442fd50b9a7sm136186165e9.10.2025.05.19.03.00.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 May 2025 03:00:31 -0700 (PDT) From: Sergey Trofimov To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#78378] [PATCH 2/2] home: services: Build "files" union allowing dangling symlinks. In-Reply-To: <87h61hll3l.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Sun, 18 May 2025 22:28:30 +0200") References: <87h61hll3l.fsf@gnu.org> User-Agent: mu4e 1.12.9; emacs 30.0.92 Date: Mon, 19 May 2025 12:00:30 +0200 Message-ID: <878qmsly2p.fsf@sarg.org.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 78378 Cc: Hilton Chain , Janneke Nieuwenhuizen , Tanguy Le Carrour , 78378@debbugs.gnu.org, Andrew Tropin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Ludovic Ludovic Courtès writes: > Hi Sergey, > > Sergey Trofimov writes: > >> * gnu/home/services.scm (files->files-directory): Build file union >> without checking for existence of included items. >> >> * tests/guix-home.sh: Verify symlinking files out of store works. >> >> Change-Id: I94054003f4a6be944252ce7a397cf56f0b979554 > > [...] > >> @@ -343,7 +343,21 @@ (define (files->files-directory files) >> ;; leading to a build failure of "files.drv". >> (assert-no-duplicates files) >> >> - (file-union "files" files)) >> + ;; Compute the file-union allowing dangling symlinks >> + ;; This enables creating symlinks to locations out of store >> + (computed-file >> + "files" >> + (with-imported-modules '((guix build utils)) >> + #~(begin >> + (use-modules (guix build utils) >> + (ice-9 match)) >> + (mkdir #$output) >> + (chdir #$output) >> + (for-each (match-lambda >> + ((target source) >> + (mkdir-p (dirname target)) >> + (symlink source target))) >> + '#$files))))) > > Instead of more or less duplicating ‘file-union’, how about adding a > #:dangling-symlinks? argument to ‘file-union’ that would default to #f? > > When set to #t, the ‘stat’ call would not be emitted. > > That would reduce code duplication and make the intent clearer IMO. > > Ludo’. I've applied your suggestion in v1. From debbugs-submit-bounces@debbugs.gnu.org Tue May 20 19:14:40 2025 Received: (at 78378-done) by debbugs.gnu.org; 20 May 2025 23:14:40 +0000 Received: from localhost ([127.0.0.1]:38743 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uHWAR-00041v-Tj for submit@debbugs.gnu.org; Tue, 20 May 2025 19:14:40 -0400 Received: from mail-qv1-xf2b.google.com ([2607:f8b0:4864:20::f2b]:54492) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uHWAP-00041G-GJ for 78378-done@debbugs.gnu.org; Tue, 20 May 2025 19:14:38 -0400 Received: by mail-qv1-xf2b.google.com with SMTP id 6a1803df08f44-6f8d663fa22so40316666d6.0 for <78378-done@debbugs.gnu.org>; Tue, 20 May 2025 16:14:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747782872; x=1748387672; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=PCy6TE7TODuyk72RE8hnDCniEPUZB0DG7eEW7QGhoc4=; b=LT1bL0VKiYPKfm9lXWhLuysIF1l7PV6eALB+B0u/dZNfqfooo20FWEGnXFA17EKVqa kQRkFvxIyhIfAUsmkWny0L1OVXPsJxXfyJAkNT02yHWuVOoI0gPV3UKgJwcompQ0pymC KZZR4Lt4DaZj4XYbtdP55mOz1jpToDH7EthcaX623F3BoJG5abI8nEjS7cVNr6lHKhz0 zv3OPUYKLe60vrH53bIPsRNhpt8sQeHb+vy5kBuV8hnigwcO5XEx2DDN33dv7Em2mxSr GmpA8WqPDfHQAJMD1p+D5x6dGlOHTrwNsiM6DAo7BvOL9aFYNo+9Pi3zoSVwq3Wo0Sf2 rIMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747782872; x=1748387672; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=PCy6TE7TODuyk72RE8hnDCniEPUZB0DG7eEW7QGhoc4=; b=RcQOb5A6oYaX1qVOKg9ys4oV641oYY3Mc/mhSyiVfH420nQ19d1e+ClgHVT2GvQLNr CW/VjARZozBZX3ZB0pxFSz7C8iuyCvBi9C6xywn78eWtcplsCw3jkCpP6gdHhGrvDFHK uY9pceKquf08myvgqypDOozuKVWco0yhyOEIn6OELgaW/AaoopinBi/78ShEwQ+zNUZC vVjlUeLbxQs+88Xsdhn8clTXc1dZM0GkY2/enSPxJejY2KPrqsCg6/LRJVdufwlVPnqi ra6sll/QRQ+bKddcLyvr3ikQMZ3ZCABoqFSyTnFjNewzt2gXdvUrkWOKq2UheHKBqb6k lSMg== X-Gm-Message-State: AOJu0YznDkg0Gwzg+Ru5TnxPxIOLN9d0ER8gFJmoA6VMBt+x0/Xa2xo2 67LGcpodeWa1yT5QlJBuW4z4dlfdbkybgMkqNWSAdO8yGdtSnzU0n7w7 X-Gm-Gg: ASbGnctC6EYW23w/1qxB2EkZyeJg15ywVfyHC0lyhyl8f/cJKOotR1fPbZTkfJbIUBn vnLXPRSsr0wzEqdsSO4c1E1UB+fQrWw8DBiYXg//Fj0BqlFOsdFdwlqm0nPzy7jxR+Vj7BnBBgW v/z2K2d3cH4LI3s+9dApGkLzNmtqiN3ittUu6UnacF0+T7w6+GYLkBu0xxnzqverL4+Z3uyStVP PTFoX3bIzhEcYHSpdw6hj1Aho/OU8ymF1eAxX6fyj20/BoRG3oy6tLz+e5VYx2/0nusZlzfcjoi fcekYwDwp46H+GIsnYntgbnTe7ZhOotb5uijppg4wlyl51mmscqvcmpyRbiqZoFTyhI/rfDqnfV z6hbXycE= X-Google-Smtp-Source: AGHT+IEy7796RnJQtiF/vugDXaKawLUh87zJNRYw3y1o1kLPI5c+djv1ViZHQKcSwrmDW2j1vgOnkA== X-Received: by 2002:a05:6214:230c:b0:6e8:98a1:3694 with SMTP id 6a1803df08f44-6f8b2c32bfbmr322018346d6.8.1747782871592; Tue, 20 May 2025 16:14:31 -0700 (PDT) Received: from terra (vps-6234970c.vps.ovh.ca. [51.222.13.224]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6f8b0898f66sm78071816d6.27.2025.05.20.16.14.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 May 2025 16:14:30 -0700 (PDT) From: Maxim Cournoyer To: Sergey Trofimov Subject: Re: [bug#78378] [PATCH v1 1/3] gexp: Allow file-unions with dangling symlinks. In-Reply-To: <40e225a93a488b887fc770effe8f856c62620d28.1747647920.git.sarg@sarg.org.ru> (Sergey Trofimov's message of "Mon, 19 May 2025 11:50:08 +0200") References: <40e225a93a488b887fc770effe8f856c62620d28.1747647920.git.sarg@sarg.org.ru> Date: Wed, 21 May 2025 08:14:25 +0900 Message-ID: <87sekyan8u.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 78378-done Cc: Josselin Poiret , Tobias Geerinckx-Rice , Simon Tournier , Mathieu Othacehe , Ludovic =?utf-8?Q?Court=C3=A8s?= , Gabriel Wicki , Christopher Baines , 78378-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Sergey, I've merged this series with the following small adjustments for 1/3: --8<---------------cut here---------------start------------->8--- modified guix/gexp.scm @@ -2145,7 +2145,7 @@ (define* (mixed-text-file name #:key guile #:rest text) (computed-file name build #:guile guile)) -(define* (file-union name files #:key guile (dangling-symlinks? #f)) +(define* (file-union name files #:key guile dangling-symlinks?) "Return a that builds a directory containing all of FILES. Each item in FILES must be a two-element list where the first element is the file name to use in the new directory, and the second element is a gexp @@ -2159,29 +2159,29 @@ (define* (file-union name files #:key guile (dangling-symlinks? #f)) (\"libvirt/qemu.conf\" ,(plain-file \"qemu.conf\" \"\")))) This yields an 'etc' directory containing these two files." - (computed-file name - (with-imported-modules '((guix build utils)) - (gexp - (begin - (use-modules (guix build utils)) - - (mkdir (ungexp output)) - (chdir (ungexp output)) - (ungexp-splicing - (map (match-lambda - ((target source) - (gexp - (let ((source (ungexp source)) - (target (ungexp target))) - (unless (or (ungexp dangling-symlinks?) - (stat source #f)) - (error (format #f "~a points to inexistent file or dangling symlink ~a" - target source))) - - (mkdir-p (dirname target)) - (symlink source target))))) - files))))) - #:guile guile)) + (computed-file + name + (with-imported-modules '((guix build utils)) + (gexp + (begin + (use-modules (guix build utils)) + + (mkdir (ungexp output)) + (chdir (ungexp output)) + (ungexp-splicing + (map (match-lambda + ((target source) + (gexp + (let ((source (ungexp source)) + (target (ungexp target))) + (unless (or (ungexp dangling-symlinks?) + (stat source #f)) + (error (format #f "~a points to inexistent file \ +or dangling symlink ~a" target source))) + (mkdir-p (dirname target)) + (symlink source target))))) + files))))) + #:guile guile)) (define (symlink-to target) "Return an object that is a symlink to TARGET." --8<---------------cut here---------------end--------------->8--- Mostly to meet the max line width of 80 columns. And for 3/3: --8<---------------cut here---------------start------------->8--- modified gnu/home/services.scm @@ -343,7 +343,7 @@ (define (files->files-directory files) ;; leading to a build failure of "files.drv". (assert-no-duplicates files) - ;; Allow symlinks to locations out of store + ;; Allow symlinks to locations outside the store. (file-union "files" files #:dangling-symlinks? #t)) ;; Used by symlink-manager --8<---------------cut here---------------end--------------->8--- e.g. adding missing punctuation for a standalone comment. Pushed with commit 11bc17c409. -- Thanks, Maxim From unknown Wed Jun 18 23:09:43 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 18 Jun 2025 11:24:12 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator