nix-community / nix-vscode-extensions

Nix expressions for VSCode and OpenVSX extensions [maintainers: @deemp, @AmeerTaweel]
MIT License
206 stars 11 forks source link

vscode version compatablity fix #48

Open lizelive opened 11 months ago

lizelive commented 11 months ago
  1. include a version of package compatible with the version in nixos-unstable, nixos-stable, latest at very least make sure to have version that works with nix-vscode-extensions.inputs.nixpkgs
  2. expose an up to date vscode / codium
  3. tag daily commit with newest version of vscode / highest min engine version.
let
  pkgs = import <nixpkgs> {};
  inherit (pkgs) lib writeTextFile;
  inherit (lib) catAttrs pipe importJSON;
  inherit (lib.lists) unique naturalSort last;

  file = ./vscode-marketplace-latest.json;

  text = pipe file [
    importJSON
    (catAttrs "engineVersion")
    unique
    (map (lib.strings.removePrefix "^"))
    unique
    naturalSort
    last
  ];
  output = writeTextFile { name = "engineVersion.txt"; text = text; };
in
output

gets the highest engineVersion

deemp commented 11 months ago

Please, check https://github.com/nix-community/nix-vscode-extensions/issues/41. I believe addressing the compatibility problem for all extensions is doomed. nix4vscode should solve this, but maintainers didn't have enough time to finish it and deprecate this repo (https://github.com/nix-community/nix-vscode-extensions/issues/47).

lizelive commented 10 months ago

I saw #41 and am not a huge fan of having to generate lock file for extensions.

i use this script to figure out what version to pin to

with builtins; let
  pkgs = import <nixpkgs> { };
  inherit (pkgs) lib;
  currentVersion = "1.84.2";

  checkVersion = v: all (f: f v) [
    (lib.versionAtLeast currentVersion)
    (lib.versionOlder (lib.versions.major currentVersion))
  ];

  file = ./data/cache/vscode-marketplace-latest.json;

  json = lib.importJSON file;
  packages = filter (p: lib.strings.hasPrefix "github" p.publisher) json;
  getStripVersion = x: lib.strings.removePrefix "^" x.engineVersion;
  byVersion = groupBy getStripVersion packages;
  byMajor = groupBy lib.versions.major (attrNames byVersion);

  compatableVersions = filter checkVersion (attrNames byVersion);

  versionsThisMajor = byMajor.${(lib.versions.major currentVersion)};
  tooOldFor = lib.subtractLists compatableVersions versionsThisMajor;
  howBad = lib.flatten (lib.attrVals tooOldFor byVersion);

in
trace howBad (length howBad)

is it possible include latest extensions supported by code in nixpkgs-unstable by running through the git history of the cache?

it's not hard to program. i'm just wondering if the scrapper will stay up.

deemp commented 1 month ago

@lizelive, you may try, but AFAIR there were changes to the JSON file format, so the scrapper may not work sometimes.