From 849596e7938a9c00b6a4cca54429fbe68ee5b3f4 Mon Sep 17 00:00:00 2001 From: b4mbus Date: Sun, 26 May 2024 21:51:22 +0200 Subject: [PATCH 01/11] ref(nix): make luarc-with-dependencies an overlay --- flake.nix | 44 ++++++++++------------------------------ nix/overlays/default.nix | 29 ++++++++++++++++++++++++++ nix/overlays/luarc.nix | 35 ++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 33 deletions(-) create mode 100644 nix/overlays/default.nix create mode 100644 nix/overlays/luarc.nix diff --git a/flake.nix b/flake.nix index dd45125f8..5f6922cb1 100644 --- a/flake.nix +++ b/flake.nix @@ -29,6 +29,15 @@ "x86_64-darwin" "aarch64-darwin" ]; + + _module.args = { + inherit gen-luarc; + }; + + imports = [ + ./nix/overlays + ]; + perSystem = { config, self', @@ -38,37 +47,6 @@ lib, ... }: let - pkgs = import nixpkgs { - inherit system; - overlays = [ - gen-luarc.overlays.default - ]; - }; - dependencies = builtins.fromJSON (builtins.readFile ./res/deps.json); - install-dependencies = - pkgs.runCommand "install-neorg-dependencies" { - nativeBuildInputs = with pkgs; [lua51Packages.luarocks wget]; - outputHashAlgo = "sha256"; - outputHashMode = "recursive"; - outputHash = "sha256-SOsIgtmkXTKMZrKUHHzAf+XAshl/J7+DN9RFeLz+DDY="; - } '' - mkdir $PWD/home - export HOME=$PWD/home - mkdir -p $out/luarocks - - ${lib.concatStrings (lib.mapAttrsToList (name: version: ''luarocks install --tree="$out/luarocks" --force-lock --local ${name} ${version}'' + "\n") dependencies)} - ''; - luarc = pkgs.mk-luarc {}; - luarc-with-dependencies = - luarc - // { - inherit (luarc) runtime; - inherit (luarc.Lua) diagnostics globals; - Lua.workspace = { - inherit (luarc.Lua.workspace) ignoreDir; - library = luarc.Lua.workspace.library ++ ["${install-dependencies}/luarocks/share/lua/5.1/"]; - }; - }; in { formatter = pkgs.alejandra; @@ -77,7 +55,7 @@ hooks = { lua-ls = { enable = true; - settings.configuration = luarc-with-dependencies; + settings.configuration = pkgs.luarc-with-dependencies; }; }; }; @@ -193,7 +171,7 @@ name = "neorg devShell"; shellHook = '' - ln -fs ${pkgs.luarc-to-json luarc-with-dependencies} .luarc.json + ln -fs ${pkgs.luarc-to-json pkgs.luarc-with-dependencies} .luarc.json ''; packages = with pkgs; [ diff --git a/nix/overlays/default.nix b/nix/overlays/default.nix new file mode 100644 index 000000000..4042b330c --- /dev/null +++ b/nix/overlays/default.nix @@ -0,0 +1,29 @@ +{ + self, + inputs, + gen-luarc, + ... +}: { + perSystem = { + pkgs, + system, + ... + }: { + _module.args.pkgs = import inputs.nixpkgs { + inherit system; + + overlays = [ + gen-luarc.overlays.default + + (_: prev: { + # NOTE: I would have use callPackage for easy overriding, but + # this changes the type and *-to-json fails later. To figure out. + luarc-with-dependencies = import ./luarc.nix { + inherit self; + inherit (pkgs) lib mk-luarc runCommand lua51Packages wget; + }; + }) + ]; + }; + }; +} diff --git a/nix/overlays/luarc.nix b/nix/overlays/luarc.nix new file mode 100644 index 000000000..902c2cec4 --- /dev/null +++ b/nix/overlays/luarc.nix @@ -0,0 +1,35 @@ +{ + lib, + self, + mk-luarc, + runCommand, + lua51Packages, + wget, +}: let + luarc = mk-luarc {}; + + dependencies = builtins.fromJSON (builtins.readFile "${self}/res/deps.json"); + + install-dependencies = + runCommand "install-neorg-dependencies" { + nativeBuildInputs = [lua51Packages.luarocks wget]; + outputHashAlgo = "sha256"; + outputHashMode = "recursive"; + outputHash = "sha256-SOsIgtmkXTKMZrKUHHzAf+XAshl/J7+DN9RFeLz+DDY="; + } '' + mkdir $PWD/home + export HOME=$PWD/home + mkdir -p $out/luarocks + + ${lib.concatStrings (lib.mapAttrsToList (name: version: ''luarocks install --tree="$out/luarocks" --force-lock --local ${name} ${version} '' + "\n") dependencies)} + ''; +in + luarc + // { + inherit (luarc) runtime; + inherit (luarc.Lua) diagnostics globals; + Lua.workspace = { + inherit (luarc.Lua.workspace) ignoreDir; + library = luarc.Lua.workspace.library ++ ["${install-dependencies}/luarocks/share/lua/5.1/"]; + }; + } From e028d196978fe84fbe6ff7268e0ea9042e337ada Mon Sep 17 00:00:00 2001 From: b4mbus Date: Sun, 26 May 2024 21:59:28 +0200 Subject: [PATCH 02/11] ref(nix): move checks into a module --- flake.nix | 24 ++---------------------- nix/checks/default.nix | 18 ++++++++++++++++++ nix/checks/pre-commit-check.nix | 14 ++++++++++++++ nix/checks/type-check.nix | 16 ++++++++++++++++ 4 files changed, 50 insertions(+), 22 deletions(-) create mode 100644 nix/checks/default.nix create mode 100644 nix/checks/pre-commit-check.nix create mode 100644 nix/checks/type-check.nix diff --git a/flake.nix b/flake.nix index 5f6922cb1..5b006de0c 100644 --- a/flake.nix +++ b/flake.nix @@ -30,12 +30,11 @@ "aarch64-darwin" ]; - _module.args = { - inherit gen-luarc; - }; + _module.args = {inherit gen-luarc git-hooks;}; imports = [ ./nix/overlays + ./nix/checks ]; perSystem = { @@ -50,25 +49,6 @@ in { formatter = pkgs.alejandra; - checks.type-check = git-hooks.lib.${system}.run { - src = ./lua; - hooks = { - lua-ls = { - enable = true; - settings.configuration = pkgs.luarc-with-dependencies; - }; - }; - }; - - checks.pre-commit-check = git-hooks.lib.${system}.run { - src = self; - hooks = { - alejandra.enable = true; - luacheck.enable = true; - # stylua.enable = true; - }; - }; - packages.integration-test = let kickstart-config = pkgs.writeScript "kickstart.lua" diff --git a/nix/checks/default.nix b/nix/checks/default.nix new file mode 100644 index 000000000..1e8c74e21 --- /dev/null +++ b/nix/checks/default.nix @@ -0,0 +1,18 @@ +{ + self, + git-hooks, + ... +}: { + perSystem = { + pkgs, + system, + ... + }: { + checks = let + callPackage = pkgs.lib.callPackageWith (pkgs // {inherit self git-hooks;}); + in { + type-check = callPackage ./type-check.nix {}; + pre-commit-check = callPackage ./pre-commit-check.nix {}; + }; + }; +} diff --git a/nix/checks/pre-commit-check.nix b/nix/checks/pre-commit-check.nix new file mode 100644 index 000000000..e576d6bbe --- /dev/null +++ b/nix/checks/pre-commit-check.nix @@ -0,0 +1,14 @@ +{ + self, + system, + git-hooks, +}: +git-hooks.lib.${system}.run { + src = "${self}"; + + hooks = { + alejandra.enable = true; + luacheck.enable = true; + # stylua.enable = true; + }; +} diff --git a/nix/checks/type-check.nix b/nix/checks/type-check.nix new file mode 100644 index 000000000..23c4b3073 --- /dev/null +++ b/nix/checks/type-check.nix @@ -0,0 +1,16 @@ +{ + self, + system, + git-hooks, + luarc-with-dependencies, +}: +git-hooks.lib.${system}.run { + src = "${self}/lua"; + + hooks = { + lua-ls = { + enable = true; + settings.configuration = luarc-with-dependencies; + }; + }; +} From d3fed0a845c1c485fc6cb5b07a7176133778cca8 Mon Sep 17 00:00:00 2001 From: b4mbus Date: Sun, 26 May 2024 22:09:08 +0200 Subject: [PATCH 03/11] ref(nix): move packages into a module --- flake.nix | 103 ++-------------------------- nix/packages/default.nix | 3 + nix/packages/integration-test.nix | 110 ++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+), 99 deletions(-) create mode 100644 nix/packages/default.nix create mode 100644 nix/packages/integration-test.nix diff --git a/flake.nix b/flake.nix index 5b006de0c..e346d06fe 100644 --- a/flake.nix +++ b/flake.nix @@ -45,107 +45,12 @@ system, lib, ... - }: let - in { + }: { formatter = pkgs.alejandra; - packages.integration-test = let - kickstart-config = - pkgs.writeScript "kickstart.lua" - '' - -- Adapted from https://github.com/folke/lazy.nvim#-installation - - -- Install lazy.nvim - local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" - if not (vim.uv or vim.loop).fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release - lazypath, - }) - end - vim.opt.rtp:prepend(lazypath) - - -- Set up both the traditional leader (for keymaps) as well as the local leader (for norg files) - vim.g.mapleader = " " - vim.g.maplocalleader = "," - - require("lazy").setup({ - { - "rebelot/kanagawa.nvim", -- neorg needs a colorscheme with treesitter support - config = function() - vim.cmd.colorscheme("kanagawa") - end, - }, - { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - opts = { - ensure_installed = { "c", "lua", "vim", "vimdoc", "query" }, - highlight = { enable = true }, - }, - config = function(_, opts) - require("nvim-treesitter.configs").setup(opts) - end, - }, - { - "vhyrro/luarocks.nvim", - priority = 1000, - config = true, - }, - { - "nvim-neorg/neorg", - dependencies = { "luarocks.nvim" }, - config = function() - require("neorg").setup { - load = { - ["core.defaults"] = {}, - ["core.concealer"] = {}, - ["core.dirman"] = { - config = { - workspaces = { - notes = "~/notes", - }, - default_workspace = "notes", - }, - }, - }, - } - - vim.cmd.e("success") - - vim.wo.foldlevel = 99 - vim.wo.conceallevel = 2 - end, - } - }) - ''; - in - pkgs.writeShellApplication { - name = "neorg-integration-test"; - - runtimeInputs = with pkgs; [neovim-unwrapped tree-sitter lua5_1 wget kickstart-config]; - - text = '' - export NVIM_APPNAME="nvim-neorg" - - echo "* Hello World!" > example.norg - - nvim --headless -u ${kickstart-config} example.norg -c wq - - rm example.norg - - if [ ! -f success ]; then - echo "Integration test failed!" - exit 1 - fi - - rm success - ''; - }; + imports = [ + ./nix/packages + ]; devShells.default = pkgs.mkShell { name = "neorg devShell"; diff --git a/nix/packages/default.nix b/nix/packages/default.nix new file mode 100644 index 000000000..c8c6faf3e --- /dev/null +++ b/nix/packages/default.nix @@ -0,0 +1,3 @@ +{pkgs, ...}: { + packages.integration-test = pkgs.callPackage ./integration-test.nix {}; +} diff --git a/nix/packages/integration-test.nix b/nix/packages/integration-test.nix new file mode 100644 index 000000000..988eacf9b --- /dev/null +++ b/nix/packages/integration-test.nix @@ -0,0 +1,110 @@ +{ + writeScript, + writeShellApplication, + neovim-unwrapped, + tree-sitter, + lua5_1, + wget, +}: let + kickstart-config = + writeScript "kickstart.lua" + '' + -- Adapted from https://github.com/folke/lazy.nvim#-installation + + -- Install lazy.nvim + local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" + if not (vim.uv or vim.loop).fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) + end + vim.opt.rtp:prepend(lazypath) + + -- Set up both the traditional leader (for keymaps) as well as the local leader (for norg files) + vim.g.mapleader = " " + vim.g.maplocalleader = "," + + require("lazy").setup({ + { + "rebelot/kanagawa.nvim", -- neorg needs a colorscheme with treesitter support + config = function() + vim.cmd.colorscheme("kanagawa") + end, + }, + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + opts = { + ensure_installed = { "c", "lua", "vim", "vimdoc", "query" }, + highlight = { enable = true }, + }, + config = function(_, opts) + require("nvim-treesitter.configs").setup(opts) + end, + }, + { + "vhyrro/luarocks.nvim", + priority = 1000, + config = true, + }, + { + "nvim-neorg/neorg", + dependencies = { "luarocks.nvim" }, + config = function() + require("neorg").setup { + load = { + ["core.defaults"] = {}, + ["core.concealer"] = {}, + ["core.dirman"] = { + config = { + workspaces = { + notes = "~/notes", + }, + default_workspace = "notes", + }, + }, + }, + } + + vim.cmd.e("success") + + vim.wo.foldlevel = 99 + vim.wo.conceallevel = 2 + end, + } + }) + ''; +in + writeShellApplication { + name = "neorg-integration-test"; + + runtimeInputs = [ + neovim-unwrapped + tree-sitter + lua5_1 + wget + kickstart-config + ]; + + text = '' + export NVIM_APPNAME="nvim-neorg" + + echo "* Hello World!" > example.norg + + nvim --headless -u ${kickstart-config} example.norg -c wq + + rm example.norg + + if [ ! -f success ]; then + echo "Integration test failed!" + exit 1 + fi + + rm success + ''; + } From e2a801989a089a315f779fde922737f15064dd77 Mon Sep 17 00:00:00 2001 From: b4mbus Date: Sun, 26 May 2024 22:12:08 +0200 Subject: [PATCH 04/11] ref(nix): move shell to a module --- flake.nix | 28 ++-------------------------- nix/shells/default.nix | 3 +++ nix/shells/neorg-shell.nix | 25 +++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 26 deletions(-) create mode 100644 nix/shells/default.nix create mode 100644 nix/shells/neorg-shell.nix diff --git a/flake.nix b/flake.nix index e346d06fe..df746a262 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,4 @@ # General TODOS: -# - Extract into modules for better readability # - Add comments explaining the more terse parts of the flake. { description = "Flake for Neorg development and testing"; @@ -37,36 +36,13 @@ ./nix/checks ]; - perSystem = { - config, - self', - inputs', - pkgs, - system, - lib, - ... - }: { + perSystem = {pkgs, ...}: { formatter = pkgs.alejandra; imports = [ ./nix/packages + ./nix/shells ]; - - devShells.default = pkgs.mkShell { - name = "neorg devShell"; - - shellHook = '' - ln -fs ${pkgs.luarc-to-json pkgs.luarc-with-dependencies} .luarc.json - ''; - - packages = with pkgs; [ - lua-language-server - stylua - lua51Packages.luacheck - nil - lua5_1 - ]; - }; }; }; } diff --git a/nix/shells/default.nix b/nix/shells/default.nix new file mode 100644 index 000000000..bb36f16a1 --- /dev/null +++ b/nix/shells/default.nix @@ -0,0 +1,3 @@ +{pkgs, ...}: { + devShells.default = pkgs.callPackage ./neorg-shell.nix {}; +} diff --git a/nix/shells/neorg-shell.nix b/nix/shells/neorg-shell.nix new file mode 100644 index 000000000..fd7b9f96a --- /dev/null +++ b/nix/shells/neorg-shell.nix @@ -0,0 +1,25 @@ +{ + mkShell, + luarc-to-json, + luarc-with-dependencies, + lua-language-server, + stylua, + lua51Packages, + nil, + lua5_1, +}: +mkShell { + name = "neorg devShell"; + + shellHook = '' + ln -fs ${luarc-to-json luarc-with-dependencies} .luarc.json + ''; + + packages = [ + lua-language-server + stylua + lua51Packages.luacheck + nil + lua5_1 + ]; +} From 6d273c09f52b865ffc3832ec3a9cf10dd48b78c1 Mon Sep 17 00:00:00 2001 From: b4mbus Date: Sun, 26 May 2024 22:32:23 +0200 Subject: [PATCH 05/11] ref(nix): remove unnceccessary function args --- nix/checks/default.nix | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/nix/checks/default.nix b/nix/checks/default.nix index 1e8c74e21..f10fde410 100644 --- a/nix/checks/default.nix +++ b/nix/checks/default.nix @@ -3,11 +3,7 @@ git-hooks, ... }: { - perSystem = { - pkgs, - system, - ... - }: { + perSystem = {pkgs, ...}: { checks = let callPackage = pkgs.lib.callPackageWith (pkgs // {inherit self git-hooks;}); in { From 3571fc63fa51e83ebf089804eaa99b88e6d42641 Mon Sep 17 00:00:00 2001 From: b4mbus Date: Sun, 26 May 2024 22:32:49 +0200 Subject: [PATCH 06/11] docs(nix): fix comment grammar --- nix/overlays/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nix/overlays/default.nix b/nix/overlays/default.nix index 4042b330c..05dbf0d9c 100644 --- a/nix/overlays/default.nix +++ b/nix/overlays/default.nix @@ -16,8 +16,8 @@ gen-luarc.overlays.default (_: prev: { - # NOTE: I would have use callPackage for easy overriding, but - # this changes the type and *-to-json fails later. To figure out. + # NOTE: I would have used callPackage for easy overriding, but + # this changes the type and *-to-json fails later. To be figured out. luarc-with-dependencies = import ./luarc.nix { inherit self; inherit (pkgs) lib mk-luarc runCommand lua51Packages wget; From b1f408a52fd76503eea49d84aefdd73bde415506 Mon Sep 17 00:00:00 2001 From: b4mbus Date: Sun, 26 May 2024 23:33:35 +0200 Subject: [PATCH 07/11] ref(nix): inline shell module --- nix/shells/default.nix | 16 +++++++++++++++- nix/shells/neorg-shell.nix | 25 ------------------------- 2 files changed, 15 insertions(+), 26 deletions(-) delete mode 100644 nix/shells/neorg-shell.nix diff --git a/nix/shells/default.nix b/nix/shells/default.nix index bb36f16a1..53a8557db 100644 --- a/nix/shells/default.nix +++ b/nix/shells/default.nix @@ -1,3 +1,17 @@ {pkgs, ...}: { - devShells.default = pkgs.callPackage ./neorg-shell.nix {}; + devShells.default = pkgs.mkShell { + name = "neorg devShell"; + + shellHook = '' + ln -fs ${pkgs.luarc-to-json pkgs.luarc-with-dependencies} .luarc.json + ''; + + packages = with pkgs; [ + lua-language-server + stylua + lua51Packages.luacheck + nil + lua5_1 + ]; + }; } diff --git a/nix/shells/neorg-shell.nix b/nix/shells/neorg-shell.nix deleted file mode 100644 index fd7b9f96a..000000000 --- a/nix/shells/neorg-shell.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - mkShell, - luarc-to-json, - luarc-with-dependencies, - lua-language-server, - stylua, - lua51Packages, - nil, - lua5_1, -}: -mkShell { - name = "neorg devShell"; - - shellHook = '' - ln -fs ${luarc-to-json luarc-with-dependencies} .luarc.json - ''; - - packages = [ - lua-language-server - stylua - lua51Packages.luacheck - nil - lua5_1 - ]; -} From bd3487971873e5d1d331ad31a462b28af5550cad Mon Sep 17 00:00:00 2001 From: b4mbus Date: Sun, 26 May 2024 23:33:48 +0200 Subject: [PATCH 08/11] ref(nix): inline checks module --- nix/checks/default.nix | 32 ++++++++++++++++++++++++++------ nix/checks/pre-commit-check.nix | 14 -------------- nix/checks/type-check.nix | 16 ---------------- 3 files changed, 26 insertions(+), 36 deletions(-) delete mode 100644 nix/checks/pre-commit-check.nix delete mode 100644 nix/checks/type-check.nix diff --git a/nix/checks/default.nix b/nix/checks/default.nix index f10fde410..4c01f3e3d 100644 --- a/nix/checks/default.nix +++ b/nix/checks/default.nix @@ -3,12 +3,32 @@ git-hooks, ... }: { - perSystem = {pkgs, ...}: { - checks = let - callPackage = pkgs.lib.callPackageWith (pkgs // {inherit self git-hooks;}); - in { - type-check = callPackage ./type-check.nix {}; - pre-commit-check = callPackage ./pre-commit-check.nix {}; + perSystem = { + pkgs, + system, + ... + }: { + checks = { + type-check = git-hooks.lib.${system}.run { + src = "${self}/lua"; + + hooks = { + lua-ls = { + enable = true; + settings.configuration = pkgs.luarc-with-dependencies; + }; + }; + }; + + pre-commit-check = git-hooks.lib.${system}.run { + src = "${self}"; + + hooks = { + alejandra.enable = true; + luacheck.enable = true; + # stylua.enable = true; + }; + }; }; }; } diff --git a/nix/checks/pre-commit-check.nix b/nix/checks/pre-commit-check.nix deleted file mode 100644 index e576d6bbe..000000000 --- a/nix/checks/pre-commit-check.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - self, - system, - git-hooks, -}: -git-hooks.lib.${system}.run { - src = "${self}"; - - hooks = { - alejandra.enable = true; - luacheck.enable = true; - # stylua.enable = true; - }; -} diff --git a/nix/checks/type-check.nix b/nix/checks/type-check.nix deleted file mode 100644 index 23c4b3073..000000000 --- a/nix/checks/type-check.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ - self, - system, - git-hooks, - luarc-with-dependencies, -}: -git-hooks.lib.${system}.run { - src = "${self}/lua"; - - hooks = { - lua-ls = { - enable = true; - settings.configuration = luarc-with-dependencies; - }; - }; -} From 019cdb4e3950a03e7ecc8d50a7d8b75275c74b09 Mon Sep 17 00:00:00 2001 From: b4mbus Date: Sun, 26 May 2024 23:58:25 +0200 Subject: [PATCH 09/11] feat(nix): add custom lib overlay --- nix/overlays/default.nix | 4 +++- nix/overlays/lib.nix | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 nix/overlays/lib.nix diff --git a/nix/overlays/default.nix b/nix/overlays/default.nix index 05dbf0d9c..b69a141bc 100644 --- a/nix/overlays/default.nix +++ b/nix/overlays/default.nix @@ -15,7 +15,9 @@ overlays = [ gen-luarc.overlays.default - (_: prev: { + (final: prev: { + lib = prev.lib // import ./lib.nix {inherit pkgs;}; + # NOTE: I would have used callPackage for easy overriding, but # this changes the type and *-to-json fails later. To be figured out. luarc-with-dependencies = import ./luarc.nix { diff --git a/nix/overlays/lib.nix b/nix/overlays/lib.nix new file mode 100644 index 000000000..ee013b2f1 --- /dev/null +++ b/nix/overlays/lib.nix @@ -0,0 +1,12 @@ +{pkgs}: rec { + callPackageNoOverridableWith = originalAttrs: fun: additionalAttrs: let + f = + if pkgs.lib.isFunction fun + then fun + else import fun; + attrs = builtins.intersectAttrs (pkgs.lib.functionArgs f) originalAttrs; + in + f (attrs // additionalAttrs); + + callPackageNoOverridable = callPackageNoOverridableWith pkgs; +} From d48aaafb91a0273b4060cc6280cf3cba3d558a06 Mon Sep 17 00:00:00 2001 From: b4mbus Date: Sun, 26 May 2024 23:58:37 +0200 Subject: [PATCH 10/11] ref(nix): use lib.callPackageNoOverridable --- nix/overlays/default.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/nix/overlays/default.nix b/nix/overlays/default.nix index b69a141bc..50846de75 100644 --- a/nix/overlays/default.nix +++ b/nix/overlays/default.nix @@ -20,10 +20,7 @@ # NOTE: I would have used callPackage for easy overriding, but # this changes the type and *-to-json fails later. To be figured out. - luarc-with-dependencies = import ./luarc.nix { - inherit self; - inherit (pkgs) lib mk-luarc runCommand lua51Packages wget; - }; + luarc-with-dependencies = final.lib.callPackageNoOverridable ./luarc.nix {inherit self;}; }) ]; }; From 88a93c6c987278d0ba20ab2668126bfeae66eea4 Mon Sep 17 00:00:00 2001 From: b4mbus Date: Mon, 27 May 2024 12:46:59 +0200 Subject: [PATCH 11/11] style(nix): fix formatting --- nix/packages/integration-test.nix | 92 +++++++++++++++---------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/nix/packages/integration-test.nix b/nix/packages/integration-test.nix index 988eacf9b..dc11c9ce2 100644 --- a/nix/packages/integration-test.nix +++ b/nix/packages/integration-test.nix @@ -14,70 +14,70 @@ -- Install lazy.nvim local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then - vim.fn.system({ + vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", -- latest stable release lazypath, - }) + }) end vim.opt.rtp:prepend(lazypath) -- Set up both the traditional leader (for keymaps) as well as the local leader (for norg files) - vim.g.mapleader = " " - vim.g.maplocalleader = "," + vim.g.mapleader = " " + vim.g.maplocalleader = "," - require("lazy").setup({ - { - "rebelot/kanagawa.nvim", -- neorg needs a colorscheme with treesitter support - config = function() - vim.cmd.colorscheme("kanagawa") - end, - }, - { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - opts = { + require("lazy").setup({ + { + "rebelot/kanagawa.nvim", -- neorg needs a colorscheme with treesitter support + config = function() + vim.cmd.colorscheme("kanagawa") + end, + }, + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + opts = { ensure_installed = { "c", "lua", "vim", "vimdoc", "query" }, highlight = { enable = true }, - }, - config = function(_, opts) + }, + config = function(_, opts) require("nvim-treesitter.configs").setup(opts) - end, - }, - { + end, + }, + { "vhyrro/luarocks.nvim", priority = 1000, config = true, - }, - { - "nvim-neorg/neorg", - dependencies = { "luarocks.nvim" }, - config = function() - require("neorg").setup { - load = { - ["core.defaults"] = {}, - ["core.concealer"] = {}, - ["core.dirman"] = { - config = { - workspaces = { - notes = "~/notes", - }, - default_workspace = "notes", - }, + }, + { + "nvim-neorg/neorg", + dependencies = { "luarocks.nvim" }, + config = function() + require("neorg").setup { + load = { + ["core.defaults"] = {}, + ["core.concealer"] = {}, + ["core.dirman"] = { + config = { + workspaces = { + notes = "~/notes", }, + default_workspace = "notes", }, - } + }, + }, + } - vim.cmd.e("success") + vim.cmd.e("success") - vim.wo.foldlevel = 99 - vim.wo.conceallevel = 2 - end, - } - }) + vim.wo.foldlevel = 99 + vim.wo.conceallevel = 2 + end, + } + }) ''; in writeShellApplication { @@ -102,9 +102,9 @@ in if [ ! -f success ]; then echo "Integration test failed!" - exit 1 - fi + exit 1 + fi - rm success + rm success ''; }