From 2e81154a990e807b110b36bef9fe77ed75e090d6 Mon Sep 17 00:00:00 2001 From: "Gustavo L de Mello (Guz)" Date: Sun, 8 Dec 2024 21:16:07 -0300 Subject: [PATCH] feat(tweaks,grip): use go-grip instead of grip --- flake.lock | 55 +++++++++++++++++++++++++++++++++++++++++++ flake.nix | 30 +++++------------------ lua/dot013/tweaks.lua | 2 +- neovim.nix | 4 ++-- 4 files changed, 64 insertions(+), 27 deletions(-) diff --git a/flake.lock b/flake.lock index 66d7afd..1ff1969 100644 --- a/flake.lock +++ b/flake.lock @@ -74,6 +74,24 @@ "type": "indirect" } }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "git-hooks": { "inputs": { "flake-compat": "flake-compat_2", @@ -123,6 +141,27 @@ "type": "github" } }, + "go-grip": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1733702535, + "narHash": "sha256-PHv+pxgdJE8MgM5AS2Yu9+vdD0I4kpRekgHMN5uRIHg=", + "owner": "guz013", + "repo": "go-grip", + "rev": "d67368388939be8513cd52a9e1d86d71543dbcde", + "type": "github" + }, + "original": { + "owner": "guz013", + "repo": "go-grip", + "type": "github" + } + }, "hercules-ci-effects": { "inputs": { "flake-parts": "flake-parts_2", @@ -218,9 +257,25 @@ }, "root": { "inputs": { + "go-grip": "go-grip", "neovim-nightly-overlay": "neovim-nightly-overlay", "nixpkgs": "nixpkgs_2" } + }, + "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", diff --git a/flake.nix b/flake.nix index ca58480..8e5ad30 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,11 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay"; + + go-grip = { + url = "github:guz013/go-grip"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { self, @@ -23,32 +28,9 @@ pkgs = import nixpkgs {inherit system overlays;}; in f system pkgs); - - grip = { - pkgs, - lib, - }: let - gripConf = pkgs.writeText "settings.py" '' - HOST = "0.0.0.0" - ''; - gripHome = pkgs.stdenv.mkDerivation { - name = "grip-conf"; - src = gripConf; - phases = ["installPhase"]; - installPhase = '' - mkdir -p $out - cp $src $out/settings.py - ''; - }; - in - pkgs.writeShellScriptBin "grip" '' - export GRIPHOME="${gripHome}" - ${lib.getExe pkgs.python312Packages.grip} "$@" - ''; in { packages = forAllSystems (system: pkgs: { - grip = pkgs.callPackage grip {}; - neovim = pkgs.callPackage ./neovim.nix {inherit self;}; + neovim = pkgs.callPackage ./neovim.nix {inherit inputs;}; default = self.packages.${system}.neovim; }); diff --git a/lua/dot013/tweaks.lua b/lua/dot013/tweaks.lua index a65c16c..98c7927 100644 --- a/lua/dot013/tweaks.lua +++ b/lua/dot013/tweaks.lua @@ -16,7 +16,7 @@ vim.api.nvim_create_user_command("GripStart", function() local file = vim.api.nvim_buf_get_name(0) - local cmd = "grip " .. file + local cmd = "go-grip -b false -H 0.0.0.0 " .. file grip_channel = vim.fn.jobstart(cmd, { stderr_buffered = true, diff --git a/neovim.nix b/neovim.nix index 75f1be6..72abfab 100644 --- a/neovim.nix +++ b/neovim.nix @@ -1,5 +1,5 @@ { - self, + inputs, symlinkJoin, makeWrapper, runCommandLocal, @@ -87,7 +87,7 @@ lf ripgrep - self.packages.${pkgs.system}.grip + inputs.go-grip.packages.${pkgs.system}.default ]; foldPlugins = builtins.foldl' (acc: next: acc ++ [next] ++ (foldPlugins (next.dependencies or []))) [];