utils: %nix-wrapper-shell-default-unset-env-vars: Make it an identifier macro and export.

Fixes: #61.
This commit is contained in:
Hilton Chain committed 2026-10-30 14:00:44 +08:00
1 parent e0db50c276
commit bfe0d7379d
1 file changed
+11 -7
+11 -7
View File
@@ -15,10 +15,13 @@
#:use-module (guix build-system trivial) #:use-module (guix build-system trivial)
;; Guix packages ;; Guix packages
#:autoload (gnu packages package-management) (nix) #:autoload (gnu packages package-management) (nix)
#:export (%nix-wrapper-default-exclude-env-paths #:export (;; Paramaters.
%nix-wrapper-default-exclude-env-paths
%nix-wrapper-profile-nixpkgs-commit %nix-wrapper-profile-nixpkgs-commit
%nix-wrapper-profile-extra-outputs %nix-wrapper-profile-extra-outputs
%nix-wrapper-shell-default-unset-env-vars
nix-shell-wrapper nix-shell-wrapper
nix-wrapper->package nix-shell-wrapper->package nix-wrapper->package nix-shell-wrapper->package
with-nix-profile)) with-nix-profile))
@@ -69,14 +72,15 @@
(_ (list #f))) (_ (list #f)))
(%nix-wrapper-default-exclude-env-paths)))) (%nix-wrapper-default-exclude-env-paths))))
(define (%nix-wrapper-shell-default-unset-env-vars) ;; Environment variables to unset in the `nix shell' environment, used by
"Environment variables to unset in the `nix shell' environment, used by ;; `nix-shell-wrapper' by default.
`nix-shell-wrapper' by default." (define-syntax %nix-wrapper-shell-default-unset-env-vars
(identifier-syntax
(filter-map (match-lambda (filter-map (match-lambda
((? string? env) env) ((? string? env) env)
(((? string? env) . _) env) (((? string? env) . _) env)
(_ #f)) (_ #f))
(%nix-wrapper-default-exclude-env-paths))) (%nix-wrapper-default-exclude-env-paths))))
;;; ;;;
@@ -275,7 +279,7 @@ in
(run-command '()) (run-command '())
(options '()) (options '())
(environment-keep #t) (environment-keep #t)
(environment-unset (%nix-wrapper-shell-default-unset-env-vars)) (environment-unset %nix-wrapper-shell-default-unset-env-vars)
(environment-set '()) (environment-set '())
(nix (file-append nix "/bin/nix"))) (nix (file-append nix "/bin/nix")))
"Return a nix-wrapper that wraps the `nix shell' command-line utility and "Return a nix-wrapper that wraps the `nix shell' command-line utility and
@@ -298,7 +302,7 @@ When ENVIRONMENT-KEEP (default: #t, boolean / list of strings) is set to a value
other than #t, the environment will be cleared, keeping only specified other than #t, the environment will be cleared, keeping only specified
environment variables. environment variables.
ENVIRONMENT-UNSET (default: (%nix-wrapper-shell-default-unset-env-vars), list of ENVIRONMENT-UNSET (default: %nix-wrapper-shell-default-unset-env-vars, list of
strings) unsets specified environment variables from the environment. It's only strings) unsets specified environment variables from the environment. It's only
usable when ENVIRONMENT-KEEP is #t. usable when ENVIRONMENT-KEEP is #t.