David Thompson <dthomps...@worcester.edu> skribis: > Lately I've been wanting to version control the list of packages that I > install in my user profile so that I can sync it amongst many machines. > So, I took a stab at adding a new '--apply' option to 'guix package' > that reads in a package list from a Scheme file and creates a new > generation of the profile with only those packages are installed. > Here's an example configuration: > > (use-modules (gnu)) > (use-package-modules base less guile emacs admin ruby mail pumpio man) > > (list ruby > coreutils > less > man-db > notmuch > guile-2.0 > emacs > dmd > offlineimap > pumpa)
Yes, that sounds very useful. As usual though, there’s the issue of multiple-output packages. The above snippet is nice, but doesn’t allow you to specify a particular output of a package. What about instead requiring people to return a manifest: (use-modules (guix profiles)) (use-package-modules base emacs guile) (manifest (cons (package->manifest-entry gcc-toolchain "debug") (map package->entry (list gcc-toolchain emacs guile-2.0)))) That means we’ll have to document (guix profiles). It’s more verbose than what you suggest, though. If you insist ;-), we could allow a list of packages instead of a manifest, though I’d prefer not to do that. WDYT? > Below is a naive patch that does the job, but is unideal because it > doesn't do some nice things like display the diff between generations > before building. For that you would need a procedure to infer the manifest transaction: (manifests->transaction m1 m2) ;; returns a <manifest-transaction> and then that could be passed to ‘show-manifest-transaction’. However, I’m not sure it’s very useful. Perhaps it would be enough to write “installing new manifest from foo.scm with 42 entries.” WDYT? > I'm looking for some guidance to make this option mesh better with the > rest of the 'guix package' utility. Any help is appreciated. Overall it looks OK to me! [...] > + (option '("apply") #t #f > + (lambda (opt name arg result arg-handler) > + (values (alist-cons 'apply (load arg) result) > + arg-handler))) It would be better to delay loading until after arguments have been parsed, as in ‘guix system’. The procedure to load the file should be similar to ‘read-operating-system’. We’ll need documentation and tests, too. :-) Thank you! Ludo’.