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: on:
workflow_dispatch: workflow_dispatch:
push: push:
branches:
- main
paths-ignore: paths-ignore:
- '**/README.md' - '.github/**'
- '**/.gitignore' - './assets/**'
- '**/assets' - '.gitignore'
jobs: jobs:
nix: nix:

View file

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

View file

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

View file

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

291
flake.nix
View file

@ -2,269 +2,49 @@
description = "A neovim flake with a modular configuration"; description = "A neovim flake with a modular configuration";
outputs = { outputs = {
nixpkgs, nixpkgs,
flake-utils, flake-parts,
... ...
} @ inputs: let } @ inputs:
modulesWithInputs = import ./modules {inherit inputs;}; flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
neovimConfiguration = { imports = [
modules ? [], # add lib to module args
pkgs, {_module.args = {inherit (nixpkgs) lib;};}
lib ? pkgs.lib, ./flake/apps.nix
check ? true, ./flake/legacyPackages.nix
extraSpecialArgs ? {}, ./flake/overlays.nix
}: ./flake/packages.nix
modulesWithInputs { ];
inherit pkgs lib check extraSpecialArgs;
configuration = {...}: { flake = {
imports = modules; 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"; perSystem = {
config,
buildPkg = pkgs: modules: pkgs,
(neovimConfiguration { ...
inherit pkgs modules; }: {
}) devShells.default = pkgs.mkShell {nativeBuildInputs = [config.packages.nix];};
.neovim;
tidalConfig = {
config = {
vim.tidal.enable = true;
}; };
}; };
mainConfig = isMaximal: { # Flake inputs
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 {}
);
}));
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
# For generating documentation website # For generating documentation website
@ -594,11 +374,6 @@
flake = false; flake = false;
}; };
tabnine-nvim = {
url = "github:codota/tabnine-nvim";
flake = false;
};
# Session management # Session management
nvim-session-manager = { nvim-session-manager = {
url = "github:Shatur/neovim-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, lib ? pkgs.lib,
... ...
}: let }: let
cfg = config.programs.neovim-ide; cfg = config.programs.neovim-flake;
set = pkgs.neovimBuilder {config = cfg.settings;}; set = pkgs.neovim-maximal {mainConfig = cfg.settings;};
in in
with lib; { with lib; {
meta.maintainers = [maintainers.notashelf]; meta.maintainers = [maintainers.notashelf];
options.programs.neovim-ide = { options.programs.neovim-flake = {
enable = mkEnableOption "NeoVim with LSP enabled for Scala, Haskell, Rust and more."; enable = mkEnableOption "A NeoVim IDE with a focus on configurability and extensibility.";
settings = mkOption { settings = mkOption {
type = types.attrsOf types.anything; type = types.attrsOf types.anything;
@ -31,15 +31,6 @@ in
lspSignature.enable = true; lspSignature.enable = true;
rust.enable = false; rust.enable = false;
nix = true; 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 { config = mkIf cfg.enable {
vim.startPlugins = ["copilot-lua"]; vim.startPlugins = [
"copilot-lua"
pkgs.nodejs-slim-16_x
];
vim.luaConfigRC.copilot = nvim.dag.entryAnywhere '' vim.luaConfigRC.copilot = nvim.dag.entryAnywhere ''
require("copilot").setup({ require("copilot").setup({
-- available options: https://github.com/zbirenbaum/copilot.lua -- 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 = [ imports = [
./copilot.nix ./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, configuration,
pkgs, pkgs,
lib ? pkgs.lib, lib ? pkgs.lib,
@ -6,10 +6,10 @@
extraSpecialArgs ? {}, extraSpecialArgs ? {},
}: let }: let
inherit (pkgs) neovim-unwrapped wrapNeovim vimPlugins; 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; inherit (pkgs.vimUtils) buildVimPluginFrom2Nix;
extendedLib = import ./lib/stdlib-extended.nix lib; extendedLib = import ../lib/stdlib-extended.nix lib;
nvimModules = import ./modules.nix { nvimModules = import ./modules.nix {
inherit check pkgs; inherit check pkgs;