guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

18/87: home: environment-variables: Return support for file-likes and ge


From: guix-commits
Subject: 18/87: home: environment-variables: Return support for file-likes and gexps.
Date: Mon, 9 Jan 2023 18:27:29 -0500 (EST)

mbakke pushed a commit to branch staging
in repository guix.

commit 2acce55a00df9344d73101bb57a3961ba86105b0
Author: Andrew Tropin <andrew@trop.in>
AuthorDate: Mon Jan 9 11:46:57 2023 +0400

    home: environment-variables: Return support for file-likes and gexps.
    
    * gnu/home/services.scm (environment-variable-shell-definitions): Add 
support
    for file-likes and gexps.
    * tests/guix-home.sh: Add SHELL environment variable and test its value.  
Add
    BUILDHOSTTIME environment variable.
---
 gnu/home/services.scm | 6 ++++--
 tests/guix-home.sh    | 9 ++++++++-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/gnu/home/services.scm b/gnu/home/services.scm
index b003c3006b..c442da374c 100644
--- a/gnu/home/services.scm
+++ b/gnu/home/services.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2021 Andrew Tropin <andrew@trop.in>
+;;; Copyright © 2021-2023 Andrew Tropin <andrew@trop.in>
 ;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
 ;;; Copyright © 2022-2023 Ludovic Courtès <ludo@gnu.org>
 ;;;
@@ -212,7 +212,9 @@ ensures variable values are properly quoted."
                   "")
                  ((key . #t)
                   #~(string-append "export " #$key "\n"))
-                 ((key . (? string? value))
+                 ((key . (or (? string? value)
+                             (? file-like? value)
+                             (? gexp? value)))
                   #~(string-append "export " #$key "="
                                    (shell-double-quote #$value)
                                    "\n"))
diff --git a/tests/guix-home.sh b/tests/guix-home.sh
index 423ebf6f33..83ca6e72c8 100644
--- a/tests/guix-home.sh
+++ b/tests/guix-home.sh
@@ -1,5 +1,5 @@
 # GNU Guix --- Functional package management for GNU
-# Copyright © 2021 Andrew Tropin <andrew@trop.in>
+# Copyright © 2021-2023 Andrew Tropin <andrew@trop.in>
 # Copyright © 2021 Oleg Pykhalov <go.wigust@gmail.com>
 # Copyright © 2022 Ludovic Courtès <ludo@gnu.org>
 #
@@ -62,6 +62,7 @@ trap 'chmod -Rf +w "$test_directory"; rm -rf 
"$test_directory"' EXIT
              (gnu home)
              (gnu home services)
              (gnu home services shells)
+             (gnu packages bash)
              (gnu services))
 
 (home-environment
@@ -82,6 +83,9 @@ trap 'chmod -Rf +w "$test_directory"; rm -rf 
"$test_directory"' EXIT
    (simple-service 'add-environment-variable
                    home-environment-variables-service-type
                    `(("TODAY" . "26 messidor")
+                     ("SHELL" . ,(file-append bash "/bin/bash"))
+                     ("BUILDHOSTTIME" . ,#~(strftime "%c"
+                                            (localtime (current-time))))
                      ("LITERAL" . ,(literal-string "${abc}"))))
 
    (simple-service 'home-bash-service-extension-test
@@ -149,8 +153,11 @@ EOF
 # the content of bashrc-test-config.sh"
     grep -q "the content of ~/.config/test.conf" "${HOME}/.config/test.conf"
     grep '^export PS1="\$GUIX_ENVIRONMENT λ "$' "${HOME}/.bash_profile"
+
     ( . "${HOME}/.guix-home/setup-environment"; test "$TODAY" = "26 messidor" )
     ( . "${HOME}/.guix-home/setup-environment"; test "$LITERAL" = '${abc}' )
+    ( . "${HOME}/.guix-home/setup-environment";
+      echo "$SHELL" | grep "/gnu/store/.*/bin/bash" )
 
     # This one should still be here.
     grep "stay around" "$HOME/.config/random-file"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]