(use-modules (gnu packages) (guix build-system gnu) (guix build-system cmake) (guix packages) (guix sets) (ice-9 match) (ice-9 vlist) (srfi srfi-1)) (define all (all-packages)) (define (p->k p) (string-append (package-name p) "@" (package-version p))) (define vall-packages (fold (lambda (package result) (vhash-cons (p->k package) package result)) vlist-null all)) (define vleaf-packages (vhash-fold (lambda (key package result) (let loop ((dependencies (package-direct-inputs package)) (updated result)) (match dependencies ('() updated) ((or ((_ p) . tail) ((_ p _) . tail)) (if (package? p) (loop tail (vhash-delete (p->k p) updated)) (loop tail updated)))))) vall-packages vall-packages)) (define leaf-packages (vhash-fold (lambda (key package result) (cons package result)) '() vleaf-packages)) (define subset (filter-map (lambda (package) (and (memq (package-build-system package) (list gnu-build-system cmake-build-system)) (package-with-upstream-version (pk 'up package)))) leaf-packages)) (packages->manifest subset)