From 1846fa41ba015278a9e5f9e73128fa75a9893a56 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Wed, 5 Apr 2023 13:42:33 +0300 Subject: [PATCH] volar: add package --- README.md | 8 ++++++++ flake.lock | 17 +++++++++++++++++ flake.nix | 29 ++++++++++++++++++++++++----- 3 files changed, 49 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8cee3f5..9e78d8e 100644 --- a/README.md +++ b/README.md @@ -71,3 +71,11 @@ _Python dependency checker._ References: - [https://github.com/tweag/FawltyDeps](https://github.com/tweag/FawltyDeps) + +# Volar + +_High-performance Vue language tooling based-on Volar.js_ + +References: + +- [https://github.com/vuejs/language-tools](https://github.com/vuejs/language-tools) diff --git a/flake.lock b/flake.lock index b95627e..43ebc6f 100644 --- a/flake.lock +++ b/flake.lock @@ -30,6 +30,22 @@ "type": "github" } }, + "nixpkgs_volar": { + "locked": { + "lastModified": 1674717306, + "narHash": "sha256-NSbsdPMKQhd3w3YUo/9vjgG7EGCpAvNKNW+/Ps410Lk=", + "owner": "ehllie", + "repo": "nixpkgs", + "rev": "63026ac84856a3407c359e13b72d8aa0612ebd3e", + "type": "github" + }, + "original": { + "owner": "ehllie", + "ref": "volar", + "repo": "nixpkgs", + "type": "github" + } + }, "poetry2nix": { "inputs": { "flake-utils": [ @@ -57,6 +73,7 @@ "inputs": { "flake-utils": "flake-utils", "nixpkgs": "nixpkgs", + "nixpkgs_volar": "nixpkgs_volar", "poetry2nix": "poetry2nix", "wd2": "wd2" } diff --git a/flake.nix b/flake.nix index 72ba834..68cb660 100644 --- a/flake.nix +++ b/flake.nix @@ -10,13 +10,15 @@ wd2.url = "git+https://git.pleshevski.ru/pleshevskiy/wd2"; wd2.inputs.nixpkgs.follows = "nixpkgs"; wd2.inputs.flake-utils.follows = "flake-utils"; + + nixpkgs_volar.url = "github:ehllie/nixpkgs/volar"; }; outputs = { nixpkgs, flake-utils, poetry2nix, ... } @ inputs: let inherit (builtins) listToAttrs mapAttrs; - allPackageNames = [ "d2" "d2plugin-tala" "d2full" "wd2" "fawltydeps" ]; + allPackageNames = [ "d2" "d2plugin-tala" "d2full" "wd2" "fawltydeps" "volar" ]; mkAllPackages = pkgs': let d2-unwrapped = pkgs'.callPackage ./pkgs/d2/d2-unwrapped.nix { }; @@ -24,15 +26,32 @@ d2 = pkgs'.callPackage ./pkgs/d2 { inherit d2-unwrapped d2plugin-tala; }; - fawltydeps = pkgs'.callPackage ./pkgs/fawltydeps { }; - wd2 = pkgs'.callPackage "${inputs.wd2}/wd2.nix" { inherit d2; }; in { - inherit d2 d2plugin-tala wd2 fawltydeps; + inherit d2 d2plugin-tala; d2-full = d2.override { withTala = true; }; + + wd2 = pkgs'.callPackage "${inputs.wd2}/wd2.nix" { inherit d2; }; + + fawltydeps = pkgs'.callPackage ./pkgs/fawltydeps { }; + + # Temporary workaround to use volar language server for vue + # + # Remove when the following PR will be merged + # https://github.com/NixOS/nixpkgs/pull/190921 + volar = inputs.nixpkgs_volar.legacyPackages.${pkgs'.system}.nodePackages.volar; }; - mkApp = drv: flake-utils.lib.mkApp { inherit drv; }; + mkApp = drv: + let + inherit (builtins) head split; + pname = head (split "-" drv.name); + in + flake-utils.lib.mkApp + { + inherit drv; + name = if pname == "volar" then "vue-language-server" else pname; + }; mkOverlay = name: final: prev: final.filterAttrs (n: v: n == name) (mkAllPackages prev)