[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/15: home: Add 'home-generation-base'.
From: |
guix-commits |
Subject: |
02/15: home: Add 'home-generation-base'. |
Date: |
Fri, 22 Jul 2022 18:40:50 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 5df8f7802e8b45855e8f84830677001dc631e4f7
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sun Jul 17 17:10:06 2022 +0200
home: Add 'home-generation-base'.
* gnu/home.scm (%profile-generation-rx): New variable.
(home-generation-base): New procedure.
---
gnu/home.scm | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/gnu/home.scm b/gnu/home.scm
index a9f0a469a5..4ddbafe412 100644
--- a/gnu/home.scm
+++ b/gnu/home.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2021 Andrew Tropin <andrew@trop.in>
+;;; Copyright © 2022 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -27,7 +28,8 @@
#:use-module (guix diagnostics)
#:use-module (guix gexp)
#:use-module (guix store)
-
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 regex)
#:export (home-environment
home-environment?
this-home-environment
@@ -38,7 +40,9 @@
home-environment-services
home-environment-location
- home-environment-with-provenance))
+ home-environment-with-provenance
+
+ home-generation-base))
;;; Comment:
;;;
@@ -114,3 +118,21 @@ of HOME-PROVENANCE-SERVICE-TYPE to its services."
(run-with-store store (home-environment-derivation he)
#:system system
#:target target)))))
+
+(define %profile-generation-rx
+ ;; Regexp that matches profile generation.
+ (make-regexp "(.*)-([0-9]+)-link$"))
+
+(define (home-generation-base file)
+ "If FILE is a Home generation GC root such as \"guix-home-42-link\",
+return its corresponding base---e.g., \"guix-home\". Otherwise return #f.
+
+This is similar to the 'generation-profile' procedure but applied to Home
+generations."
+ (match (regexp-exec %profile-generation-rx file)
+ (#f #f)
+ (m (let ((profile (match:substring m 1)))
+ ;; Distinguish from a "real" profile and from a system generation.
+ (and (file-exists? (string-append profile "/on-first-login"))
+ (file-exists? (string-append profile "/profile/manifest"))
+ profile)))))
- branch master updated (c9a37f57cb -> 32a0036343), guix-commits, 2022/07/22
- 03/15: guix gc: '--delete-generations' now deletes old Home generations., guix-commits, 2022/07/22
- 02/15: home: Add 'home-generation-base'.,
guix-commits <=
- 04/15: gnu: eigen: Update to 3.4.0., guix-commits, 2022/07/22
- 05/15: gnu: clojure-tools-cli: Update to 1.0.206., guix-commits, 2022/07/22
- 07/15: gnu: clojure-tools-deps-alpha: Update to 0.14.1212., guix-commits, 2022/07/22
- 06/15: gnu: clojure-tools-gitlibs: Update to 2.4.181., guix-commits, 2022/07/22
- 08/15: gnu: clojure-tools: Update to 1.11.1.1149., guix-commits, 2022/07/22
- 10/15: gnu: clojure-algo-generic: Fix test failing under AOT in Clojure 1.11.1., guix-commits, 2022/07/22
- 11/15: gnu: clojure-core-match: Update to 1.0.0., guix-commits, 2022/07/22
- 13/15: doc: Clarify "Replicating Guix" section., guix-commits, 2022/07/22
- 09/15: gnu: clojure: Update to 1.11.1., guix-commits, 2022/07/22
- 12/15: gnu: clojure-instaparse: Update to 1.4.12., guix-commits, 2022/07/22