From 7c0943487025d8e4cb90d28b83595a61d672ef52 Mon Sep 17 00:00:00 2001 From: Odd-Harald Date: Fri, 24 Apr 2026 21:18:19 +0300 Subject: [PATCH 1/2] Working flake.nix for Nix users --- flake.lock | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 48 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..7e0248c --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1776949667, + "narHash": "sha256-GMSVw35Q+294GlrTUKlx087E31z7KurReQ1YHSKp5iw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "01fbdeef22b76df85ea168fbfe1bfd9e63681b30", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "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..e8269e0 --- /dev/null +++ b/flake.nix @@ -0,0 +1,48 @@ +{ + description = "dexter - Elixir LSP server"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + }; + in + { + packages.default = pkgs.buildGoModule { + pname = "dexter"; + version = "0.6.0"; + + src = ./.; + + nativeBuildInputs = with pkgs; [ + pkg-config + ]; + + buildInputs = with pkgs; [ + ]; + + go = pkgs.go_1_26; + + vendorHash = "sha256-18Cuyn9BhoGPVzElUGmE4GUKybm1qV/lA0nVpiGyOOY="; + + overrideModAttrs = old: { + postBuild = (old.postBuild or "") + '' + # go mod vendor strips directories without .go files; restore CGO C sources + chmod -R u+w vendor + local gomodcache="$GOPATH/pkg/mod" + local ts_go="$gomodcache/github.com/tree-sitter/go-tree-sitter@v0.25.0" + local ts_ex="$gomodcache/github.com/elixir-lang/tree-sitter-elixir@v0.3.5" + cp -r "$ts_go/include" vendor/github.com/tree-sitter/go-tree-sitter/ + cp -r "$ts_go/src" vendor/github.com/tree-sitter/go-tree-sitter/ + cp -r "$ts_ex/src" vendor/github.com/tree-sitter/tree-sitter-elixir/ + ''; + }; + }; + }); +} \ No newline at end of file From dfca45c5b12b312a8bcb2c5ac73c7dd11923c9e3 Mon Sep 17 00:00:00 2001 From: Odd-Harald Date: Fri, 24 Apr 2026 21:20:59 +0300 Subject: [PATCH 2/2] Produce as dexter binary --- flake.nix | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/flake.nix b/flake.nix index e8269e0..be11f5b 100644 --- a/flake.nix +++ b/flake.nix @@ -9,28 +9,20 @@ outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { - inherit system; - }; + pkgs = import nixpkgs { inherit system; }; in { packages.default = pkgs.buildGoModule { pname = "dexter"; version = "0.6.0"; - src = ./.; - - nativeBuildInputs = with pkgs; [ - pkg-config - ]; - - buildInputs = with pkgs; [ - ]; - - go = pkgs.go_1_26; - + nativeBuildInputs = with pkgs; [ pkg-config ]; vendorHash = "sha256-18Cuyn9BhoGPVzElUGmE4GUKybm1qV/lA0nVpiGyOOY="; + postInstall = '' + mv $out/bin/cmd $out/bin/dexter + ''; + overrideModAttrs = old: { postBuild = (old.postBuild or "") + '' # go mod vendor strips directories without .go files; restore CGO C sources @@ -45,4 +37,4 @@ }; }; }); -} \ No newline at end of file +}