~ruther/guix-config

a0d1f17f14d0295c73e7014eec8d16cf90b04e6e — Rutherther a day ago 3094c89
feat: WIP gc rooting non-grafted inputs
1 files changed, 52 insertions(+), 2 deletions(-)

M config.scm
M config.scm => config.scm +52 -2
@@ 304,7 304,10 @@
  (derivation non-grafted-derivation))

(define-gexp-compiler (non-grafted-compiler (non-grafted <non-grafted>) system target)
  (without-grafting (non-grafted-derivation non-grafted)))
  (mlet* %store-monad ((drv (non-grafted-derivation non-grafted)))
    (without-grafting
     (gexp->derivation "non-grafted"
                       #~(symlink #$drv #$output)))))

(define-record-type* <drv-name>
  drv-name-record drv-name


@@ 323,6 326,43 @@
(define-gexp-compiler (os-compiler (os <operating-system>) system target)
  (operating-system-derivation os))

;; I don't know why the inputs aren't getting grafted here, but they aren't, that's good here.
(define (make-non-grafted-package pkgs)
  (package
    (name "non-grafted-pkg")
    (version "0")
    (synopsis #f)
    (source #f)
    (description #f)
    (home-page #f)
    (license #f)
    (build-system (@ (guix build-system trivial) trivial-build-system))
    ;; (inputs pkgs)
    (arguments
     (list
      #:builder #~(begin
                    (use-modules
                     (srfi srfi-19))

                    (mkdir #$output)

                    (for-each (lambda (pkg)
                                (symlink
                                 pkg
                                 (string-append #$output "/" (basename pkg))))
                              '#$pkgs)

                    (symlink #$guile-3.0:debug (string-append #$output "/" "guile-debug"))
                    (symlink #$(libc-utf8-locales-for-target):static (string-append #$output "/" "guile-debug"))

                    ;; (for-each (lambda (pkg)
                    ;;             (unless (file-exists? (string-append #$output "/" (basename pkg)))
                    ;;               (symlink
                    ;;                pkg
                    ;;                (string-append #$output "/" (basename pkg)))))
                    ;;           (map cdr %build-inputs))
                    )))))

;; Takes an operating system and gc roots its derivation
(define (operating-system-with-build-inputs os)
  (operating-system


@@ 334,7 374,17 @@
                      gc-root-service-type
                      (list
                       (drv-name (operating-system-derivation os) #t)
                       (non-grafted (operating-system-derivation os))))
                       (drv-name (operating-system-derivation os) #f)
                       (non-grafted (operating-system-derivation os))
                       (libc-utf8-locales-for-target)
                       guile-3.0
                       (make-non-grafted-package
                        (list
                         guile-3.0
                         ;; `(,guile-3.0 "debug")
                         (libc-utf8-locales-for-target)
                         texinfo))))
      (operating-system-user-services os)))))

(operating-system-with-build-inputs %ruther/base-laptop-os)
%ruther/base-laptop-os

Do not follow this link