feat: add nix(os) packaging &development support
* Adds `/flake.nix`, which allows the package to be installed & developed easily by most NixOS users. * Adds `/default.nix`, which is an older way that some Nix(OS) users may expect software to be packaged. * Adds `/nix/**/*.nix`, which defines various additional helpers used by `/flake.nix` and `/default.nix`. * Updates `.gitignore` to include `/result`, which is the default output location when the package is built using `nix flake build .` or `nix-build .`
This commit is contained in:
parent
41adfc7099
commit
112132cc5a
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
/fennel-ls
|
||||
/result
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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
|
||||
|
||||
1
default.nix
Normal file
1
default.nix
Normal file
@ -0,0 +1 @@
|
||||
{ pkgs ? import <nixpkgs> {} }: pkgs.callPackage ./nix/package.nix {}
|
||||
57
flake.lock
generated
Normal file
57
flake.lock
generated
Normal file
@ -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
|
||||
}
|
||||
38
flake.nix
Normal file
38
flake.nix
Normal file
@ -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;
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
16
nix/package.nix
Normal file
16
nix/package.nix
Normal file
@ -0,0 +1,16 @@
|
||||
{ version ? "dirty"
|
||||
, stdenv
|
||||
, lua
|
||||
}: stdenv.mkDerivation {
|
||||
pname = "fennel_ls";
|
||||
inherit version;
|
||||
|
||||
src = ./..;
|
||||
|
||||
makeFlags = [ "PREFIX=$(out)" ];
|
||||
|
||||
buildInputs = [ lua ];
|
||||
|
||||
doCheck = true;
|
||||
|
||||
}
|
||||
7
nix/shell.nix
Normal file
7
nix/shell.nix
Normal file
@ -0,0 +1,7 @@
|
||||
{ callPackage
|
||||
, fennel_ls ? callPackage ./package.nix { }
|
||||
, mkShell
|
||||
}: mkShell {
|
||||
buildInputs = fennel_ls.buildInputs or [ ];
|
||||
nativeBuildInputs = fennel_ls.nativeBuildInputs or [ ];
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user