How can make a buffer from a script?

I'm trying to make a buffer with make-buffer

nyxt --remote --quit --eval '(make-window (make-buffer :url ""))'

The first time after a restart of Nyxt, I get this

<INFO> [12:40:09] Probing remote instance listening to /run/user/1000/nyxt/nyxt.socket.

, but nothing happens to Nyxt

The second or third time, this happens.

debugger invoked on a IOLIB/SOCKETS:SOCKET-NOT-CONNECTED-ERROR in thread
#<THREAD tid=2138444 "main thread" RUNNING {10051E8003}>:
  #<SOCKET-NOT-CONNECTED-ERROR 107 :ENOTCONN "Transport endpoint is not connected", FD: 8>

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit from the current thread.


Am I running this correctly?

My config file

(define-configuration browser
  ;; Enable --remote --eval code evaluation.
  ((remote-execution-p t)
    (list "emacsclient" "-cn" "-a" "" "-F"
          "((font . \"IBM Plex Mono-17\") (vertical-scroll-bars) (tool-bar-lines) (menu-bar-lines))"))))

@daltor you’re not passing a valid URL.

I think you want to say nyxt --remote --quit --eval '(make-window (make-buffer :url ""))'

;), no, that was just the forum code here, that was translating that. I’ve updating the question. I’m on NixOS 23.05 with Nyxt-3.5

@daltor I can’t reproduce the issue on NixOS or Guix.

Given that remote-execution-p is set to t, issuing:

$ nyxt &
$ nyxt --remote --quit --eval '(make-window (make-buffer :url ""))'

opens a second window, as expected.

I see the following log:

<INFO> [15:50:48] Probing remote instance listening to /run/user/1000/nyxt/nyxt.socket.
<INFO> [15:50:48] External evaluation request: "(make-window (make-buffer :url \"\"))"

I see this in the terminal

<WARN> [09:53:31] Warning: Error on separate thread: (UNSIGNED-BYTE 8) is not a valid :ELEMENT-TYPE for MAKE-STRING

This is my entire config

(define-configuration browser
     (remote-execution-p t)

@daltor maybe your Nix system is using CL dependencies that are out of date.

Try to run nix-channel --update and then nix-env -u nyxt.

That last command just prompt, but still the same.

The error seems to be coming from your system, since I can’t reproduce it.

Which nix channel are you using? What’s the content of your ~/.nix-channels?

It contains

$ cat ~/.nix-channels home-manager nixos

It did at first only contain that home-manager line, but I just added the second line.

I use this package in configuration.nix


Add the unstable channel, i.e. the one that contains the most up-to-date packages - nixpkgs

I have defined unstable in configuration.nix, like this

  unstable = import (fetchTarball {config.allowUnfree = true;};

I still need to add it with nix-channels?

I’m not sure since I don’t use NixOS. I only have the package manager installed on top of my system. Maybe issuing nix-channel --list answers that question.

I suggest contacting someone who uses NixOS to check whether the issue you mention in the top post is reproducible.

ok, I vented this in NixOS forum, but lackluster response;)

What distribution do you use, cause I want to test this in a VM?

You don’t need a VM to test it. You can install the Guix package manager on top of your NixOS system.

Download, set as executable and run this script. Then, run guix pull (may take a while) and guix install nyxt.

As a side note, the official distribution channels (i.e. curated by the Nyxt team) are Guix and the Flatpak. All other forms of distribution are maintained by users and enthusiasts.

I would need to remove my own nyxt from configuration.nix, then?

Not necessarily. You can have both packages installed via Guix and Nix. But notice that nyxt will be resolved according to the order of directories in $PATH.

To avoid confusion, you could uninstall Nyxt from Nix. If you’ll have Guix available, that will be the most reliable way to use Nyxt.

I see that Guix has some support, but it seems Flatpak is more supported.

They tried to add Guix here:

However, is there some repo I can add to Flatpak?

If I download the file and run it with Flatpak, it gives me this.

error: The application engineer.atlas.Nyxt/x86_64/master requires the runtime org.gnome.Sdk/x86_64/44 which was not found

You don’t need to install Guix through Nix. The method that I’ve shared with you, via the script, should be more effective.

Currently, it’s only possible to install Nyxt via the Flatpak file. Soon it will be added to Flathub.

Does the following work?

$ flatpak --user remote-add --if-not-exists flathub
$ flatpak --user install --noninteractive org.gnome.Sdk/x86_64/44
$ flatpak --user install /path/to/flatpak-file

Yes, that installed it

$ .local/share/flatpak/exports/bin/engineer.atlas.Nyxt

, but now I get this;)

<WARN> [12:22:35] Could not extract URLs from "(make-window (make-buffer :url \"\"))".

I can’t reproduce again. Works as expected.

$ flatpak run engineer.atlas.Nyxt &
$ flatpak run engineer.atlas.Nyxt --remote --quit --eval '(make-window (make-buffer :url ""))'

Look closely at which config is being read, e.g.

<INFO> [13:31:06] Loading Lisp file #P"/home/aadcg/.config/nyxt/config.lisp".

Confirm the contents:

(define-configuration browser
  ((remote-execution-p t)))

The error you see seems to derive from the fact that you’re not enabling remote execution. I can reproduce it when not enabling it:

<WARN> [13:36:27] Could not extract URLs from "(make-window (make-buffer :url \"\"))".