diff --git a/.gitignore b/.gitignore index 9226e05..9f43c49 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /fennel-ls +/result diff --git a/README.md b/README.md index 3ebb9b1..e7d59d6 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,11 @@ make && make install PREFIX=$HOME # if you have ~/bin on your $PATH For now, the only way to install is to build from source, but I plan on adding fennel-ls to luarocks soon. +### NixOS + +If you are using NixOS, you may use the included `/flake.nix` or `/default.nix` +to to build the language server configure a development environment. + ## Set Up Your Editor Once you've installed the binary somewhere on your computer, the next step is to set up your text editor! Each editor has a different way of doing it. diff --git a/changelog.md b/changelog.md index c060f0a..033fdaa 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # Changelog +* Add [Nix(OS)](https://nixos.org) support * Fix bug with renaming vars * Improve multival tracking * `textEdit` field is present in completions diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..afce557 --- /dev/null +++ b/default.nix @@ -0,0 +1 @@ +{ pkgs ? import {} }: pkgs.callPackage ./nix/package.nix {} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..342ddab --- /dev/null +++ b/flake.lock @@ -0,0 +1,57 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 0, + "narHash": "sha256-S+S97c/HzkO2A/YsU7ZmNF9w2s7Xk6P8dzmfDdckzLs=", + "path": "/nix/store/sb3x0gk95v9h285ch8cdqv3gfjp97p1b-source", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..cb06dbd --- /dev/null +++ b/flake.nix @@ -0,0 +1,38 @@ +{ + description = "A language server for fennel"; + + inputs.flake-utils.url = "github:numtide/flake-utils"; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + inherit (flake-utils.lib) mkApp; + inherit (pkgs) callPackage; + in + { + packages = { + fennel_ls = callPackage ./nix/package.nix { + version = self.shortRev or self.shortDirtyRev or self.lastModifiedDate; + }; + default = self.packages.${system}.fennel_ls; + }; + + devShells = { + fennel_ls = callPackage ./nix/shell.nix { + fennel_ls = self.packages.${system}.fennel_ls; + }; + + default = self.devShells.${system}.fennel_ls; + }; + + apps = rec { + fennel_ls = mkApp { + drv = self.packages.${system}.fennel_ls; + exePath = "/bin/fennel-ls"; + }; + default = self.apps.${system}.fennel_ls; + }; + } + ); +} diff --git a/nix/package.nix b/nix/package.nix new file mode 100644 index 0000000..bc4807b --- /dev/null +++ b/nix/package.nix @@ -0,0 +1,16 @@ +{ version ? "dirty" +, stdenv +, lua +}: stdenv.mkDerivation { + pname = "fennel_ls"; + inherit version; + + src = ./..; + + makeFlags = [ "PREFIX=$(out)" ]; + + buildInputs = [ lua ]; + + doCheck = true; + +} diff --git a/nix/shell.nix b/nix/shell.nix new file mode 100644 index 0000000..aa44249 --- /dev/null +++ b/nix/shell.nix @@ -0,0 +1,7 @@ +{ callPackage +, fennel_ls ? callPackage ./package.nix { } +, mkShell +}: mkShell { + buildInputs = fennel_ls.buildInputs or [ ]; + nativeBuildInputs = fennel_ls.nativeBuildInputs or [ ]; +}