From aaeae617b62f15cb3084db4c82f413627c1c6b1f Mon Sep 17 00:00:00 2001 From: Sean Murphy Date: Tue, 25 Jun 2024 09:37:12 +0200 Subject: [PATCH] chore(nix): add shell.nix to support nix builds --- README.md | 2 ++ chat/shell.nix | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 chat/shell.nix diff --git a/README.md b/README.md index 61a8c58..67a7198 100644 --- a/README.md +++ b/README.md @@ -175,6 +175,8 @@ $ # Arch $ pacman -S --needed gtk3 glib2 webkit2gtk-4.1 libsoup3 ``` +A `shell.nix` is provided for nix/NixOS builds; instructions are contained within the file [here](chat/shell.nix). + ## Commands - `:TabnineStatus` - to print Tabnine status diff --git a/chat/shell.nix b/chat/shell.nix new file mode 100644 index 0000000..e855011 --- /dev/null +++ b/chat/shell.nix @@ -0,0 +1,43 @@ +# shell.nix +# +# this is a nix file which can create a shell with the dependencies necessary +# to build tabnine-chat. It assumes you're reasonably familiar with the nix +# toolchain. +# +# To use it: +# +# $ cd chat +# $ nix-shell +# these 11 paths will be fetched (156.39 MiB download, 739.97 MiB unpacked): +# /nix/store/z8dx4c6z528qi2w1p38yzg17g8q5jnln-cargo-1.77.2 +# +# [nix-shell]$ cargo build --release +# Compiling serde v1.0.164 +# +# Compiling tabnine_chat v0.1.0 (/home/sean/Work/tabnine-nvim/chat) +# Finished release [optimized] target(s) in 1m 42s +# +# built against 960fae2187687ff0929775ffedb6f05172b990d2 with nixos 24.05 +# +# A flake could have been provided, but given that tabnine-nvim is often +# managed by lazy, can change quite frequently and is a bit divorced from the +# nix ecosystem, it seemed that a reasonable solution was just to support the +# cargo build process inside the chat directory. + +{ pkgs ? import {} }: + pkgs.mkShell rec { + buildInputs = with pkgs; [ + cargo + rustc + pkg-config + ]; + + nativeBuildInputs = with pkgs; [ + glib + gdk-pixbuf + libsoup_3 + pango + gtk3 + webkitgtk_4_1 + ]; + }