nix-community / nix4vscode

Apache License 2.0
45 stars 3 forks source link

Allow nixpkgs version in config.toml #22

Closed leon-erd closed 5 months ago

leon-erd commented 5 months ago

Would be nice if nix4vscode would accept a version as it is given by nixpkgs i.e. 1.86.2.24057 for vscodium right now in the config.toml. Currently it thows:

thread 'main' panicked at src/main.rs:130:72:
called `Result::unwrap()` on an `Err` value: Error("unexpected character '.' after patch version number")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

It should be fine to just discard the last part I guess.

I think to put this repo to optimal usage it is crucial to automate the generation of the config.toml and hence the config.nix with the vscode version that you currently pull from nixpkgs. I'm thinking about writing a small script that gets executed before home-manager rebuilds that works as follows:

  1. read vscode version from rev of nixpkgs defined in flake.lock
  2. check if version is different to version in config.toml
  3. if so update version in config.toml with new version and run nix4vscode on new config.toml
  4. build home-manager generation with possibly updated version of vscode together with the updated extensions

If you have any better suggestions for the automation that do not involve any external setup outside your dotfiles I'm happy to hear :)

cathaysia commented 5 months ago

Although I don't think it makes sense, considering how simple it is to implement this, I will support it


From: Leon @.> Sent: Monday, March 4, 2024 10:51:43 PM To: nix-community/nix4vscode @.> Cc: Subscribed @.***> Subject: [nix-community/nix4vscode] Allow nixpkgs version in config.toml (Issue #22)

Would be nice if nix4vscode would accept a version as it is given by nixpkgs i.e. 1.86.2.24057 for vscodium right now in the config.toml. Currently it thows:

thread 'main' panicked at src/main.rs:130:72: called Result::unwrap() on an Err value: Error("unexpected character '.' after patch version number") note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

It should be fine to just discard the last part I guess.

I think to put this repo to optimal usage it is crucial to automate the generation of the config.toml and hence the config.nix with the vscode version that you currently pull from nixpkgs. I'm thinking about writing a small script that gets executed before home-manager rebuilds that works as follows:

  1. read vscode version from rev of nixpkgs defined in flake.lock
  2. check if version is different to version in config.toml
  3. if so update version in config.toml with new version and run nix4vscode on new config.toml
  4. build home-manager generation with possibly updated version of vscode together with the updated extensions

― Reply to this email directly, view it on GitHubhttps://github.com/nix-community/nix4vscode/issues/22, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKBJ6ANHBWG4QERG3WJMBGLYWSC77AVCNFSM6AAAAABEFLA7YOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE3DOMBTGQ2DGMI. You are receiving this because you are subscribed to this thread.Message ID: @.***>

cathaysia commented 5 months ago

Generally speaking, a tool only do one thing. The scenario you raise is very common and reasonable. But I still don't think it should be integrated into this software. But to make up for it, we can provide a script and put it in this repository to achieve what you said. Then we can update the version via cicd automatically. If you are already doing this job, you are welcome to submit a PR

leon-erd commented 5 months ago

I wanted to wait until the new branch gets merged :)