diff --git a/doc/guix.texi b/doc/guix.texi index 6cf20aa09f..dc764cc292 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -6338,6 +6338,16 @@ The available options are: Use substitute information from @var{urls}. @xref{client-substitute-urls, the same option for @code{guix build}}. +@item --sort=@var{key} +Sort lines according to @var{key}, one of the following options: + +@table @code +@item closure +the total size of the item's closure (the default); +@item self +the size of each item. +@end table + @item --map-file=@var{file} Write a graphical map of disk usage in PNG format to @var{file}. diff --git a/guix/scripts/size.scm b/guix/scripts/size.scm index 52f7cdd972..1e54d3f218 100644 --- a/guix/scripts/size.scm +++ b/guix/scripts/size.scm @@ -77,8 +77,22 @@ (define (file-size item) (leave (G_ "no available substitute information for '~a'~%") item))))))) -(define* (display-profile profile #:optional (port (current-output-port))) - "Display PROFILE, a list of PROFILE objects, to PORT." +(define profile-closure name1 self1 total1) + ($ name2 self2 total2)) + (< total1 total2)))) + +(define profile-self name1 self1 total1) + ($ name2 self2 total2)) + (< self1 self2)))) + +(define* (display-profile profile #:optional (port (current-output-port)) + #:key (profile name1 self1 total1) - ($ name2 self2 total2)) - (> total1 total2))))) + (sort profile (negate profilepage-map profile map-file) (return #t)) - (display-profile* profile))) + (display-profile* profile (current-output-port) + #:profile