--- profiles.scm 2017-01-21 16:30:02.436621423 +0200 +++ bak/profiles.scm 2017-01-21 16:29:06.631019582 +0200 @@ -516,6 +516,34 @@ (anym %store-monad entry-lookup-package (manifest-entries manifest))) +(define (var-lib-package manifest) + (define build + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils) + (srfi srfi-1) (srfi srfi-26) + (ice-9 ftw)) + (define profile-var-lib (string-append #$output "/var/lib")) + (define (package-var-libs top) + (let ((varlibdir (string-append top "/var/lib"))) + (map (cut string-append varlibdir "/" <>) + (or (scandir varlibdir (lambda (file) + (not (member file '("." ".."))))) '())))) + (define (install-var dir) + (copy-recursively dir profile-var-lib) + ;; the file mode ends up being overwritten: + ;; (chmod dir #o777) + ;; guixbuilder* users can't do chown: + ;; (chown dir 1000 100) + ) + (mkdir-p profile-var-lib) + (exit (every install-var + (append-map package-var-libs + '#$(manifest-inputs manifest))))))) + (gexp->derivation "var-lib" build + #:local-build? #t + #:substitutable? #f)) + (define (info-dir-file manifest) "Return a derivation that builds the 'dir' file for all the entries of MANIFEST." @@ -909,6 +937,7 @@ ;; This is the list of derivation-returning procedures that are called by ;; default when making a non-empty profile. (list info-dir-file + var-lib-package fonts-dir-file ghc-package-cache-file ca-certificate-bundle