Subject: Re: [videolang/video] #lang video on Guix OS (Issue #67)

From: "Philip McGrath" <[email-masked]>
Date: Wed, 13 Jul 2022 17:33:25 -0400

Hi,

On Wed, Jul 13, 2022, at 7:55 AM, Bost wrote:
> 
> 
> Hi Leif,
> 
> FYI I just created a patch [1] enabling #lang video on the Guix OS. I guess you might want to extend the list [2] of supported operating systems when the patch gets merged ;-)
> 
> Cheers
> 
> Bost
> 
> 
> [1] https://issues.guix.gnu.org/56534
> [2] https://docs.racket-lang.org/video@video/Installing.html
> 

It's great to see more Racketeers interested in Guix!

I'm cross-posting this to both <https://issues.guix.gnu.org/56534> and <https://github.com/videolang/video/issues/67>.

I've been working for some time toward making a Guix build system and importer for Racket packages: I'm optimistic that I may get something working between the Racket 8.6 and 8.7 releases.

For now, I would suggest not adding `portaudio` and `ffmpeg` as inputs to the main `racket` package. Instead, if you want to get something working for now, I would suggest adding a new package `racket-with-video` that extends the `racket` package in the same way that `racket` extends `racket-minimal`. I'd expect it would go somewhat like this

```scheme
(define-public racket-with-video
  (let* ((commit "3c69669063c56ff8d269768589cb9506a33315e5")
         (revision "1")
         (video-version (git-version "0.2.3" revision commit)))
    (package
      (inherit racket)
      (version (string-append %racket-version "+video" video-version))
      (source #f)
      (native-inputs '())
      (inputs
       (list
        racket
        (racket-vm-for-system)
        ffmpeg
        portaudio
        (racket-packages-origin
         "video" (origin
                   (method git-fetch)
                   (uri (git-reference
                         (url "https://github.com/videolang/video")
                         (commit commit)))
                   (sha256
                    (base32 "17lysqgd4h0kdx73vzmsdqc6ip5rlk56hss3880yapvic14lf5dy"))
                   (file-name (git-file-name "racket-video" video-version)))
         '("video"))
        #|
        ... likewise for other packages not in main-distribution,
        particularly libvid ...
        |#))
      (arguments
       (substitute-keyword-arguments (package-arguments racket)
         ((#:make-flags _ '())
          #~`("video"))
         ((#:configure-flags _ '())
          #~`("--tethered"
              "--extra-foreign-lib-search-dirs"
              ,(format #f "~s"
                       '(#$@(map (lambda (name)
                                   (cond
                                    ((this-package-input name)
                                     => (cut file-append <> "/lib"))
                                    (else
                                     (raise
                                      (formatted-message
                                       (G_ "missing input '~a' to the 'racket-with-video' package")
                                       name)))))
                                 '("portaudio"
                                   "ffmpeg"))))))))
      (home-page "https://lang.video")
      (synopsis "Racket with @code{#lang video}")
      (description
       "Video is a language for making movies.  It combines the power
of a traditional video editor with the capabilities of a full
programming language.  Video integrates with the Racket ecosystem and
extensions for DrRacket to transform it into a non-linear video
editor.")
      (license license:asl2.0))))
```

Those helper functions are not exported from (gnu packages racket) because they're hack-ish and should be replaced with proper build system support, but hopefully you can see from the docstrings how they work for now.

I ran into <https://github.com/racket/racket/issues/4357> while working on this example: we'd need to backport a fix for that, or it might make it into 8.6. Incidentally, you might be interested in my branch at <https://gitlab.com/philip1/guix-patches/-/tree/zuo> getting ready for the Racket release: I'll be updating it to the new 8.5.900 release candidate soon.

@LeifAndersen, I used 3c69669063c56ff8d269768589cb9506a33315e5 because I expect Guix would run into that issue during our build process, but we could use the stable branch or cherry-pick it if you think that would be better.

Hopefully by the next time a situation like <https://guix.gnu.org/en/blog/2021/reproducible-data-processing-pipelines/> comes up, Guix folks will be able to get `#lang video`'s "sweet high-level functional interface" together with reproducibility of their makefile!

-Philip