From patchwork Mon Dec 12 03:00:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antero Mejr X-Patchwork-Id: 45184 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 C043927BBEC; Mon, 12 Dec 2022 03:02:33 +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=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,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 CCB9627BBEB for ; Mon, 12 Dec 2022 03:02:29 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p4Z4w-00035n-BE; Sun, 11 Dec 2022 22:02:06 -0500 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 1p4Z4s-00034r-Ox for guix-patches@gnu.org; Sun, 11 Dec 2022 22:02:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p4Z4s-0008HL-Ge; Sun, 11 Dec 2022 22:02:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p4Z4s-0006i4-60; Sun, 11 Dec 2022 22:02:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#59983] [PATCH] home: Let user configure XDG base directories. Resent-From: Antero Mejr Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, guix-patches@gnu.org Resent-Date: Mon, 12 Dec 2022 03:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 59983 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 59983@debbugs.gnu.org Cc: Antero Mejr , ludo@gnu.org X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: ludo@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.167081409025775 (code B ref -1); Mon, 12 Dec 2022 03:02:01 +0000 Received: (at submit) by debbugs.gnu.org; 12 Dec 2022 03:01:30 +0000 Received: from localhost ([127.0.0.1]:49803 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p4Z4M-0006hf-7Y for submit@debbugs.gnu.org; Sun, 11 Dec 2022 22:01:30 -0500 Received: from lists.gnu.org ([209.51.188.17]:56714) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p4Z4K-0006hZ-OD for submit@debbugs.gnu.org; Sun, 11 Dec 2022 22:01:29 -0500 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 1p4Z4F-0002pR-9L for guix-patches@gnu.org; Sun, 11 Dec 2022 22:01:28 -0500 Received: from mout-p-201.mailbox.org ([2001:67c:2050:0:465::201]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1p4Z4C-00081s-Cs for guix-patches@gnu.org; Sun, 11 Dec 2022 22:01:22 -0500 Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4NVmbq5yjgz9sNY for ; Mon, 12 Dec 2022 04:01:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1670814071; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=aZ2xl2oADxz9PHLPcELvKloVIqFDGCUI6gCV/ny3SFQ=; b=PGzXQV4rG5kOb7qDCDAbOPLejTmLux5O8CR7HeXu0OjAvbfI87oBq07wZVOa99NrJmzhzU mtepoB3DLkiS5V5PDipD4pS1QQGtB7JR0PNwsAT+DTDBbKvzkTOov/6w/d81a9QHcpbHge Nk/eDlMd/ctWFaBxGW/EMtJ7Pnq4bMkJEnOQezUKSu4NpL1xV1S/4Bsbh4a1KuMu8WbE/Y BDxpF9WRnPHuhN6qr/Lna0SeIg3hdkBj4OMzE9OGwlkeKb+fDq65G6Iw1O+CmlycUFI8wW w8xR3ZvLSJHTFmxwqLtpgVHHctL3JVSxA2UQorjrN6Phxd4qmHpRdvOnCjcklA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1670814067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=aZ2xl2oADxz9PHLPcELvKloVIqFDGCUI6gCV/ny3SFQ=; b=jqgwiPa/HdLGj0HO/KQn/mQT4+ParFda62rYOIU37PomZvsSYGN2UsQEH4FVfLjdf6FPzm FmFMzyM1vNtv1JvI8T3psBVNh20Rkfjb9ijILiCWmH4LcI3kA7uuSYAtntkJHbKZegYIHT XFv68BjcCFmSdp42VTV1N/ZqusU1zjI0lhjID3KEhKDxjJaaVl0+wv0dzmMpULDwYYjRfA HqlNcQC0Nsgx7BEc1tpwLyfL8m91io8pEhVWLOiFs991IegqtnDF/uFla9bOiDhAQGqAoE elQgqVpFybZ6/Ih1fkNq7W6VoRmkU4d2183bnQTWLkcczFlsLLATJq2oqXWdKQ== Date: Mon, 12 Dec 2022 03:00:49 +0000 Message-Id: <20221212030049.4725-1-antero@mailbox.org> MIME-Version: 1.0 X-MBO-RS-META: 5tsq4bqg6acy3o8zus67bdf8imbcq6zr X-MBO-RS-ID: de8c7fb73d939f0086c X-Rspamd-Queue-Id: 4NVmbq5yjgz9sNY Received-SPF: pass client-ip=2001:67c:2050:0:465::201; envelope-from=antero@mailbox.org; helo=mout-p-201.mailbox.org X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Reply-to: Antero Mejr X-ACL-Warn: , Antero Mejr via Guix-patches X-Patchwork-Original-From: Antero Mejr via Guix-patches via From: Antero Mejr 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/home.scm (home-environment)[base-xdg-configuration]: New field. * gnu/home/services/xdg.scm (ensure-xdg-base-dirs-on-activation): Make XDG_RUNTIME_DIR directory if the configuration changes it from the default. --- Allows making a runtime dir at ~/.local/runtime (or any other dir), so users don't have to set up elogind or other greeters/PAM modules. gnu/home.scm | 9 +++++++-- gnu/home/services/xdg.scm | 7 ++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/gnu/home.scm b/gnu/home.scm index c95d1e0818..f100b575e3 100644 --- a/gnu/home.scm +++ b/gnu/home.scm @@ -39,6 +39,7 @@ (define-module (gnu home) home-environment-essential-services home-environment-services home-environment-location + home-environment-base-xdg-configuration home-environment-with-provenance @@ -71,7 +72,10 @@ (define-record-type* home-environment (location home-environment-location ; (default (and=> (current-source-location) source-properties->location)) - (innate))) + (innate)) + + (base-xdg-configuration home-environment-base-xdg-configuration + (default (home-xdg-base-directories-configuration)))) (define (home-environment-default-essential-services he) "Return the list of essential services for home environment." @@ -83,7 +87,8 @@ (define (home-environment-default-essential-services he) (service home-symlink-manager-service-type) (service home-fontconfig-service-type) - (service home-xdg-base-directories-service-type) + (service home-xdg-base-directories-service-type + (home-environment-base-xdg-configuration he)) (service home-shell-profile-service-type) (service home-service-type) diff --git a/gnu/home/services/xdg.scm b/gnu/home/services/xdg.scm index 865f8b81d7..b62580461e 100644 --- a/gnu/home/services/xdg.scm +++ b/gnu/home/services/xdg.scm @@ -133,7 +133,12 @@ (define (ensure-xdg-base-dirs-on-activation config) (configuration-field-name field) 'upper)))) ;; XDG_RUNTIME_DIR shouldn't be created during activation ;; and will be provided by elogind or other service. - (and (not (string=? "XDG_RUNTIME_DIR" variable)) + ;; But if the user changes the value from the default, + ;; then we can make XDG_RUNTIME_DIR. + (and (or (not (string=? "XDG_RUNTIME_DIR" variable)) + (not (string=? ((configuration-field-getter field) + config) + "${XDG_RUNTIME_DIR:-/run/user/$UID}"))) variable))) home-xdg-base-directories-configuration-fields)))