From patchwork Wed Mar 26 16:51:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 40855 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 0F9DB27BBEA; Wed, 26 Mar 2025 16:52:13 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 7D62727BBE2 for ; Wed, 26 Mar 2025 16:52:12 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1txTz5-00044b-E4; Wed, 26 Mar 2025 12:52:07 -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 1txTz0-000444-7D for guix-patches@gnu.org; Wed, 26 Mar 2025 12:52:03 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1txTyz-0007W9-Ni for guix-patches@gnu.org; Wed, 26 Mar 2025 12:52:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=CJ/L9kunERGnh6KdCeg3IMWjSzFeEbgPhD2pk3HBqVQ=; b=o1TljbrKidpQsMNNtyZJJgsbeDr1Tbr3mjV/8trJErU9mQCG0QJ4La403olz62NQDXJnUifH5gI+4uqbLqxV2FnpQg5VpBeosUwiQ5Ny/pxpVOQgZJns4nt2QuakkBhlGeo4U9wjxC3w9YZ+E95nG8bL9NlySz86H4uaenOct0mRs/area8nKywb1sRCFidJJKnrGcB8/rUO3shJn6l+ZVxqPDPRMM8rzHZQ2D5s6C6m8lkHY3yGg0KKU0ffSVXWB4ES0OiUwopPW2RwKlAJRBG4AtGyrfh2ijlWeGvPGcz17Kg88HOV4YriVdbtpYsLl21rgpMeF33/g7wVq078Bw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1txTyz-0000ab-IU for guix-patches@gnu.org; Wed, 26 Mar 2025 12:52:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77288] [PATCH 2/6] services: account: Create /var/guix/profiles/per-user/$USER. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 26 Mar 2025 16:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77288 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77288@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 77288-submit@debbugs.gnu.org id=B77288.17430078932174 (code B ref 77288); Wed, 26 Mar 2025 16:52:01 +0000 Received: (at 77288) by debbugs.gnu.org; 26 Mar 2025 16:51:33 +0000 Received: from localhost ([127.0.0.1]:44137 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1txTyX-0000Yz-8X for submit@debbugs.gnu.org; Wed, 26 Mar 2025 12:51:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58046) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1txTyU-0000YT-8K for 77288@debbugs.gnu.org; Wed, 26 Mar 2025 12:51:30 -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 1txTyO-0007LF-VN; Wed, 26 Mar 2025 12:51:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=CJ/L9kunERGnh6KdCeg3IMWjSzFeEbgPhD2pk3HBqVQ=; b=Lu/jLpEy+jtFYcMxYx29 OEOKG83VFVDT1EGILU4Omei7V2Ty7+Myr33G+EjlMFw3iyTOYwn3QX3vRdOvJgeWRK4xgv20+obFF Toa+0QLvy4DvuEZ+ah/oc++ZRfa15KJqaVfwEtoCqwOai7gmzAFc6dqA5vChtwIcH7hzZS2O/wta+ +3dLqlpY4+bAxtDG6icO1ynbBmnd54X/qqFN2FAhwlLm5r+SPiiNMmwzv5bNdyLIdfO530HhDpA+u yoEH/d055bfDt3aBTl9thnHp7SKpPmjwPdWN6EjFMdZTzlvmY19UnVLYrblivnRkzN+SGjFG2jszQ wKlR6bzjihXDgA==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Wed, 26 Mar 2025 17:51:03 +0100 Message-ID: X-Mailer: git-send-email 2.49.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/system/shadow.scm (account-shepherd-service): Create /var/guix/profiles/per-user/$USER in ‘user-homes’ service. Change-Id: I22e66e8a34d63686df9bae64c68df65c8889e72a --- gnu/system/shadow.scm | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index b68a818871..d0f1b6b2b1 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013-2020, 2022, 2023 Ludovic Courtès +;;; Copyright © 2013-2020, 2022-2023, 2025 Ludovic Courtès ;;; Copyright © 2016 Alex Griffin ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; Copyright © 2020, 2023 Efraim Flashner @@ -460,6 +460,12 @@ (define (account-shepherd-service accounts+groups) (define accounts (filter user-account? accounts+groups)) + (define regular-account-names + (filter-map (lambda (account) + (and (not (user-account-system? account)) + (user-account-name account))) + accounts)) + ;; Create home directories only once 'file-systems' is up. This makes sure ;; they are created in the right place if /home lives on a separate ;; partition. @@ -480,6 +486,17 @@ (define (account-shepherd-service accounts+groups) (activate-user-home (map sexp->user-account (list #$@(map user-account->gexp accounts)))) + + ;; Create the user's profile directory upfront: + ;; guix-daemon lacks permissions to create it when it is + ;; running as an unprivileged user. + (for-each (lambda (account) + (let ((profile (in-vicinity + "/var/guix/profiles/per-user" + account)) + (owner (getpwnam account))) + (mkdir-p/perms profile owner #o755))) + '#$regular-account-names) #t))) ;success (documentation "Create user home directories."))))