Merge pull request #4 from NotAShelf/flake-refactor

refactor `flake.nix` and switch to flake-parts
This commit is contained in:
NotAShelf 2023-02-15 08:50:23 +00:00 committed by GitHub
commit 0b1933160e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 478 additions and 381 deletions

View file

@ -3,10 +3,12 @@ name: build-and-cache
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- '**/README.md'
- '**/.gitignore'
- '**/assets'
- '.github/**'
- './assets/**'
- '.gitignore'
jobs:
nix:

View file

@ -1,10 +1,10 @@
name: "Pull request"
name: "Check validity of flakes"
on:
pull_request:
workflow_dispatch:
push:
branches:
- main
workflow_dispatch:
jobs:
nix-flake-check:
runs-on: ubuntu-latest

View file

@ -1,5 +1,6 @@
name: Github Pages docs
on:
workflow_dispatch:
push:
branches:
- main
@ -25,7 +26,7 @@ jobs:
uses: cachix/install-nix-action@v18
- name: Build
run: |
nix build '.#docs-html'
nix build '.#docs'
cp -r result/share/doc/neovim-flake public
- name: Deploy
uses: peaceiris/actions-gh-pages@v3

View file

@ -1,6 +1,6 @@
{
pkgs,
lib ? import ../modules/lib/stdlib-extended.nix pkgs.lib,
lib ? import ../lib/stdlib-extended.nix pkgs.lib,
nmdSrc,
}: let
nmd = import nmdSrc {inherit lib pkgs;};

42
docs/home-manager.adoc Normal file
View file

@ -0,0 +1,42 @@
[[ch-hm-module]]
== Home Manager
The Home Manager module allows us to customize the different `vim` options. To use it, we first add the input flake.
[source,nix]
----
{
neovim-flake = {
url = github:notashelf/neovim-flake;
# you can override input nixpkgs
inputs.nixpkgs.follows = "nixpkgs";
};
}
----
Followed by importing the HM module.
[source,nix]
----
{
imports = [ neovim-flake.nixosModules.hm-module ];
}
----
Then we should be able to use the given module. E.g.
[source,nix]
----
{
programs.neovim-flake = {
enable = true;
settings = {
vim.viAlias = false;
vim.vimAlias = true;
vim.lsp = {
enable = true;
};
};
};
}
----

View file

@ -19,6 +19,7 @@
<xi:include href="try-it-out.xml"/>
<xi:include href="default-configs.xml"/>
<xi:include href="custom-configs.xml"/>
<xi:include href="home-manager.xml"/>
<xi:include href="languages.xml"/>
<xi:include href="plugins.xml"/>
<appendix xml:id="ch-options">

166
extra.nix Normal file
View file

@ -0,0 +1,166 @@
inputs: let
modulesWithInputs = import ./modules inputs;
neovimConfiguration = {
modules ? [],
pkgs,
lib ? pkgs.lib,
check ? true,
extraSpecialArgs ? {},
}:
modulesWithInputs {
inherit pkgs lib check extraSpecialArgs;
configuration.imports = modules;
};
mainConfig = isMaximal: {
config = {
vim = {
viAlias = true;
vimAlias = true;
};
vim.lsp = {
enable = true;
formatOnSave = true;
lightbulb.enable = true;
lspsaga.enable = false;
nvimCodeActionMenu.enable = true;
trouble.enable = true;
lspSignature.enable = true;
rust.enable = isMaximal;
python = isMaximal;
clang.enable = isMaximal;
sql = isMaximal;
ts = isMaximal;
go = isMaximal;
zig.enable = isMaximal;
nix = {
enable = true;
formatter = "alejandra";
};
};
vim.visuals = {
enable = true;
nvimWebDevicons.enable = true;
scrollBar.enable = true;
smoothScroll.enable = true;
cellularAutomaton.enable = true;
lspkind.enable = true;
indentBlankline = {
enable = true;
fillChar = "";
eolChar = "";
showCurrContext = true;
};
cursorWordline = {
enable = true;
lineTimeout = 0;
};
};
vim.statusline.lualine = {
enable = true;
theme = "catppuccin";
};
vim.theme = {
enable = true;
name = "catppuccin";
style = "mocha";
};
vim.autopairs.enable = true;
vim.autocomplete = {
enable = true;
type = "nvim-cmp";
};
vim.filetree = {
nvimTreeLua = {
enable = true;
view = {
width = 25;
};
};
};
vim.tabline = {
nvimBufferline.enable = true;
};
vim.treesitter = {
enable = true;
context.enable = true;
};
vim.binds = {
whichKey.enable = true;
cheatsheet.enable = true;
};
vim.telescope = {
enable = true;
};
vim.markdown = {
enable = true;
glow.enable = true;
};
vim.git = {
enable = true;
gitsigns.enable = true;
};
vim.minimap = {
minimap-vim.enable = false;
codewindow.enable = true; # lighter, faster, and uses lua for configuration
};
vim.dashboard = {
dashboard-nvim.enable = false;
alpha.enable = true;
};
vim.notify = {
nvim-notify.enable = true;
};
vim.utility = {
colorizer.enable = true;
icon-picker.enable = true;
venn-nvim.enable = false; # FIXME throws an error when its commands are ran manually
};
vim.notes = {
obsidian.enable = false; # FIXME neovim fails to build if obsidian is enabled
orgmode.enable = true;
};
vim.terminal = {
toggleterm.enable = true;
};
vim.ui = {
noice.enable = true;
};
vim.assistant = {
copilot.enable = isMaximal;
#tabnine.enable = false; # FIXME: this is not working because the plugin depends on an internal script to be ran by the package manager
};
vim.session = {
nvim-session-manager.enable = false;
};
vim.gestures = {
gesture-nvim.enable = false;
};
};
};
in {
inherit neovimConfiguration mainConfig;
}

View file

@ -3,11 +3,11 @@
"alpha-nvim": {
"flake": false,
"locked": {
"lastModified": 1669699262,
"narHash": "sha256-uKJRMbNyQtiFhkrsniK7SqxM+XS2l3qffeCqmYznPuk=",
"lastModified": 1676405195,
"narHash": "sha256-z4wZatHXfN5H6de4AKl3zWyNne8FmfXq35KndTvuwXQ=",
"owner": "goolord",
"repo": "alpha-nvim",
"rev": "21a0f2520ad3a7c32c0822f943368dc063a569fb",
"rev": "d35b99e36e32040ba06c48a25b5bd3e75be2a566",
"type": "github"
},
"original": {
@ -35,11 +35,11 @@
"catppuccin": {
"flake": false,
"locked": {
"lastModified": 1675250216,
"narHash": "sha256-t7jVZoQwoLptfSo7WvA4DJe3mmqAk9R5nNcvldDSp8w=",
"lastModified": 1676442952,
"narHash": "sha256-DC0YRaqOJH3ORL/oPPZPcrZntQJMSkmZYvYwIC67Fg0=",
"owner": "catppuccin",
"repo": "nvim",
"rev": "8769e767f12f5bf0b7d1250ee067088e7054809a",
"rev": "2ed26d9a9797d192f752f1757e3ca045ae1d4c6f",
"type": "github"
},
"original": {
@ -115,11 +115,11 @@
"cmp-nvim-lsp": {
"flake": false,
"locked": {
"lastModified": 1668566979,
"narHash": "sha256-Mqkp8IH/laUx0cK7S0BjusTT+OtOOJOamZM4+93RHdU=",
"lastModified": 1675708067,
"narHash": "sha256-DxpcPTBlvVP88PDoTheLV2fC76EXDqS2UpM5mAfj/D4=",
"owner": "hrsh7th",
"repo": "cmp-nvim-lsp",
"rev": "59224771f91b86d1de12570b4070fe4ad7cd1eeb",
"rev": "0e6b2ed705ddcff9738ec4ea838141654f12eeef",
"type": "github"
},
"original": {
@ -211,11 +211,11 @@
"copilot-lua": {
"flake": false,
"locked": {
"lastModified": 1675346663,
"narHash": "sha256-+a286iUK7UijcbRLb8gXwmDFZAf1gYupS5f9EHB+dxU=",
"lastModified": 1676315274,
"narHash": "sha256-OA5gflAOdnM4EsTCZGH/cyIyBeWz+6xkd624Nm6t7MY=",
"owner": "zbirenbaum",
"repo": "copilot.lua",
"rev": "a54e7b11a2c6efc9ddd3f42e56cf7d9eed1a9683",
"rev": "137df557486f91627b8e4708a47088f36950f12c",
"type": "github"
},
"original": {
@ -227,11 +227,11 @@
"crates-nvim": {
"flake": false,
"locked": {
"lastModified": 1675348132,
"narHash": "sha256-CMhqiIXoCamLh8pfmYQZsAYeoJO5SHe7jBdfOuD1W0c=",
"lastModified": 1676072696,
"narHash": "sha256-e30Ir+Kd0EuvGoqORLtIA3aloL9djuebZYkBssWA0L8=",
"owner": "Saecki",
"repo": "crates.nvim",
"rev": "1bca9122ddc4bf4c6573402bf6686fc084470a7e",
"rev": "3fc7ddac13ddf65914a733ef074317c4c72ef05b",
"type": "github"
},
"original": {
@ -243,11 +243,11 @@
"dashboard-nvim": {
"flake": false,
"locked": {
"lastModified": 1675564456,
"narHash": "sha256-KQ89wIEKIEetd6SDcNfui/hr3vRYGhh7W+XWPpB1Xc0=",
"lastModified": 1676423815,
"narHash": "sha256-/2W34BLNJVs81V2Fl/4UdKo3V8R4OPPXGfswcMU4nNw=",
"owner": "glepnir",
"repo": "dashboard-nvim",
"rev": "97aaa208917f814f2e5799d5894ff791b4ab5059",
"rev": "0e3f79eb5066fb3ee5c31e2879d2a644b5cc36da",
"type": "github"
},
"original": {
@ -305,13 +305,31 @@
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1675933616,
"narHash": "sha256-/rczJkJHtx16IFxMmAWu5nNYcSXNg1YYXTHoGjLrLUA=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "47478a4a003e745402acf63be7f9a092d51b83d7",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"lastModified": 1676283394,
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
"type": "github"
},
"original": {
@ -339,11 +357,11 @@
"gitsigns-nvim": {
"flake": false,
"locked": {
"lastModified": 1675416322,
"narHash": "sha256-nxqs6nIQKyK6GzQihgBUY1/HggF/i5huz5VsUUu4fKE=",
"lastModified": 1676367932,
"narHash": "sha256-mNJClYEA8zcneJjqj4wUwHcy45MrODP3mYKhiNvmr04=",
"owner": "lewis6991",
"repo": "gitsigns.nvim",
"rev": "ec4742a7eebf68bec663041d359b95637242b5c3",
"rev": "4bd5d7702c17643ff40c035b6b936757b99743c7",
"type": "github"
},
"original": {
@ -355,11 +373,11 @@
"glow-nvim": {
"flake": false,
"locked": {
"lastModified": 1675023136,
"narHash": "sha256-80gtxODbPDxI7nlt0LpFfQBG8Q9amWm5pRqoJxMRrcQ=",
"lastModified": 1676038549,
"narHash": "sha256-37gwf3sS2eFNDTKdLLNcOPi3d1TnAA3dC+zEYj/N3Ew=",
"owner": "ellisonleao",
"repo": "glow.nvim",
"rev": "c87b1120b618577e64d910a7493a26829044a8a2",
"rev": "2bb4afb6e9dbc93993a1d7d4168dac08c74590ac",
"type": "github"
},
"original": {
@ -467,11 +485,11 @@
"lualine": {
"flake": false,
"locked": {
"lastModified": 1673418538,
"narHash": "sha256-3I9og+/lVRFJSpDVFwp2AM5bMqeP1KF8XB8Nyfpwhok=",
"lastModified": 1676394253,
"narHash": "sha256-mItWWRqWj9a/JaW8sccnGBijBsvvnh/b4q/S60UwYwc=",
"owner": "hoob3rt",
"repo": "lualine.nvim",
"rev": "0050b308552e45f7128f399886c86afefc3eb988",
"rev": "e99d733e0213ceb8f548ae6551b04ae32e590c80",
"type": "github"
},
"original": {
@ -528,11 +546,11 @@
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1675471872,
"narHash": "sha256-HBW6qBF/niMbdFxTuucSnDda9H/RSbbOs48fcXXImx0=",
"lastModified": 1676390054,
"narHash": "sha256-w0KvrM+9WIEYr0juDh4Vs39ed2IaT0T696fp9pZ7i1I=",
"owner": "oxalica",
"repo": "nil",
"rev": "1a15174958729ca578db517e735479ed5fb963db",
"rev": "944d5c335531778a1d7b54a97bf7fb5ec0c3e976",
"type": "github"
},
"original": {
@ -543,11 +561,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1675584158,
"narHash": "sha256-SBkchaDzCHxnPNRDdtZ5ko5caHio9iS0Mbyn/xXbXxs=",
"lastModified": 1676209454,
"narHash": "sha256-alj9mBkV9U6tTPDK026671D2pesLSYZZc9j5dBZJ9f0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d840126a0890621e7b220894d749132dd4bde6a0",
"rev": "8c619a1f3cedd16ea172146e30645e703d21bfc1",
"type": "github"
},
"original": {
@ -557,6 +575,24 @@
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"dir": "lib",
"lastModified": 1675183161,
"narHash": "sha256-Zq8sNgAxDckpn7tJo7V1afRSk2eoVbu3OjI1QklGLNg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e1e1b192c1a5aab2960bf0a0bd53a2e8124fa18e",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1656753965,
@ -592,11 +628,11 @@
"nmd": {
"flake": false,
"locked": {
"lastModified": 1674431006,
"narHash": "sha256-CFKH2AiIH6vk0IQPrSa63+n2xZc2bIrEIUgnxd3Dg+w=",
"lastModified": 1675884907,
"narHash": "sha256-IyLmIotAp7g6sxjeKx6gl52KQ/Xi6wyyHFhd/AWuM5o=",
"owner": "rycee",
"repo": "nmd",
"rev": "409f1310b168f96c6c8b556d24731a3e7c26c255",
"rev": "fa87e124c83ba343f88607b7348a4bd8a0ad061c",
"type": "gitlab"
},
"original": {
@ -608,11 +644,11 @@
"noice-nvim": {
"flake": false,
"locked": {
"lastModified": 1675023568,
"narHash": "sha256-5C05en9c6tZW3/vNjgCfFQFRFq5U0NKg/LK5EeUHc1o=",
"lastModified": 1675803750,
"narHash": "sha256-mLOoYjlJawgkNGhkXYc/otpLXkjKHpLbMsYu4j0qwFQ=",
"owner": "folke",
"repo": "noice.nvim",
"rev": "34f7cf628666c6eb0c93fbe8a0490e977ac78b7b",
"rev": "d8a1f3056ad713b5d471048f8d029264828e22c0",
"type": "github"
},
"original": {
@ -640,11 +676,11 @@
"null-ls": {
"flake": false,
"locked": {
"lastModified": 1675398737,
"narHash": "sha256-IG66jvXizre17P2F3N9pWjmkQSP3jF+6lJeypNbSWUc=",
"lastModified": 1676421273,
"narHash": "sha256-7woxEeTSVDmCKW0s+Z4mgwxunLdK5tkMoZqQw/devnU=",
"owner": "jose-elias-alvarez",
"repo": "null-ls.nvim",
"rev": "8f5d730021497233c39d3adbf4b8043d4be163f8",
"rev": "2d89e1a38e3bdebd43984c23c861c33c0e36bd7a",
"type": "github"
},
"original": {
@ -656,11 +692,11 @@
"nvim-autopairs": {
"flake": false,
"locked": {
"lastModified": 1675089120,
"narHash": "sha256-wcNyOHhBkWVgbxIf4frKDKlMQEE9iMYWN78p+3rNJ+g=",
"lastModified": 1675800886,
"narHash": "sha256-MJu1rrUaiwZ/qu0Lv4leGSiPq4TzyhHoRw48C+r3+Zs=",
"owner": "windwp",
"repo": "nvim-autopairs",
"rev": "5a3523ddb573804752de6c021c5cb82e267b79ca",
"rev": "45ae3122a4c7744db41298b41f9f5a3f092123e6",
"type": "github"
},
"original": {
@ -689,11 +725,11 @@
"nvim-cmp": {
"flake": false,
"locked": {
"lastModified": 1675440540,
"narHash": "sha256-BgI0dR7ss+pClGIu3EWXV7r5mMpo6Xt3QMVAxeWm++E=",
"lastModified": 1676388741,
"narHash": "sha256-yFTHFveMEki4Y7Q/wdxfZVGFT4ZbcIyffkknjJtHn+w=",
"owner": "hrsh7th",
"repo": "nvim-cmp",
"rev": "cfafe0a1ca8933f7b7968a287d39904156f2c57d",
"rev": "c4128bcd131fb7152bda8f8dd2b5e41d2fefa88c",
"type": "github"
},
"original": {
@ -769,11 +805,11 @@
"nvim-lspconfig": {
"flake": false,
"locked": {
"lastModified": 1675639052,
"narHash": "sha256-B8IgpypxzCACZ5VcqM6KiWyClaN+KrmemtkwMznmj5Y=",
"lastModified": 1676431382,
"narHash": "sha256-DBaAmhMfYzlHza6DOscDhD3ecYaFB4QqXrkfIirfMns=",
"owner": "neovim",
"repo": "nvim-lspconfig",
"rev": "255e07ce2a05627d482d2de77308bba51b90470c",
"rev": "e20d77deac40e6e65d036acd60aff474c0f09282",
"type": "github"
},
"original": {
@ -833,11 +869,11 @@
"nvim-tree-lua": {
"flake": false,
"locked": {
"lastModified": 1675639400,
"narHash": "sha256-d9c4T++6LnaqUsJAMmJGSLQYz+frjl7QhBJONJOvb2E=",
"lastModified": 1676413452,
"narHash": "sha256-ttCTJsuO86jDrWsDTpQzg/uESHPYhyo1oF+2bJFI7E0=",
"owner": "nvim-tree",
"repo": "nvim-tree.lua",
"rev": "02fdc262eba188198a7deb2117b3b996e6763d65",
"rev": "08a0aa1a3b7411ee0a7887c8818528b1558cef96",
"type": "github"
},
"original": {
@ -881,11 +917,11 @@
"nvim-web-devicons": {
"flake": false,
"locked": {
"lastModified": 1675479859,
"narHash": "sha256-bbce2CpzCY8/Y6egWJWthZ9t1IkODCt+467S728vcKM=",
"lastModified": 1676326872,
"narHash": "sha256-BmxnyHdNe7/egXNRz91YOcsvnc9fyK2jlYiqGhkaXSk=",
"owner": "kyazdani42",
"repo": "nvim-web-devicons",
"rev": "2b96193abe4372e18e4f4533895a42a466d53c17",
"rev": "bb6d4fd1e010300510172b173ab5205d37af084f",
"type": "github"
},
"original": {
@ -897,11 +933,11 @@
"obsidian-nvim": {
"flake": false,
"locked": {
"lastModified": 1675366609,
"narHash": "sha256-QUAic7yakCXNhYqeaxD+86dIAQzW/pJYN7Y69uDB3xk=",
"lastModified": 1676332768,
"narHash": "sha256-TmHzWRBzg1iSttlwr3wKfzj73lpDcBiVnXvrhL9QkSk=",
"owner": "epwalsh",
"repo": "obsidian.nvim",
"rev": "30f45ae3ef78b67d9eae16adfbaaf86089bd8855",
"rev": "3d459708c77f9ce7ae7165dda07812e685f30d61",
"type": "github"
},
"original": {
@ -913,11 +949,11 @@
"onedark": {
"flake": false,
"locked": {
"lastModified": 1674128456,
"narHash": "sha256-+0o32kO5lgvC2AIS7mPJ6eY/F7EWhdscZ/snkoy/TFc=",
"lastModified": 1676397581,
"narHash": "sha256-x3Tx0Spbm95M71sBvm2sVCyCIkeRSfvlC/TKcBMIwg4=",
"owner": "navarasu",
"repo": "onedark.nvim",
"rev": "f0a70e0993acbb348c32a52a88058cc60c160992",
"rev": "1fe908fb4acdcee26573e9ccde0de94ec77e5e84",
"type": "github"
},
"original": {
@ -929,11 +965,11 @@
"orgmode-nvim": {
"flake": false,
"locked": {
"lastModified": 1675278893,
"narHash": "sha256-augdRQCNMJe7Z4D8zjOYP/WjgLn2GHMc1QjVmuI17gY=",
"lastModified": 1676102032,
"narHash": "sha256-rSesMpucbNdlGVVjN5JKR9ZjfvFRxm1HqT6B5ls7KrU=",
"owner": "nvim-orgmode",
"repo": "orgmode",
"rev": "7ddbdc0741fdc90f73faa17fb332bc8700acadbf",
"rev": "313ce5a04e7fc3d677ad906a94fc49c1f54d1572",
"type": "github"
},
"original": {
@ -1014,6 +1050,7 @@
"dashboard-nvim": "dashboard-nvim",
"discord-nvim": "discord-nvim",
"dressing-nvim": "dressing-nvim",
"flake-parts": "flake-parts",
"flake-utils": "flake-utils",
"gesture-nvim": "gesture-nvim",
"gitsigns-nvim": "gitsigns-nvim",
@ -1056,7 +1093,6 @@
"rust-tools": "rust-tools",
"scrollbar-nvim": "scrollbar-nvim",
"sqls-nvim": "sqls-nvim",
"tabnine-nvim": "tabnine-nvim",
"tabular": "tabular",
"telescope": "telescope",
"tidalcycles": "tidalcycles",
@ -1115,11 +1151,11 @@
"scrollbar-nvim": {
"flake": false,
"locked": {
"lastModified": 1673562030,
"narHash": "sha256-OnVOmYhWMWH7a382DAIPEzJmz/J0BHniey7twyl500Q=",
"lastModified": 1676328140,
"narHash": "sha256-ZTU8+OPROdtkov75rvFpd3RuZ98PN1wiA7UOyPUqmw8=",
"owner": "petertriho",
"repo": "nvim-scrollbar",
"rev": "6a2065fbcd032075a06d2ab54508b69842bc4496",
"rev": "75210c554e935740448cfb532d8a671ae544bb1b",
"type": "github"
},
"original": {
@ -1161,22 +1197,6 @@
"type": "github"
}
},
"tabnine-nvim": {
"flake": false,
"locked": {
"lastModified": 1675586775,
"narHash": "sha256-7vd+moqQ5bA58VXlHSWXcJbI6ovp7z2Nf6Cn7cq08Ps=",
"owner": "codota",
"repo": "tabnine-nvim",
"rev": "85b3ad6df16ad09f8c486ec4c21defa75cebe22c",
"type": "github"
},
"original": {
"owner": "codota",
"repo": "tabnine-nvim",
"type": "github"
}
},
"tabular": {
"flake": false,
"locked": {
@ -1285,11 +1305,11 @@
"tokyonight": {
"flake": false,
"locked": {
"lastModified": 1674503926,
"narHash": "sha256-sXILXqJYZW0KywQhtBqGr76VsHV+sBnBM+RCqXCjZ2A=",
"lastModified": 1675971703,
"narHash": "sha256-RjdzV2Ia0iWeTF3AaHBMop1jZPwR3SMHasbr9Lg7StE=",
"owner": "folke",
"repo": "tokyonight.nvim",
"rev": "affb21a81e6d7de073378eb86d02864c594104d9",
"rev": "a0abe53df53616d13da327636cb0bcac3ea7f5af",
"type": "github"
},
"original": {
@ -1301,11 +1321,11 @@
"trouble": {
"flake": false,
"locked": {
"lastModified": 1674503479,
"narHash": "sha256-EdwQABmk7F7GJIB5lLcZtl1drMc0ASCXMbXoT/ywsK0=",
"lastModified": 1676045355,
"narHash": "sha256-BvynqOY42MqDEWUaf0VOA+UPdESHor/fw3fFD86ZT2U=",
"owner": "folke",
"repo": "trouble.nvim",
"rev": "490f7fe6d227f4f7a64f00be8c7dcd7a508ed271",
"rev": "556ef3089709a6e253df1e500381fec5eb48e48a",
"type": "github"
},
"original": {
@ -1445,11 +1465,11 @@
"which-key": {
"flake": false,
"locked": {
"lastModified": 1674503611,
"narHash": "sha256-A8fuY7HsfUOi9QNzWzCvaXQ2TvCNVcN2hpm5OWXYtU0=",
"lastModified": 1676049352,
"narHash": "sha256-8tFsz6y6l+0UX7H0g9t0Fvuio8aARJzFWqZc6MuPJuQ=",
"owner": "folke",
"repo": "which-key.nvim",
"rev": "684e96c5e8477f1ee9b3f2e9a12d802fd12c5531",
"rev": "5224c261825263f46f6771f1b644cae33cd06995",
"type": "github"
},
"original": {

291
flake.nix
View file

@ -2,269 +2,49 @@
description = "A neovim flake with a modular configuration";
outputs = {
nixpkgs,
flake-utils,
flake-parts,
...
} @ inputs: let
modulesWithInputs = import ./modules {inherit inputs;};
} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
neovimConfiguration = {
modules ? [],
pkgs,
lib ? pkgs.lib,
check ? true,
extraSpecialArgs ? {},
}:
modulesWithInputs {
inherit pkgs lib check extraSpecialArgs;
configuration = {...}: {
imports = modules;
imports = [
# add lib to module args
{_module.args = {inherit (nixpkgs) lib;};}
./flake/apps.nix
./flake/legacyPackages.nix
./flake/overlays.nix
./flake/packages.nix
];
flake = {
lib = {
inherit (import ./lib/stdlib-extended.nix nixpkgs.lib) nvim;
inherit (import ./extra.nix inputs) neovimConfiguration;
};
nixosModules.default = {
imports = [./lib/hm-module.nix];
nixpkgs.overlays = [
inputs.tidalcycles.overlays.default
inputs.self.overlays.default
];
};
};
nvimBin = pkg: "${pkg}/bin/nvim";
buildPkg = pkgs: modules:
(neovimConfiguration {
inherit pkgs modules;
})
.neovim;
tidalConfig = {
config = {
vim.tidal.enable = true;
perSystem = {
config,
pkgs,
...
}: {
devShells.default = pkgs.mkShell {nativeBuildInputs = [config.packages.nix];};
};
};
mainConfig = isMaximal: {
config = {
vim = {
viAlias = true;
vimAlias = true;
};
vim.lsp = {
enable = true;
formatOnSave = true;
lightbulb.enable = true;
lspsaga.enable = false;
nvimCodeActionMenu.enable = true;
trouble.enable = true;
lspSignature.enable = true;
rust.enable = isMaximal;
python = isMaximal;
clang.enable = isMaximal;
sql = isMaximal;
ts = isMaximal;
go = isMaximal;
zig.enable = isMaximal;
nix = {
enable = true;
formatter = "alejandra";
};
};
vim.visuals = {
enable = true;
nvimWebDevicons.enable = true;
scrollBar.enable = true;
smoothScroll.enable = true;
cellularAutomaton.enable = true;
lspkind.enable = true;
indentBlankline = {
enable = true;
fillChar = "";
eolChar = "";
showCurrContext = true;
};
cursorWordline = {
enable = true;
lineTimeout = 0;
};
};
vim.statusline.lualine = {
enable = true;
theme = "catppuccin";
};
vim.theme = {
enable = true;
name = "catppuccin";
style = "mocha";
};
vim.autopairs.enable = true;
vim.autocomplete = {
enable = true;
type = "nvim-cmp";
};
vim.filetree = {
nvimTreeLua = {
enable = true;
view = {
width = 25;
};
};
};
vim.tabline = {
nvimBufferline.enable = true;
};
vim.treesitter = {
enable = true;
context.enable = true;
};
vim.binds = {
whichKey.enable = true;
cheatsheet.enable = true;
};
vim.telescope = {
enable = true;
};
vim.markdown = {
enable = true;
glow.enable = true;
};
vim.git = {
enable = true;
gitsigns.enable = true;
};
vim.minimap = {
minimap-vim.enable = false;
codewindow.enable = true; # lighter, faster, and uses lua for configuration
};
vim.dashboard = {
dashboard-nvim.enable = false;
alpha.enable = true;
};
vim.notify = {
nvim-notify.enable = true;
};
vim.utility = {
colorizer.enable = true;
icon-picker.enable = true;
venn-nvim.enable = false; # FIXME throws an error when its commands are ran manually
};
vim.notes = {
obsidian.enable = false; # FIXME neovim fails to build if obsidian is enabled
orgmode.enable = true;
};
vim.terminal = {
toggleterm.enable = true;
};
vim.ui = {
noice.enable = true;
};
vim.assistant = {
copilot.enable = false;
tabnine.enable = false; # FIXME: this is not working because the plugin depends on an internal script to be ran by the package manager
};
vim.session = {
nvim-session-manager.enable = false;
};
vim.gestures = {
gesture-nvim.enable = false;
};
};
};
nixConfig = mainConfig false;
maximalConfig = mainConfig true;
in
{
lib = {
nvim = (import ./modules/lib/stdlib-extended.nix nixpkgs.lib).nvim;
inherit neovimConfiguration;
};
overlays.default = final: prev: {
inherit neovimConfiguration;
neovim-nix = buildPkg prev [nixConfig];
neovim-maximal = buildPkg prev [maximalConfig];
neovim-tidal = buildPkg prev [tidalConfig];
};
}
// (flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [
inputs.tidalcycles.overlays.default
(final: prev: {
rnix-lsp = inputs.rnix-lsp.defaultPackage.${system};
nil = inputs.nil.packages.${system}.default;
})
];
};
docs = import ./docs {
inherit pkgs;
nmdSrc = inputs.nmd;
};
tidalPkg = buildPkg pkgs [tidalConfig];
nixPkg = buildPkg pkgs [nixConfig];
maximalPkg = buildPkg pkgs [maximalConfig];
in {
apps =
rec {
nix = {
type = "app";
program = nvimBin nixPkg;
};
maximal = {
type = "app";
program = nvimBin maximalPkg;
};
default = nix;
}
// (
if !(builtins.elem system ["aarch64-darwin" "x86_64-darwin"])
then {
tidal = {
type = "app";
program = nvimBin tidalPkg;
};
}
else {}
);
devShells.default = pkgs.mkShell {nativeBuildInputs = [nixPkg];};
packages =
{
docs-html = docs.manual.html;
docs-manpages = docs.manPages;
docs-json = docs.options.json;
default = nixPkg;
nix = nixPkg;
maximal = maximalPkg;
}
// (
if !(builtins.elem system ["aarch64-darwin" "x86_64-darwin"])
then {
tidal = tidalPkg;
}
else {}
);
}));
# Flake inputs
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-utils.url = "github:numtide/flake-utils";
# For generating documentation website
@ -594,11 +374,6 @@
flake = false;
};
tabnine-nvim = {
url = "github:codota/tabnine-nvim";
flake = false;
};
# Session management
nvim-session-manager = {
url = "github:Shatur/neovim-session-manager";

21
flake/apps.nix Normal file
View file

@ -0,0 +1,21 @@
{lib, ...}: {
perSystem = {
system,
config,
...
}: {
apps =
{
nix.program = lib.getExe config.packages.nix;
maximal.program = lib.getExe config.packages.maximal;
default = config.apps.nix;
}
// (
if !(builtins.elem system ["aarch64-darwin" "x86_64-darwin"])
then {
tidal.program = lib.getExe config.packages.tidal;
}
else {}
);
};
}

19
flake/legacyPackages.nix Normal file
View file

@ -0,0 +1,19 @@
{inputs, ...}: {
perSystem = {
system,
inputs',
...
}: {
legacyPackages = import inputs.nixpkgs {
inherit system;
overlays = [
inputs.tidalcycles.overlays.default
inputs.self.overlays.default
(_: _: {
rnix-lsp = inputs'.rnix-lsp.defaultPackage;
nil = inputs'.nil.packages.default;
})
];
};
};
}

23
flake/overlays.nix Normal file
View file

@ -0,0 +1,23 @@
{inputs, ...}: let
inherit (import ../extra.nix inputs) neovimConfiguration mainConfig;
tidalConfig = {
config.vim.tidal.enable = true;
};
buildPkg = pkgs: modules:
(neovimConfiguration {
inherit pkgs modules;
})
.neovim;
nixConfig = mainConfig false;
maximalConfig = mainConfig true;
in {
flake.overlays.default = final: prev: {
inherit neovimConfiguration;
neovim-nix = buildPkg prev [nixConfig];
neovim-maximal = buildPkg prev [maximalConfig];
neovim-tidal = buildPkg prev [tidalConfig];
};
}

32
flake/packages.nix Normal file
View file

@ -0,0 +1,32 @@
{inputs, ...}: {
perSystem = {
system,
config,
pkgs,
lib,
...
}: {
packages = let
docs = import ../docs {
inherit pkgs;
nmdSrc = inputs.nmd;
};
in
{
# Documentation
docs = docs.manual.html;
docs-html = docs.manual.html;
docs-manpages = docs.manPages;
docs-json = docs.options.json;
# nvim configs
nix = config.legacyPackages.neovim-nix;
maximal = config.legacyPackages.neovim-maximal;
}
// (
if !(builtins.elem system ["aarch64-darwin" "x86_64-darwin"])
then {tidal = config.legacyPackages.neovim-tidal;}
else {}
);
};
}

View file

@ -5,14 +5,14 @@
lib ? pkgs.lib,
...
}: let
cfg = config.programs.neovim-ide;
set = pkgs.neovimBuilder {config = cfg.settings;};
cfg = config.programs.neovim-flake;
set = pkgs.neovim-maximal {mainConfig = cfg.settings;};
in
with lib; {
meta.maintainers = [maintainers.notashelf];
options.programs.neovim-ide = {
enable = mkEnableOption "NeoVim with LSP enabled for Scala, Haskell, Rust and more.";
options.programs.neovim-flake = {
enable = mkEnableOption "A NeoVim IDE with a focus on configurability and extensibility.";
settings = mkOption {
type = types.attrsOf types.anything;
@ -31,15 +31,6 @@ in
lspSignature.enable = true;
rust.enable = false;
nix = true;
dhall = true;
elm = true;
haskell = true;
scala = true;
sql = true;
python = false;
clang = false;
ts = false;
go = false;
};
}
'';

View file

@ -13,11 +13,15 @@ in {
};
config = mkIf cfg.enable {
vim.startPlugins = ["copilot-lua"];
vim.startPlugins = [
"copilot-lua"
pkgs.nodejs-slim-16_x
];
vim.luaConfigRC.copilot = nvim.dag.entryAnywhere ''
require("copilot").setup({
-- available options: https://github.com/zbirenbaum/copilot.lua
copilot_node_command = "${lib.getExe pkgs.nodejs-slim-16_x}",
})
'';
};

View file

@ -1,6 +1,6 @@
_: {
imports = [
./copilot.nix
./tabnine.nix
# ./tabnine.nix # removed until I find a way around the initialisation script the plugin requires
];
}

View file

@ -1,4 +1,4 @@
{inputs}: {
inputs: {
configuration,
pkgs,
lib ? pkgs.lib,
@ -6,10 +6,10 @@
extraSpecialArgs ? {},
}: let
inherit (pkgs) neovim-unwrapped wrapNeovim vimPlugins;
inherit (builtins) map filter isString toString getAttr hasAttr attrNames;
inherit (builtins) map filter isString toString getAttr;
inherit (pkgs.vimUtils) buildVimPluginFrom2Nix;
extendedLib = import ./lib/stdlib-extended.nix lib;
extendedLib = import ../lib/stdlib-extended.nix lib;
nvimModules = import ./modules.nix {
inherit check pkgs;