Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing model at runtime with NIXOS specific read-only configuration file #24537

Open
antaz opened this issue Feb 9, 2025 · 8 comments
Open
Labels
nix Nix configuration support

Comments

@antaz
Copy link
Contributor

antaz commented Feb 9, 2025

Summary

Changing the language model in a read-only configuration file system like nixos is not possible

Steps to trigger the problem:

  1. Configure Zed using nix
  2. Change the language model in the assistant panel

Actual Behavior:
Language model doesn't change

Expected Behavior:
Language model changes

I assume this happens because Zed rewrites the configuration file when the model changes.

Zed Version and System Specs

Zed: v0.172.10 (Zed)
OS: Linux Wayland nixos 25.05
Memory: 7.7 GiB
Architecture: x86_64
GPU: Intel(R) HD Graphics 5500 (BDW GT2) || Intel open-source Mesa driver || Mesa 24.3.4

@probably-neb
Copy link
Contributor

Yeah that's unfortunate for sure.

The only workaround I can come up with is to set the default model provider in your settings the "nix" way.

I'm not super familiar with the write-only filesystem on nixos, is there any way to specify per application or otherwise that Zed should be able to change these files?

Also is this only specific to configuration files? Could you for instance change the directory Zed uses for configuration so that it doesn't encounter this issue?

We use & modify multiple files on the file system for downloading extensions, channel data, settings, keymaps, etc. This may prevent people from using Zed all together if there isn't a decent workaround.

@probably-neb probably-neb changed the title Changing model at runtime with read-only configuration file Changing model at runtime with NIXOS specific read-only configuration file Feb 11, 2025
@jansol
Copy link
Contributor

jansol commented Feb 13, 2025

I'm not super familiar with the write-only filesystem on nixos, is there any way to specify per application or otherwise that Zed should be able to change these files?

You can simply not generate the config file with Nix, but the whole point of doing it with Nix in the first place is to make the application in question not alter it so you can keep your configs in a consistent state across systems and application launches.

@jansol
Copy link
Contributor

jansol commented Feb 13, 2025

We use & modify multiple files on the file system for downloading extensions, channel data, settings, keymaps, etc. This may prevent people from using Zed all together if there isn't a decent workaround.

~/.local in general is usually still writable, so extensions, state, caches etc all typically work the same as everywhere else. The problem is AFAIK solely limited to managing the Zed config file with Nix.

@mstarodub
Copy link

Yeah, this should really not change the settings file.

Currently running into this too - I can't use any models on macOS with zed installed via home-manager.

Writing the recently used model state into ~/.local/state or similar would be a lot better!

@probably-neb
Copy link
Contributor

Writing the recently used model state into ~/.local/state or similar would be a lot better!

Hmm, interesting solution. Not sure it complicates things to much, as we modify the settings file for user convenience and for caching (they can see what model they have selected in their settings file, and it's always what they selected last). I'm not sure how I feel about splitting some things into a different place the user then has to go find by default, but maybe there's a happy medium here :)

@mstarodub
Copy link

I think it would be good not to assume that the settings file can always be modified in general. Nix users prefer having declarative configuration, rather than accumulating state through ui actions.

Perhaps if a the ui action cannot be completed due to a read-only settings file, zed should fall back to writing to another place?

@jansol
Copy link
Contributor

jansol commented Feb 25, 2025

I'm not sure how I feel about splitting some things into a different place the user then has to go find by default

We are talking about two orthogonal things though, "settings" and "state". Settings can specify the default model, but the active state does not have to be that (and would make sense if it could be different for each assistant session/conversation).

@iwinux
Copy link

iwinux commented Mar 5, 2025

Even if the file is not readonly (in my case), updating the default settings every time I switch model in editor is unexpected. The option is called default_model after all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nix Nix configuration support
Projects
None yet
Development

No branches or pull requests

6 participants