aboutsummaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
Diffstat (limited to 'guix')
-rw-r--r--guix/scripts/gc.scm6
1 files changed, 5 insertions, 1 deletions
diff --git a/guix/scripts/gc.scm b/guix/scripts/gc.scm
index 00f1eb8d00..9a57e5fd1e 100644
--- a/guix/scripts/gc.scm
+++ b/guix/scripts/gc.scm
@@ -245,7 +245,11 @@ is deprecated; use '-D'~%"))
(define (delete-generations store pattern)
;; Delete the generations matching PATTERN of all the user's profiles.
(let ((profiles (delete-duplicates
- (filter-map generation-profile (gc-roots)))))
+ (filter-map (lambda (root)
+ (and (or (zero? (getuid))
+ (user-owned? root))
+ (generation-profile root)))
+ (gc-roots)))))
(for-each (lambda (profile)
(delete-old-generations store profile pattern))
profiles)))