On 6/23/26 20:43, Hugo Buddelmeijer wrote:
Hi all,
On 5/10/26 21:51, Hugo Buddelmeijer wrote:
What would be the easiest way to prevent any package from a specific
commit (or generation) to be garbage collected?
Maybe I can make a manifest with "all packages" and then filter out
those that are not already in the store. So the manifest will always
build, since it would contain only already built packages. Not really
what a manifest normally should do, but I guess it could work.
A manifest with all packages seems rather simple, but I can't figure out
how to only keep the packages that are already in the store.
Getting closer! At least got un-stuck. Sharing this here in case
someone is eagerly trying to help me, and don't want to make them to
work for nothing.
This kinda works somewhat:
```
(use-modules (gnu)
(guix)
(guix store))
(define store (open-connection))
(define (output-path-from-package package)
(derivation->output-path
((bag->derivation
(package->bag package)
package) store)))
(define packages-in-store
(fold-packages
(lambda (package lst)
(if (and
;; #t ;switch commenting out with next line for full list
(string-prefix? "python-ab" (package-name package))
(file-exists? (output-path-from-package package)))
(cons package lst)
lst))
'()))
(display (length packages-in-store))
(newline)
```
However, it is super slow (probably because the above bypasses all the
memoization), and while it doesn't always build packages anymore, it
still does occasionally.
Nevertheless, I think I can figure it out from here.
Thanks,
Hugo