This is alpha quality at most. There are still some rough revision to be made, especially since the author have somewhat eligible capacity to pull this off.
In the meantime, check out devos for more interesting use of Nix.
Within devos itself, you can use as follow:
In flake.nix:
{
inputs.vs-ext.url = "github:divnix/vs-ext";
outputs = inputs@{ vs-ext, ... }: digga.lib.mkFlake {
channels.nixos.overlays = [ vs-ext.overlay ];
};
};In pkgs/default.nix:
final: prev:
let
sources = (import ./_sources/generated.nix) { inherit (final) fetchurl fetchgit; };
mkVscodeExtension = extension:
final.vscode-utils.mkVscodeExtension extension { };
newPkgsSet = pkgSet:
let
prefix = "${pkgSet}-";
pkgSetBuilder = {
"vscode-extensions" = mkVscodeExtension;
}.${pkgSet};
pkgsInSources = final.lib.mapAttrs' (name: value: final.lib.nameValuePair (final.lib.removePrefix prefix name) (value)) (final.lib.filterAttrs (n: v: final.lib.hasPrefix prefix n) sources);
in
final.lib.mapAttrs (n: v: pkgSetBuilder v) pkgsInSources;
in
{
inherit sources;
vscode-extensions = prev.vscode-extensions // (newPkgsSet "vscode-extensions");
}(wait for this PR to merge as it is the same as the above, just remember that the PR was for vimPlugins, so adjust accordingly).
This gives us auto-generated VS Code extensions with meta attributes. See src/generators.nix for a detailed overview.
You can use bud/vscode-ext-prefetch.bash to generate sources and metadata passthrough for extensions. Note that support for VS Marketplace extensions is not yet available as I could only find APIs for OpenVSX.
And no, there aren't any devshell yet. See below for details.
This work does not reinvent the wheel. It stands on the shoulders of the following giants:
❤️
devshell(obviously, butbudis still experimental, so documentations seem vague, or maybe I just got lazy).- More intuitive arrangement of
src. This is a mess I created fromlibandvscode-utils, so I really hope to separate them appropriately. - Maybe a template or at least a guideline for creating projects like this in the future? This whole project is already small, but I still can't grasp some of the core concepts. With a little of extra helps, maybe I can really pull this one off for real.
Over time, this will improve, just not right now (I might get overwhelmed as this is my first time ever contributing and managing a repository, but it won't stop me from making progress).