From 89be2b9d3736483b595eb9ba92f7e3a2a89463c5 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 6 Feb 2023 21:57:35 +0300 Subject: [PATCH 01/15] refactor: move lib out of modules --- lib/booleans.nix | 9 ++++ lib/dag.nix | 107 ++++++++++++++++++++++++++++++++++++++++ lib/default.nix | 5 ++ lib/hm-module.nix | 44 +++++++++++++++++ lib/stdlib-extended.nix | 13 +++++ lib/types-dag.nix | 68 +++++++++++++++++++++++++ lib/types-plugin.nix | 81 ++++++++++++++++++++++++++++++ lib/types.nix | 7 +++ 8 files changed, 334 insertions(+) create mode 100644 lib/booleans.nix create mode 100644 lib/dag.nix create mode 100644 lib/default.nix create mode 100644 lib/hm-module.nix create mode 100644 lib/stdlib-extended.nix create mode 100644 lib/types-dag.nix create mode 100644 lib/types-plugin.nix create mode 100644 lib/types.nix diff --git a/lib/booleans.nix b/lib/booleans.nix new file mode 100644 index 0000000..277dd18 --- /dev/null +++ b/lib/booleans.nix @@ -0,0 +1,9 @@ +# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/booleans.nix +{lib}: { + # Converts a boolean to a yes/no string. This is used in lots of + # configuration formats. + yesNo = value: + if value + then "yes" + else "no"; +} diff --git a/lib/dag.nix b/lib/dag.nix new file mode 100644 index 0000000..0b392f9 --- /dev/null +++ b/lib/dag.nix @@ -0,0 +1,107 @@ +# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/dag.nix +# A generalization of Nixpkgs's `strings-with-deps.nix`. +# +# The main differences from the Nixpkgs version are +# +# - not specific to strings, i.e., any payload is OK, +# +# - the addition of the function `entryBefore` indicating a "wanted +# by" relationship. +{lib}: let + inherit (lib) all filterAttrs nvim mapAttrs toposort; +in { + empty = {}; + + isEntry = e: e ? data && e ? after && e ? before; + isDag = dag: + builtins.isAttrs dag && all nvim.dag.isEntry (builtins.attrValues dag); + + /* + Takes an attribute set containing entries built by entryAnywhere, + entryAfter, and entryBefore to a topologically sorted list of + entries. + + Internally this function uses the `toposort` function in + `` and its value is accordingly. + + Specifically, the result on success is + + { result = [ { name = ?; data = ?; } … ] } + + For example + + nix-repl> topoSort { + a = entryAnywhere "1"; + b = entryAfter [ "a" "c" ] "2"; + c = entryBefore [ "d" ] "3"; + d = entryBefore [ "e" ] "4"; + e = entryAnywhere "5"; + } == { + result = [ + { data = "1"; name = "a"; } + { data = "3"; name = "c"; } + { data = "2"; name = "b"; } + { data = "4"; name = "d"; } + { data = "5"; name = "e"; } + ]; + } + true + + And the result on error is + + { + cycle = [ { after = ?; name = ?; data = ? } … ]; + loops = [ { after = ?; name = ?; data = ? } … ]; + } + + For example + + nix-repl> topoSort { + a = entryAnywhere "1"; + b = entryAfter [ "a" "c" ] "2"; + c = entryAfter [ "d" ] "3"; + d = entryAfter [ "b" ] "4"; + e = entryAnywhere "5"; + } == { + cycle = [ + { after = [ "a" "c" ]; data = "2"; name = "b"; } + { after = [ "d" ]; data = "3"; name = "c"; } + { after = [ "b" ]; data = "4"; name = "d"; } + ]; + loops = [ + { after = [ "a" "c" ]; data = "2"; name = "b"; } + ]; + } + true + */ + topoSort = dag: let + dagBefore = dag: name: + builtins.attrNames + (filterAttrs (n: v: builtins.elem name v.before) dag); + normalizedDag = + mapAttrs (n: v: { + name = n; + data = v.data; + after = v.after ++ dagBefore dag n; + }) + dag; + before = a: b: builtins.elem a.name b.after; + sorted = toposort before (builtins.attrValues normalizedDag); + in + if sorted ? result + then { + result = map (v: {inherit (v) name data;}) sorted.result; + } + else sorted; + + # Applies a function to each element of the given DAG. + map = f: mapAttrs (n: v: v // {data = f n v.data;}); + + entryBetween = before: after: data: {inherit data before after;}; + + # Create a DAG entry with no particular dependency information. + entryAnywhere = nvim.dag.entryBetween [] []; + + entryAfter = nvim.dag.entryBetween []; + entryBefore = before: nvim.dag.entryBetween before []; +} diff --git a/lib/default.nix b/lib/default.nix new file mode 100644 index 0000000..bb4a271 --- /dev/null +++ b/lib/default.nix @@ -0,0 +1,5 @@ +{lib}: { + dag = import ./dag.nix {inherit lib;}; + booleans = import ./booleans.nix {inherit lib;}; + types = import ./types.nix {inherit lib;}; +} diff --git a/lib/hm-module.nix b/lib/hm-module.nix new file mode 100644 index 0000000..838f8c4 --- /dev/null +++ b/lib/hm-module.nix @@ -0,0 +1,44 @@ +# Home Manager module +{ + config, + pkgs, + lib ? pkgs.lib, + ... +}: let + cfg = config.programs.neovim-flake; + set = pkgs.neovim-maximal {mainConfig = cfg.settings;}; +in + with lib; { + meta.maintainers = [maintainers.notashelf]; + + options.programs.neovim-flake = { + enable = mkEnableOption "A NeoVim IDE with a focus on configurability and extensibility."; + + settings = mkOption { + type = types.attrsOf types.anything; + default = {}; + example = literalExpression '' + { + vim.viAlias = false; + vim.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 = false; + nix = true; + }; + } + ''; + description = "Attribute set of neoflake preferences."; + }; + }; + + config = mkIf cfg.enable { + home.packages = [set.neovim]; + }; + } diff --git a/lib/stdlib-extended.nix b/lib/stdlib-extended.nix new file mode 100644 index 0000000..f43bc15 --- /dev/null +++ b/lib/stdlib-extended.nix @@ -0,0 +1,13 @@ +# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/stdlib-extended.nix +# Just a convenience function that returns the given Nixpkgs standard +# library extended with the HM library. +nixpkgsLib: let + mkNvimLib = import ./.; +in + nixpkgsLib.extend (self: super: { + nvim = mkNvimLib {lib = self;}; + + # For forward compatibility. + literalExpression = super.literalExpression or super.literalExample; + literalDocBook = super.literalDocBook or super.literalExample; + }) diff --git a/lib/types-dag.nix b/lib/types-dag.nix new file mode 100644 index 0000000..439c09d --- /dev/null +++ b/lib/types-dag.nix @@ -0,0 +1,68 @@ +# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/types-dag.nix +# Used for ordering config text. +{lib}: let + inherit + (lib) + defaultFunctor + nvim + mkIf + mkOrder + mkOption + mkOptionType + types + ; + + dagEntryOf = elemType: let + submoduleType = types.submodule ({name, ...}: { + options = { + data = mkOption {type = elemType;}; + after = mkOption {type = with types; listOf str;}; + before = mkOption {type = with types; listOf str;}; + }; + config = mkIf (elemType.name == "submodule") { + data._module.args.dagName = name; + }; + }); + maybeConvert = def: + if nvim.dag.isEntry def.value + then def.value + else + nvim.dag.entryAnywhere ( + if def ? priority + then mkOrder def.priority def.value + else def.value + ); + in + mkOptionType { + name = "dagEntryOf"; + description = "DAG entry of ${elemType.description}"; + # leave the checking to the submodule type + merge = loc: defs: + submoduleType.merge loc (map (def: { + inherit (def) file; + value = maybeConvert def; + }) + defs); + }; +in rec { + # A directed acyclic graph of some inner type. + # + # Note, if the element type is a submodule then the `name` argument + # will always be set to the string "data" since it picks up the + # internal structure of the DAG values. To give access to the + # "actual" attribute name a new submodule argument is provided with + # the name `dagName`. + dagOf = elemType: let + attrEquivalent = types.attrsOf (dagEntryOf elemType); + in + mkOptionType rec { + name = "dagOf"; + description = "DAG of ${elemType.description}"; + inherit (attrEquivalent) check merge emptyValue; + getSubOptions = prefix: elemType.getSubOptions (prefix ++ [""]); + getSubModules = elemType.getSubModules; + substSubModules = m: dagOf (elemType.substSubModules m); + functor = (defaultFunctor name) // {wrapped = elemType;}; + nestedTypes.elemType = elemType; + }; +} diff --git a/lib/types-plugin.nix b/lib/types-plugin.nix new file mode 100644 index 0000000..9e31823 --- /dev/null +++ b/lib/types-plugin.nix @@ -0,0 +1,81 @@ +{lib}: +with lib; let + # Plugin must be same as input name from flake.nix + availablePlugins = [ + # TODO: sort by category + "nvim-treesitter-context" + "gitsigns-nvim" + "plenary-nvim" + "nvim-lspconfig" + "nvim-treesitter" + "lspsaga" + "lspkind" + "nvim-lightbulb" + "lsp-signature" + "nvim-tree-lua" + "nvim-bufferline-lua" + "lualine" + "nvim-compe" + "nvim-autopairs" + "nvim-ts-autotag" + "nvim-web-devicons" + "tokyonight" + "bufdelete-nvim" + "nvim-cmp" + "cmp-nvim-lsp" + "cmp-buffer" + "cmp-vsnip" + "cmp-path" + "cmp-treesitter" + "crates-nvim" + "vim-vsnip" + "nvim-code-action-menu" + "trouble" + "null-ls" + "which-key" + "indent-blankline" + "nvim-cursorline" + "sqls-nvim" + "glow-nvim" + "telescope" + "rust-tools" + "onedark" + "catppuccin" + "minimap-vim" + "dashboard-nvim" + "alpha-nvim" + "scrollbar-nvim" + "codewindow-nvim" + "nvim-notify" + "cinnamon-nvim" + "cheatsheet-nvim" + "colorizer" + "venn-nvim" + "cellular-automaton" + "presence-nvim" + "icon-picker-nvim" + "dressing-nvim" + "orgmode-nvim" + "obsidian-nvim" + "vim-markdown" + "tabular" + "toggleterm-nvim" + "noice-nvim" + "nui-nvim" + "copilot-lua" + "tabnine-nvim" + "nvim-session-manager" + "gesture-nvim" + ]; + # You can either use the name of the plugin or a package. + pluginsType = with types; listOf (nullOr (either (enum availablePlugins) package)); +in { + pluginsOpt = { + description, + default ? [], + }: + mkOption { + inherit description default; + type = pluginsType; + }; +} diff --git a/lib/types.nix b/lib/types.nix new file mode 100644 index 0000000..8625f18 --- /dev/null +++ b/lib/types.nix @@ -0,0 +1,7 @@ +{lib}: let + typesDag = import ./types-dag.nix {inherit lib;}; + typesPlugin = import ./types-plugin.nix {inherit lib;}; +in { + inherit (typesDag) dagOf; + inherit (typesPlugin) pluginsOpt; +} From 4874df92b67754f386c66126ab2b3ac8f0198ca3 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 6 Feb 2023 21:57:52 +0300 Subject: [PATCH 02/15] refactor: prepare for home-manager module & cleanup --- flake.nix | 128 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 72 insertions(+), 56 deletions(-) diff --git a/flake.nix b/flake.nix index 49fc1ec..18cdb89 100644 --- a/flake.nix +++ b/flake.nix @@ -189,7 +189,7 @@ in { lib = { - nvim = (import ./modules/lib/stdlib-extended.nix nixpkgs.lib).nvim; + nvim = (import ./lib/stdlib-extended.nix nixpkgs.lib).nvim; inherit neovimConfiguration; }; @@ -200,69 +200,85 @@ 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; - }) - ]; - }; + // (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; - }; + 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 = { + # Available Configurations + tidalPkg = buildPkg pkgs [tidalConfig]; + nixPkg = buildPkg pkgs [nixConfig]; + maximalPkg = buildPkg pkgs [maximalConfig]; + in { + apps = + rec { + nix = { type = "app"; - program = nvimBin tidalPkg; + program = nvimBin nixPkg; }; + maximal = { + type = "app"; + program = nvimBin maximalPkg; + }; + default = nix; } - else {} - ); + // ( + if !(builtins.elem system ["aarch64-darwin" "x86_64-darwin"]) + then { + tidal = { + type = "app"; + program = nvimBin tidalPkg; + }; + } + else {} + ); - devShells.default = pkgs.mkShell {nativeBuildInputs = [nixPkg];}; + 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; + packages = + { + # Documentation + docs = docs.manual.html; + docs-html = docs.manual.html; + docs-manpages = docs.manPages; + docs-json = docs.options.json; + + # Available Configurations + default = nixPkg; + nix = nixPkg; + maximal = maximalPkg; } - else {} - ); - })); + // ( + if !(builtins.elem system ["aarch64-darwin" "x86_64-darwin"]) + then { + tidal = tidalPkg; + } + else {} + ); + + nixosModules.hm-module = { + imports = [ + ./lib/hm.nix + # {nixpkgs.overlays = [inputs.self.overlays.default];} what? + ]; + }; + } + )); + + # Flake inputs inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; flake-utils.url = "github:numtide/flake-utils"; From c2b0b6a053118e21464c4c1244a96f46300a8422 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 6 Feb 2023 21:58:09 +0300 Subject: [PATCH 03/15] docs: update manpages [2/3] --- docs/default.nix | 2 +- docs/home-manager.adoc | 42 ++++++++++++++++++++++++++++++++++++++++++ docs/manual.xml | 1 + 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 docs/home-manager.adoc diff --git a/docs/default.nix b/docs/default.nix index 6cf73dc..683dc9c 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -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;}; diff --git a/docs/home-manager.adoc b/docs/home-manager.adoc new file mode 100644 index 0000000..ed85f90 --- /dev/null +++ b/docs/home-manager.adoc @@ -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; + }; + }; + }; +} +---- diff --git a/docs/manual.xml b/docs/manual.xml index 4f33e91..a03698f 100644 --- a/docs/manual.xml +++ b/docs/manual.xml @@ -19,6 +19,7 @@ + From 7db1f6779c5c42520a6ee32f58d207c3f1d8199a Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 6 Feb 2023 21:58:23 +0300 Subject: [PATCH 04/15] refactor: move lib out of modules --- modules/default.nix | 2 +- modules/lib/booleans.nix | 9 --- modules/lib/dag.nix | 107 -------------------------------- modules/lib/default.nix | 5 -- modules/lib/hm.nix | 53 ---------------- modules/lib/stdlib-extended.nix | 13 ---- modules/lib/types-dag.nix | 68 -------------------- modules/lib/types-plugin.nix | 81 ------------------------ modules/lib/types.nix | 7 --- 9 files changed, 1 insertion(+), 344 deletions(-) delete mode 100644 modules/lib/booleans.nix delete mode 100644 modules/lib/dag.nix delete mode 100644 modules/lib/default.nix delete mode 100644 modules/lib/hm.nix delete mode 100644 modules/lib/stdlib-extended.nix delete mode 100644 modules/lib/types-dag.nix delete mode 100644 modules/lib/types-plugin.nix delete mode 100644 modules/lib/types.nix diff --git a/modules/default.nix b/modules/default.nix index 5c1e08c..edf22bd 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -9,7 +9,7 @@ inherit (builtins) map filter isString toString getAttr hasAttr attrNames; 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; diff --git a/modules/lib/booleans.nix b/modules/lib/booleans.nix deleted file mode 100644 index 277dd18..0000000 --- a/modules/lib/booleans.nix +++ /dev/null @@ -1,9 +0,0 @@ -# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/booleans.nix -{lib}: { - # Converts a boolean to a yes/no string. This is used in lots of - # configuration formats. - yesNo = value: - if value - then "yes" - else "no"; -} diff --git a/modules/lib/dag.nix b/modules/lib/dag.nix deleted file mode 100644 index 0b392f9..0000000 --- a/modules/lib/dag.nix +++ /dev/null @@ -1,107 +0,0 @@ -# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/dag.nix -# A generalization of Nixpkgs's `strings-with-deps.nix`. -# -# The main differences from the Nixpkgs version are -# -# - not specific to strings, i.e., any payload is OK, -# -# - the addition of the function `entryBefore` indicating a "wanted -# by" relationship. -{lib}: let - inherit (lib) all filterAttrs nvim mapAttrs toposort; -in { - empty = {}; - - isEntry = e: e ? data && e ? after && e ? before; - isDag = dag: - builtins.isAttrs dag && all nvim.dag.isEntry (builtins.attrValues dag); - - /* - Takes an attribute set containing entries built by entryAnywhere, - entryAfter, and entryBefore to a topologically sorted list of - entries. - - Internally this function uses the `toposort` function in - `` and its value is accordingly. - - Specifically, the result on success is - - { result = [ { name = ?; data = ?; } … ] } - - For example - - nix-repl> topoSort { - a = entryAnywhere "1"; - b = entryAfter [ "a" "c" ] "2"; - c = entryBefore [ "d" ] "3"; - d = entryBefore [ "e" ] "4"; - e = entryAnywhere "5"; - } == { - result = [ - { data = "1"; name = "a"; } - { data = "3"; name = "c"; } - { data = "2"; name = "b"; } - { data = "4"; name = "d"; } - { data = "5"; name = "e"; } - ]; - } - true - - And the result on error is - - { - cycle = [ { after = ?; name = ?; data = ? } … ]; - loops = [ { after = ?; name = ?; data = ? } … ]; - } - - For example - - nix-repl> topoSort { - a = entryAnywhere "1"; - b = entryAfter [ "a" "c" ] "2"; - c = entryAfter [ "d" ] "3"; - d = entryAfter [ "b" ] "4"; - e = entryAnywhere "5"; - } == { - cycle = [ - { after = [ "a" "c" ]; data = "2"; name = "b"; } - { after = [ "d" ]; data = "3"; name = "c"; } - { after = [ "b" ]; data = "4"; name = "d"; } - ]; - loops = [ - { after = [ "a" "c" ]; data = "2"; name = "b"; } - ]; - } - true - */ - topoSort = dag: let - dagBefore = dag: name: - builtins.attrNames - (filterAttrs (n: v: builtins.elem name v.before) dag); - normalizedDag = - mapAttrs (n: v: { - name = n; - data = v.data; - after = v.after ++ dagBefore dag n; - }) - dag; - before = a: b: builtins.elem a.name b.after; - sorted = toposort before (builtins.attrValues normalizedDag); - in - if sorted ? result - then { - result = map (v: {inherit (v) name data;}) sorted.result; - } - else sorted; - - # Applies a function to each element of the given DAG. - map = f: mapAttrs (n: v: v // {data = f n v.data;}); - - entryBetween = before: after: data: {inherit data before after;}; - - # Create a DAG entry with no particular dependency information. - entryAnywhere = nvim.dag.entryBetween [] []; - - entryAfter = nvim.dag.entryBetween []; - entryBefore = before: nvim.dag.entryBetween before []; -} diff --git a/modules/lib/default.nix b/modules/lib/default.nix deleted file mode 100644 index bb4a271..0000000 --- a/modules/lib/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -{lib}: { - dag = import ./dag.nix {inherit lib;}; - booleans = import ./booleans.nix {inherit lib;}; - types = import ./types.nix {inherit lib;}; -} diff --git a/modules/lib/hm.nix b/modules/lib/hm.nix deleted file mode 100644 index b5f5932..0000000 --- a/modules/lib/hm.nix +++ /dev/null @@ -1,53 +0,0 @@ -# Home Manager module -{ - config, - pkgs, - lib ? pkgs.lib, - ... -}: let - cfg = config.programs.neovim-ide; - set = pkgs.neovimBuilder {config = 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."; - - settings = mkOption { - type = types.attrsOf types.anything; - default = {}; - example = literalExpression '' - { - vim.viAlias = false; - vim.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 = false; - nix = true; - dhall = true; - elm = true; - haskell = true; - scala = true; - sql = true; - python = false; - clang = false; - ts = false; - go = false; - }; - } - ''; - description = "Attribute set of neoflake preferences."; - }; - }; - - config = mkIf cfg.enable { - home.packages = [set.neovim]; - }; - } diff --git a/modules/lib/stdlib-extended.nix b/modules/lib/stdlib-extended.nix deleted file mode 100644 index f43bc15..0000000 --- a/modules/lib/stdlib-extended.nix +++ /dev/null @@ -1,13 +0,0 @@ -# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/stdlib-extended.nix -# Just a convenience function that returns the given Nixpkgs standard -# library extended with the HM library. -nixpkgsLib: let - mkNvimLib = import ./.; -in - nixpkgsLib.extend (self: super: { - nvim = mkNvimLib {lib = self;}; - - # For forward compatibility. - literalExpression = super.literalExpression or super.literalExample; - literalDocBook = super.literalDocBook or super.literalExample; - }) diff --git a/modules/lib/types-dag.nix b/modules/lib/types-dag.nix deleted file mode 100644 index 439c09d..0000000 --- a/modules/lib/types-dag.nix +++ /dev/null @@ -1,68 +0,0 @@ -# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/types-dag.nix -# Used for ordering config text. -{lib}: let - inherit - (lib) - defaultFunctor - nvim - mkIf - mkOrder - mkOption - mkOptionType - types - ; - - dagEntryOf = elemType: let - submoduleType = types.submodule ({name, ...}: { - options = { - data = mkOption {type = elemType;}; - after = mkOption {type = with types; listOf str;}; - before = mkOption {type = with types; listOf str;}; - }; - config = mkIf (elemType.name == "submodule") { - data._module.args.dagName = name; - }; - }); - maybeConvert = def: - if nvim.dag.isEntry def.value - then def.value - else - nvim.dag.entryAnywhere ( - if def ? priority - then mkOrder def.priority def.value - else def.value - ); - in - mkOptionType { - name = "dagEntryOf"; - description = "DAG entry of ${elemType.description}"; - # leave the checking to the submodule type - merge = loc: defs: - submoduleType.merge loc (map (def: { - inherit (def) file; - value = maybeConvert def; - }) - defs); - }; -in rec { - # A directed acyclic graph of some inner type. - # - # Note, if the element type is a submodule then the `name` argument - # will always be set to the string "data" since it picks up the - # internal structure of the DAG values. To give access to the - # "actual" attribute name a new submodule argument is provided with - # the name `dagName`. - dagOf = elemType: let - attrEquivalent = types.attrsOf (dagEntryOf elemType); - in - mkOptionType rec { - name = "dagOf"; - description = "DAG of ${elemType.description}"; - inherit (attrEquivalent) check merge emptyValue; - getSubOptions = prefix: elemType.getSubOptions (prefix ++ [""]); - getSubModules = elemType.getSubModules; - substSubModules = m: dagOf (elemType.substSubModules m); - functor = (defaultFunctor name) // {wrapped = elemType;}; - nestedTypes.elemType = elemType; - }; -} diff --git a/modules/lib/types-plugin.nix b/modules/lib/types-plugin.nix deleted file mode 100644 index 9e31823..0000000 --- a/modules/lib/types-plugin.nix +++ /dev/null @@ -1,81 +0,0 @@ -{lib}: -with lib; let - # Plugin must be same as input name from flake.nix - availablePlugins = [ - # TODO: sort by category - "nvim-treesitter-context" - "gitsigns-nvim" - "plenary-nvim" - "nvim-lspconfig" - "nvim-treesitter" - "lspsaga" - "lspkind" - "nvim-lightbulb" - "lsp-signature" - "nvim-tree-lua" - "nvim-bufferline-lua" - "lualine" - "nvim-compe" - "nvim-autopairs" - "nvim-ts-autotag" - "nvim-web-devicons" - "tokyonight" - "bufdelete-nvim" - "nvim-cmp" - "cmp-nvim-lsp" - "cmp-buffer" - "cmp-vsnip" - "cmp-path" - "cmp-treesitter" - "crates-nvim" - "vim-vsnip" - "nvim-code-action-menu" - "trouble" - "null-ls" - "which-key" - "indent-blankline" - "nvim-cursorline" - "sqls-nvim" - "glow-nvim" - "telescope" - "rust-tools" - "onedark" - "catppuccin" - "minimap-vim" - "dashboard-nvim" - "alpha-nvim" - "scrollbar-nvim" - "codewindow-nvim" - "nvim-notify" - "cinnamon-nvim" - "cheatsheet-nvim" - "colorizer" - "venn-nvim" - "cellular-automaton" - "presence-nvim" - "icon-picker-nvim" - "dressing-nvim" - "orgmode-nvim" - "obsidian-nvim" - "vim-markdown" - "tabular" - "toggleterm-nvim" - "noice-nvim" - "nui-nvim" - "copilot-lua" - "tabnine-nvim" - "nvim-session-manager" - "gesture-nvim" - ]; - # You can either use the name of the plugin or a package. - pluginsType = with types; listOf (nullOr (either (enum availablePlugins) package)); -in { - pluginsOpt = { - description, - default ? [], - }: - mkOption { - inherit description default; - type = pluginsType; - }; -} diff --git a/modules/lib/types.nix b/modules/lib/types.nix deleted file mode 100644 index 8625f18..0000000 --- a/modules/lib/types.nix +++ /dev/null @@ -1,7 +0,0 @@ -{lib}: let - typesDag = import ./types-dag.nix {inherit lib;}; - typesPlugin = import ./types-plugin.nix {inherit lib;}; -in { - inherit (typesDag) dagOf; - inherit (typesPlugin) pluginsOpt; -} From 6694b65c8260d38df5bd60644eeaf7aa977f1ac7 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 6 Feb 2023 22:02:44 +0300 Subject: [PATCH 05/15] dev: should reduce CI build times --- .github/workflows/cachix.yml | 8 +++++--- .github/workflows/check.yml | 4 ++-- .github/workflows/manual.yml | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cachix.yml b/.github/workflows/cachix.yml index 47bd48f..624e8c9 100644 --- a/.github/workflows/cachix.yml +++ b/.github/workflows/cachix.yml @@ -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: diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 4dd7870..cea124a 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -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 diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml index ff3153c..9dbd0b7 100644 --- a/.github/workflows/manual.yml +++ b/.github/workflows/manual.yml @@ -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 From 885a43f6e7cabf0b3a281b479314b26bf119dd96 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Tue, 7 Feb 2023 14:03:21 +0200 Subject: [PATCH 06/15] flake.nix: transition to flake-parts --- extra.nix | 168 ++++++++++++++++++++++++++++++++ flake.lock | 37 +++++++ flake.nix | 275 ++++++++++------------------------------------------- 3 files changed, 255 insertions(+), 225 deletions(-) create mode 100644 extra.nix diff --git a/extra.nix b/extra.nix new file mode 100644 index 0000000..bd5e705 --- /dev/null +++ b/extra.nix @@ -0,0 +1,168 @@ +inputs: let + modulesWithInputs = import ./modules {inherit 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 = 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; + }; + }; + }; +in { + inherit neovimConfiguration mainConfig; +} diff --git a/flake.lock b/flake.lock index 0c74fd2..97fc37c 100644 --- a/flake.lock +++ b/flake.lock @@ -305,6 +305,24 @@ "type": "github" } }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1675295133, + "narHash": "sha256-dU8fuLL98WFXG0VnRgM00bqKX6CEPBLybhiIDIgO45o=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "bf53492df08f3178ce85e0c9df8ed8d03c030c9f", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "locked": { "lastModified": 1667395993, @@ -557,6 +575,24 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1672350804, + "narHash": "sha256-jo6zkiCabUBn3ObuKXHGqqORUMH27gYDIFFfLq5P4wg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "677ed08a50931e38382dbef01cba08a8f7eac8f6", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1656753965, @@ -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", diff --git a/flake.nix b/flake.nix index 18cdb89..287688d 100644 --- a/flake.nix +++ b/flake.nix @@ -2,26 +2,11 @@ description = "A neovim flake with a modular configuration"; outputs = { nixpkgs, - flake-utils, + flake-parts, ... } @ inputs: let - modulesWithInputs = import ./modules {inherit inputs;}; - - neovimConfiguration = { - modules ? [], - pkgs, - lib ? pkgs.lib, - check ? true, - extraSpecialArgs ? {}, - }: - modulesWithInputs { - inherit pkgs lib check extraSpecialArgs; - configuration = {...}: { - imports = modules; - }; - }; - - nvimBin = pkg: "${pkg}/bin/nvim"; + inherit (nixpkgs) lib; + inherit (import ./extra.nix inputs) neovimConfiguration mainConfig; buildPkg = pkgs: modules: (neovimConfiguration { @@ -30,179 +15,42 @@ .neovim; tidalConfig = { - config = { - vim.tidal.enable = true; - }; - }; - - 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; - }; - }; + config.vim.tidal.enable = true; }; nixConfig = mainConfig false; maximalConfig = mainConfig true; in - { - lib = { - nvim = (import ./lib/stdlib-extended.nix nixpkgs.lib).nvim; - inherit neovimConfiguration; + flake-parts.lib.mkFlake {inherit inputs;} { + systems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]; + + flake = { + lib = { + nvim = (import ./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]; + }; + + nixosModules.hm-module = { + imports = [ + ./lib/hm.nix + # {nixpkgs.overlays = [inputs.self.overlays.default];} what? + ]; + }; }; - 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 { + perSystem = { + system, + self', + ... + }: { + legacyPackages = import nixpkgs { inherit system; overlays = [ inputs.tidalcycles.overlays.default @@ -213,42 +61,28 @@ ]; }; - docs = import ./docs { - inherit pkgs; - nmdSrc = inputs.nmd; - }; - - # Available Configurations - 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; + { + nix.program = lib.getExe self'.packages.nix; + maximal.program = lib.getExe self'.packages.maximal; + default = self'.apps.nix; } // ( if !(builtins.elem system ["aarch64-darwin" "x86_64-darwin"]) then { - tidal = { - type = "app"; - program = nvimBin tidalPkg; - }; + tidal.program = lib.getExe self'.packages.tidal; } else {} ); - devShells.default = pkgs.mkShell {nativeBuildInputs = [nixPkg];}; + devShells.default = self'.legacyPackages.mkShell {nativeBuildInputs = [self'.packages.nix];}; - packages = + packages = let + docs = import ./docs { + pkgs = self'.legacyPackages; + nmdSrc = inputs.nmd; + }; + in { # Documentation docs = docs.manual.html; @@ -257,31 +91,22 @@ docs-json = docs.options.json; # Available Configurations - default = nixPkg; - nix = nixPkg; - maximal = maximalPkg; + nix = buildPkg self'.legacyPackages [nixConfig]; + maximal = buildPkg self'.legacyPackages [maximalConfig]; } // ( if !(builtins.elem system ["aarch64-darwin" "x86_64-darwin"]) - then { - tidal = tidalPkg; - } + then {tidal = buildPkg self'.legacyPackages [tidalConfig];} else {} ); - - nixosModules.hm-module = { - imports = [ - ./lib/hm.nix - # {nixpkgs.overlays = [inputs.self.overlays.default];} what? - ]; - }; - } - )); + }; + }; # Flake inputs inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; flake-utils.url = "github:numtide/flake-utils"; + flake-parts.url = "github:hercules-ci/flake-parts"; # For generating documentation website nmd = { From c759ae02f59198b03a5788f7c825553ac8e7e1db Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Fri, 10 Feb 2023 19:39:31 +0200 Subject: [PATCH 07/15] simplify things --- extra.nix | 6 ++---- flake.nix | 11 +++++------ modules/default.nix | 4 ++-- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/extra.nix b/extra.nix index bd5e705..620efe1 100644 --- a/extra.nix +++ b/extra.nix @@ -1,5 +1,5 @@ inputs: let - modulesWithInputs = import ./modules {inherit inputs;}; + modulesWithInputs = import ./modules inputs; neovimConfiguration = { modules ? [], @@ -10,9 +10,7 @@ inputs: let }: modulesWithInputs { inherit pkgs lib check extraSpecialArgs; - configuration = {...}: { - imports = modules; - }; + configuration.imports = modules; }; mainConfig = isMaximal: { diff --git a/flake.nix b/flake.nix index 287688d..2483c76 100644 --- a/flake.nix +++ b/flake.nix @@ -5,19 +5,18 @@ flake-parts, ... } @ inputs: let - inherit (nixpkgs) lib; inherit (import ./extra.nix inputs) neovimConfiguration mainConfig; + tidalConfig = { + config.vim.tidal.enable = true; + }; + buildPkg = pkgs: modules: (neovimConfiguration { inherit pkgs modules; }) .neovim; - tidalConfig = { - config.vim.tidal.enable = true; - }; - nixConfig = mainConfig false; maximalConfig = mainConfig true; in @@ -26,7 +25,7 @@ flake = { lib = { - nvim = (import ./lib/stdlib-extended.nix nixpkgs.lib).nvim; + inherit (import ./lib/stdlib-extended.nix nixpkgs.lib) nvim; inherit neovimConfiguration; }; diff --git a/modules/default.nix b/modules/default.nix index edf22bd..d8b4515 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,4 +1,4 @@ -{inputs}: { +inputs: { configuration, pkgs, lib ? pkgs.lib, @@ -6,7 +6,7 @@ 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; From 2f84ce13c41715a85eb71dbebd929ef00a4a02ab Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Fri, 10 Feb 2023 19:40:13 +0200 Subject: [PATCH 08/15] flake.nix: modularize (pt 1) --- flake.nix | 77 ++++++++++------------------------------ flake/apps.nix | 21 +++++++++++ flake/legacyPackages.nix | 19 ++++++++++ flake/packages.nix | 65 +++++++++++++++++++++++++++++++++ 4 files changed, 124 insertions(+), 58 deletions(-) create mode 100644 flake/apps.nix create mode 100644 flake/legacyPackages.nix create mode 100644 flake/packages.nix diff --git a/flake.nix b/flake.nix index 2483c76..7f79390 100644 --- a/flake.nix +++ b/flake.nix @@ -23,81 +23,42 @@ flake-parts.lib.mkFlake {inherit inputs;} { systems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]; + imports = [ + # add lib to module args + {_module.args = {inherit (nixpkgs) lib;};} + ./flake/apps.nix + ./flake/legacyPackages.nix + ./flake/packages.nix + ]; + flake = { lib = { inherit (import ./lib/stdlib-extended.nix nixpkgs.lib) nvim; inherit neovimConfiguration; }; + nixosModules.default = { + imports = [./lib/hm-module.nix]; + nixpkgs.overlays = [ + inputs.tidalcycles.overlays.default + inputs.self.overlays.default + ]; + }; + overlays.default = final: prev: { inherit neovimConfiguration; neovim-nix = buildPkg prev [nixConfig]; neovim-maximal = buildPkg prev [maximalConfig]; neovim-tidal = buildPkg prev [tidalConfig]; }; - - nixosModules.hm-module = { - imports = [ - ./lib/hm.nix - # {nixpkgs.overlays = [inputs.self.overlays.default];} what? - ]; - }; }; perSystem = { - system, - self', + config, + pkgs, ... }: { - legacyPackages = import nixpkgs { - inherit system; - overlays = [ - inputs.tidalcycles.overlays.default - (final: prev: { - rnix-lsp = inputs.rnix-lsp.defaultPackage.${system}; - nil = inputs.nil.packages.${system}.default; - }) - ]; - }; - - apps = - { - nix.program = lib.getExe self'.packages.nix; - maximal.program = lib.getExe self'.packages.maximal; - default = self'.apps.nix; - } - // ( - if !(builtins.elem system ["aarch64-darwin" "x86_64-darwin"]) - then { - tidal.program = lib.getExe self'.packages.tidal; - } - else {} - ); - - devShells.default = self'.legacyPackages.mkShell {nativeBuildInputs = [self'.packages.nix];}; - - packages = let - docs = import ./docs { - pkgs = self'.legacyPackages; - nmdSrc = inputs.nmd; - }; - in - { - # Documentation - docs = docs.manual.html; - docs-html = docs.manual.html; - docs-manpages = docs.manPages; - docs-json = docs.options.json; - - # Available Configurations - nix = buildPkg self'.legacyPackages [nixConfig]; - maximal = buildPkg self'.legacyPackages [maximalConfig]; - } - // ( - if !(builtins.elem system ["aarch64-darwin" "x86_64-darwin"]) - then {tidal = buildPkg self'.legacyPackages [tidalConfig];} - else {} - ); + devShells.default = pkgs.mkShell {nativeBuildInputs = [config.packages.nix];}; }; }; diff --git a/flake/apps.nix b/flake/apps.nix new file mode 100644 index 0000000..6b53adf --- /dev/null +++ b/flake/apps.nix @@ -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 {} + ); + }; +} diff --git a/flake/legacyPackages.nix b/flake/legacyPackages.nix new file mode 100644 index 0000000..d6fb73c --- /dev/null +++ b/flake/legacyPackages.nix @@ -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; + }) + ]; + }; + }; +} diff --git a/flake/packages.nix b/flake/packages.nix new file mode 100644 index 0000000..1aff130 --- /dev/null +++ b/flake/packages.nix @@ -0,0 +1,65 @@ +{inputs, ...}: { + # imports = [ + # inputs.flake-parts.flakeModules.easyOverlay + # ]; + + perSystem = { + system, + pkgs, + config, + ... + }: 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 { + # overlayAttrs = + # { + # inherit neovimConfiguration; + # neovim-nix = config.packages.nix; + # neovim-maximal = config.packages.maximal; + # } + # // ( + # if !(builtins.elem system ["aarch64-darwin" "x86_64-darwin"]) + # then {neovim-tidal = config.packages.tidal;} + # else {} + # ); + + 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 = buildPkg pkgs [nixConfig]; + # maximal = buildPkg pkgs [maximalConfig]; + nix = config.legacyPackages.neovim-nix; + maximal = config.legacyPackages.neovim-maximal; + } + // ( + if !(builtins.elem system ["aarch64-darwin" "x86_64-darwin"]) + # then {tidal = buildPkg pkgs [tidalConfig];} + then {tidal = config.legacyPackages.neovim-tidal;} + else {} + ); + }; +} From a946045a7c2477b89a40c64a8c3ffdb6cd28b7a7 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Fri, 10 Feb 2023 19:45:23 +0200 Subject: [PATCH 09/15] flake.nix: split overlays --- flake.nix | 27 +++------------------------ flake/overlays.nix | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 24 deletions(-) create mode 100644 flake/overlays.nix diff --git a/flake.nix b/flake.nix index 7f79390..764f8c3 100644 --- a/flake.nix +++ b/flake.nix @@ -4,22 +4,7 @@ nixpkgs, flake-parts, ... - } @ 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 + } @ inputs: flake-parts.lib.mkFlake {inherit inputs;} { systems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]; @@ -28,13 +13,14 @@ {_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 neovimConfiguration; + inherit (import ./extra.nix inputs) neovimConfiguration; }; nixosModules.default = { @@ -44,13 +30,6 @@ inputs.self.overlays.default ]; }; - - overlays.default = final: prev: { - inherit neovimConfiguration; - neovim-nix = buildPkg prev [nixConfig]; - neovim-maximal = buildPkg prev [maximalConfig]; - neovim-tidal = buildPkg prev [tidalConfig]; - }; }; perSystem = { diff --git a/flake/overlays.nix b/flake/overlays.nix new file mode 100644 index 0000000..44002b5 --- /dev/null +++ b/flake/overlays.nix @@ -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]; + }; +} From 37d05187dfc9c0cc98f3af57e47dd9d35e0df366 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Fri, 10 Feb 2023 19:50:20 +0200 Subject: [PATCH 10/15] packages.nix: niceify --- flake/packages.nix | 39 +++------------------------------------ 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/flake/packages.nix b/flake/packages.nix index 1aff130..b43f964 100644 --- a/flake/packages.nix +++ b/flake/packages.nix @@ -1,41 +1,11 @@ {inputs, ...}: { - # imports = [ - # inputs.flake-parts.flakeModules.easyOverlay - # ]; - perSystem = { system, - pkgs, config, + pkgs, + lib, ... - }: 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 { - # overlayAttrs = - # { - # inherit neovimConfiguration; - # neovim-nix = config.packages.nix; - # neovim-maximal = config.packages.maximal; - # } - # // ( - # if !(builtins.elem system ["aarch64-darwin" "x86_64-darwin"]) - # then {neovim-tidal = config.packages.tidal;} - # else {} - # ); - + }: { packages = let docs = import ../docs { inherit pkgs; @@ -50,14 +20,11 @@ docs-json = docs.options.json; # nvim configs - # nix = buildPkg pkgs [nixConfig]; - # maximal = buildPkg pkgs [maximalConfig]; nix = config.legacyPackages.neovim-nix; maximal = config.legacyPackages.neovim-maximal; } // ( if !(builtins.elem system ["aarch64-darwin" "x86_64-darwin"]) - # then {tidal = buildPkg pkgs [tidalConfig];} then {tidal = config.legacyPackages.neovim-tidal;} else {} ); From ffc891ebc62ab1e740121ef901447466113b7d63 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 15 Feb 2023 11:38:36 +0300 Subject: [PATCH 11/15] dev: remove tabnine --- flake.nix | 6 ------ 1 file changed, 6 deletions(-) diff --git a/flake.nix b/flake.nix index 764f8c3..7f1b974 100644 --- a/flake.nix +++ b/flake.nix @@ -44,7 +44,6 @@ # Flake inputs inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; - flake-utils.url = "github:numtide/flake-utils"; flake-parts.url = "github:hercules-ci/flake-parts"; # For generating documentation website @@ -374,11 +373,6 @@ flake = false; }; - tabnine-nvim = { - url = "github:codota/tabnine-nvim"; - flake = false; - }; - # Session management nvim-session-manager = { url = "github:Shatur/neovim-session-manager"; From 90443139511230e46a6f709b1565fb91fb8f2905 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 15 Feb 2023 11:45:28 +0300 Subject: [PATCH 12/15] feat: update flake --- flake.lock | 191 ++++++++++++++++++++++++----------------------------- 1 file changed, 87 insertions(+), 104 deletions(-) diff --git a/flake.lock b/flake.lock index 97fc37c..6a6a1da 100644 --- a/flake.lock +++ b/flake.lock @@ -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": { @@ -310,11 +310,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1675295133, - "narHash": "sha256-dU8fuLL98WFXG0VnRgM00bqKX6CEPBLybhiIDIgO45o=", + "lastModified": 1675933616, + "narHash": "sha256-/rczJkJHtx16IFxMmAWu5nNYcSXNg1YYXTHoGjLrLUA=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "bf53492df08f3178ce85e0c9df8ed8d03c030c9f", + "rev": "47478a4a003e745402acf63be7f9a092d51b83d7", "type": "github" }, "original": { @@ -325,11 +325,11 @@ }, "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": { @@ -357,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": { @@ -373,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": { @@ -485,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": { @@ -546,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": { @@ -561,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": { @@ -578,11 +578,11 @@ "nixpkgs-lib": { "locked": { "dir": "lib", - "lastModified": 1672350804, - "narHash": "sha256-jo6zkiCabUBn3ObuKXHGqqORUMH27gYDIFFfLq5P4wg=", + "lastModified": 1675183161, + "narHash": "sha256-Zq8sNgAxDckpn7tJo7V1afRSk2eoVbu3OjI1QklGLNg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "677ed08a50931e38382dbef01cba08a8f7eac8f6", + "rev": "e1e1b192c1a5aab2960bf0a0bd53a2e8124fa18e", "type": "github" }, "original": { @@ -628,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": { @@ -644,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": { @@ -676,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": { @@ -692,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": { @@ -725,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": { @@ -805,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": { @@ -869,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": { @@ -917,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": { @@ -933,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": { @@ -949,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": { @@ -965,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": { @@ -1093,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", @@ -1152,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": { @@ -1198,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": { @@ -1322,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": { @@ -1338,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": { @@ -1482,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": { From 71f4c7ecd4e1e384fe126a573425d7cae606a83d Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 15 Feb 2023 11:46:29 +0300 Subject: [PATCH 13/15] fix: re-add flake-utils to inputs --- flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/flake.nix b/flake.nix index 7f1b974..7a51bfb 100644 --- a/flake.nix +++ b/flake.nix @@ -45,6 +45,7 @@ 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 nmd = { From 107b572e1ccf0d189e34931f2c4cfa40ad085722 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 15 Feb 2023 11:47:08 +0300 Subject: [PATCH 14/15] feat: bundle nodejs_16 slim with copilot & move copilot to maximal --- extra.nix | 4 ++-- modules/assistant/copilot.nix | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/extra.nix b/extra.nix index 620efe1..1cdeda2 100644 --- a/extra.nix +++ b/extra.nix @@ -148,8 +148,8 @@ inputs: let }; 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 + 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 = { diff --git a/modules/assistant/copilot.nix b/modules/assistant/copilot.nix index c6bb1ec..b15d262 100644 --- a/modules/assistant/copilot.nix +++ b/modules/assistant/copilot.nix @@ -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}", }) ''; }; From 1b51ed7e1472886e92ba4240070b5c401f8077e4 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 15 Feb 2023 11:47:48 +0300 Subject: [PATCH 15/15] feat: remove tabnine module due anti-nix script execution --- modules/assistant/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/assistant/default.nix b/modules/assistant/default.nix index 3ae3509..68128af 100644 --- a/modules/assistant/default.nix +++ b/modules/assistant/default.nix @@ -1,6 +1,6 @@ _: { imports = [ ./copilot.nix - ./tabnine.nix + # ./tabnine.nix # removed until I find a way around the initialisation script the plugin requires ]; }