NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.28k stars 13.53k forks source link

vhs: fails to run chromium when running readme demo #208002

Closed collinarnett closed 1 year ago

collinarnett commented 1 year ago

Describe the bug

A clear and concise description of what the bug is.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Run vhs new demo.tape
  2. Run vhs demo.tape

Expected behavior

demo.gif created with expected behavior from demo.tape

Screenshots

$ vhs demo.tape                                        
File: demo.tape
[launcher.Browser]2022/12/27 14:12:42 try to find the fastest host to download the browser binary
[launcher.Browser]2022/12/27 14:12:42 check https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1033860/chrome-linux.zip
[launcher.Browser]2022/12/27 14:12:42 check https://registry.npmmirror.com/-/binary/chromium-browser-snapshots/Linux_x64/1033860/chrome-linux.zip
[launcher.Browser]2022/12/27 14:12:42 check https://playwright.azureedge.net/builds/chromium/1033860/chromium-linux-arm64.zip
[launcher.Browser]2022/12/27 14:12:42 check result: Get "https://playwright.azureedge.net/builds/chromium/1033860/chromium-linux-arm64.zip": context canceled
[launcher.Browser]2022/12/27 14:12:42 check result: Get "https://registry.npmmirror.com/-/binary/chromium-browser-snapshots/Linux_x64/1033860/chrome-linux.zip": context canceled
[launcher.Browser]2022/12/27 14:12:42 Download: https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1033860/chrome-linux.zip
[launcher.Browser]2022/12/27 14:12:42 Progress:
[launcher.Browser]2022/12/27 14:12:42 00%
[launcher.Browser]2022/12/27 14:12:43 67%
[launcher.Browser]2022/12/27 14:12:44 100%
[launcher.Browser]2022/12/27 14:12:44 Unzip to: /home/collin/.cache/rod/browser/chromium-1033860
[launcher.Browser]2022/12/27 14:12:44 Progress:
[launcher.Browser]2022/12/27 14:12:44 00%
[launcher.Browser]2022/12/27 14:12:45 32%
[launcher.Browser]2022/12/27 14:12:46 67%
[launcher.Browser]2022/12/27 14:12:46 100%
panic: fork/exec /home/collin/.cache/rod/browser/chromium-1033860/chrome-linux/chrome: no such file or directory

goroutine 1 [running]:
github.com/go-rod/rod/lib/utils.glob..func2({0xd866e0?, 0xc0001480c0?})
    github.com/go-rod/rod@v0.112.0/lib/utils/utils.go:60 +0x25
github.com/go-rod/rod/lib/utils.E(...)
    github.com/go-rod/rod@v0.112.0/lib/utils/utils.go:66
github.com/go-rod/rod/lib/launcher.(*Launcher).MustLaunch(0xc00033a000?)
    github.com/go-rod/rod@v0.112.0/lib/launcher/launcher.go:351 +0x67
main.New()
    github.com/charmbracelet/vhs/vhs.go:67 +0x27b
main.Evaluate({0xc0005d2000, 0x864}, {0x145b3a0, 0xc000014018}, {0x0, 0x0, 0x0?})
    github.com/charmbracelet/vhs/evaluator.go:33 +0x1c5
main.glob..func1(0x1a1bee0?, {0xc00047e670, 0x1, 0x1?})
    github.com/charmbracelet/vhs/main.go:60 +0x16d
github.com/spf13/cobra.(*Command).execute(0x1a1bee0, {0xc000024050, 0x1, 0x1})
    github.com/spf13/cobra@v1.6.0/command.go:916 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0x1a1bee0)
    github.com/spf13/cobra@v1.6.0/command.go:1040 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
    github.com/spf13/cobra@v1.6.0/command.go:968
main.main()
    github.com/charmbracelet/vhs/main.go:135 +0x25

Additional context

This might be due to vhs being outdated in nixpkgs. #206908

Notify maintainers

@maaslalani

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m" - system: `"x86_64-linux"`
 - host os: `Linux 5.15.74, NixOS, 23.05 (Stoat), 23.05.20221217.b48e532`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.12.0`
 - channels(collin): `""`
 - channels(root): `"nixos-21.11.335130.386234e2a61"`
 - nixpkgs: `/nix/store/msv8qjxnga8h81biz33gpa4pyw9kg0j1-source`
Infinidoge commented 1 year ago

Nixpkgs has since been updated to the latest version (v0.2.0), and the error still occurs on the latest Nixpkgs commit (https://github.com/NixOS/nixpkgs/commit/fe0fbe3d7ba0dcc9a884a97e80a98c0f19dfec7f)

collinarnett commented 1 year ago

@maaslalani Any suggestions on a fix?

maaslalani commented 1 year ago

I believe the fix might be to include chromium as a dependency and ensure that go-rod looks for the chromium binary in the same place nix installs it (i.e. it is located in the PATH as chromium):

https://github.com/go-rod/rod/blob/cc9664ff1b3f265e2e51a8b1fbb7ec324ded3a35/lib/launcher/browser.go#L310-L340

duckpuppy commented 1 year ago

@NickCao @slinlee

The PR for this breaks vhs on darwin, since chromium isn't supported on that platform

slinlee commented 1 year ago

@duckpuppy Thanks for filing a new issue #220367