From 1f6f0c40e8658b3fc1cacafbf5a42d4264a33862 Mon Sep 17 00:00:00 2001 From: Barry Moore Date: Fri, 27 Jan 2023 15:08:37 -0500 Subject: [PATCH] Set up nix shell, aniseed --- .gitignore | 4 ++++ Makefile | 1 + README.md | 30 ++++++++++++++++++++++++++++++ flake.lock | 42 ++++++++++++++++++++++++++++++++++++++++++ flake.nix | 30 ++++++++++++++++++++++++++++++ nix/aniseed.nix | 24 ++++++++++++++++++++++++ nix/shell.nix | 8 ++++++++ 7 files changed, 139 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 nix/aniseed.nix create mode 100644 nix/shell.nix diff --git a/.gitignore b/.gitignore index 1b83131b..13e5dec3 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,7 @@ test.sh .luarc.json nvim plugin/packer_compiled.lua + +.direnv/ +.envrc +result diff --git a/Makefile b/Makefile index fa189a45..07e763f3 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ format: + alejandra --quiet . lua-format --in-place init.lua .PHONY: format diff --git a/README.md b/README.md index 4cc00b1b..a1bf35fb 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,29 @@ +### Motivation + +This repository is a bit of a meme. The meme is that my neovim is configured by +a Lisp, similar to emacs. The Lisp used is [fennel][Fennel] which transpiles +directly to Lua. I am using a tool called [aniseed][Aniseed] to automatically +convert Fennel to Lua. Lastly, I use [nix][Nix] to bootstrap Aniseed. + +The configuration itself is rather close to the original +[kickstart][kickstart.nvim] repository. I added some utility from my original +neovim configuration and added my LSP configuration. + +### Installation + +``` +nix build # builds `init.vim` +ln -s result/init.vim # reads fnl/ converts to lua/ +vim -s ":PackerInstall" # bootstrap packer +vim -s ":PackerInstall" # install plugins +``` + +### TODO: + +- [ ] Finish converting `init.lua` to Fennel + +**EVERYTHING BELOW THIS LINE WAS ORIGINAL DOCUMENTATION** + ### Introduction A starting point for Neovim that is: @@ -82,3 +108,7 @@ Each PR, especially those which increase the line count, should have a descripti * You should back it up, then delete all files associated with it. * This includes your existing init.lua and the neovim files in `.local` which can be deleted with `rm -rf ~/.local/share/nvim/` +[nix]: https://nixos.org/download.html +[fennel]: https://fennel-lang.org +[aniseed]: https://github.com/Olical/aniseed +[kickstart]: https://github.com/nvim-lua/kickstart.nvim diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..f599e58a --- /dev/null +++ b/flake.lock @@ -0,0 +1,42 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1674807565, + "narHash": "sha256-zOLE1YXf2RhYhtNv4n8C0xPaSjduchLlCxZaAeoAvxU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f80ac848e3d6f0c12c52758c0f25c10c97ca3b62", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixpkgs-unstable", + "type": "indirect" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..b4bb4810 --- /dev/null +++ b/flake.nix @@ -0,0 +1,30 @@ +{ + description = "Setup aniseed"; + + inputs = { + nixpkgs.url = "nixpkgs/nixpkgs-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { + self, + nixpkgs, + flake-utils, + ... + }: + flake-utils.lib.eachSystem ["x86_64-linux"] (system: let + pkgs = import nixpkgs { + inherit system; + # config.allowBroken = true; + }; + aniseed = pkgs.callPackage ./nix/aniseed.nix {}; + in { + devShell = import ./nix/shell.nix { + inherit pkgs; + }; + defaultPackage = aniseed; + packages = flake-utils.lib.flattenTree { + inherit aniseed; + }; + }); +} diff --git a/nix/aniseed.nix b/nix/aniseed.nix new file mode 100644 index 00000000..63bea198 --- /dev/null +++ b/nix/aniseed.nix @@ -0,0 +1,24 @@ +{pkgs, ...}: let + aniseed = pkgs.vimUtils.buildVimPluginFrom2Nix { + pname = "aniseed"; + version = "v3.32.0"; + src = pkgs.fetchFromGitHub { + owner = "Olical"; + repo = "aniseed"; + rev = "a7445c340fb7a0529f3c413eb99d3f8d29f50ba2"; + sha256 = "sha256-KTNImPjifuoj0/ahuYcqMtutGgOR4XnYruv/JVjyrTk="; + }; + meta.homepage = "https://github.com/Olical/aniseed"; + }; +in + pkgs.stdenv.mkDerivation { + name = "init.vim"; + phases = ["installPhase" "fixupPhase"]; + installPhase = '' + mkdir $out + cat << EOF > $out/init.vim + set runtimepath+=${aniseed} + let g:aniseed#env = v:true + EOF + ''; + } diff --git a/nix/shell.nix b/nix/shell.nix new file mode 100644 index 00000000..b321829d --- /dev/null +++ b/nix/shell.nix @@ -0,0 +1,8 @@ +{pkgs, ...}: +pkgs.mkShell { + buildInputs = with pkgs; [ + fennel + fnlfmt + alejandra + ]; +}