From 90b0ba320410b32a60b9cdf3121f9a2df97bae5d Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Sat, 29 Jun 2024 14:11:17 +0200 Subject: [PATCH] build: use lz.n flake --- flake.lock | 60 ++++++++++++++++++++-------------------- flake.nix | 11 ++++++-- nix/overlay.nix | 30 ++++---------------- spec/rocks_lazy_spec.lua | 2 ++ 4 files changed, 45 insertions(+), 58 deletions(-) diff --git a/flake.lock b/flake.lock index 9197e22..06c8275 100644 --- a/flake.lock +++ b/flake.lock @@ -687,11 +687,11 @@ ] }, "locked": { - "lastModified": 1718879355, - "narHash": "sha256-RTyqP4fBX2MdhNuMP+fnR3lIwbdtXhyj7w7fwtvgspc=", + "lastModified": 1719259945, + "narHash": "sha256-F1h+XIsGKT9TkGO3omxDLEb/9jOOsI6NnzsXFsZhry4=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "8cd35b9496d21a6c55164d8547d9d5280162b07a", + "rev": "0ff4381bbb8f7a52ca4a851660fc7a437a4c6e07", "type": "github" }, "original": { @@ -990,11 +990,11 @@ ] }, "locked": { - "lastModified": 1718018037, - "narHash": "sha256-03rLBd/lKecgaKz0j5ESUf9lDn5R0SJatZTKLL5unWE=", + "lastModified": 1719226092, + "narHash": "sha256-YNkUMcCUCpnULp40g+svYsaH1RbSEj6s4WdZY/SHe38=", "owner": "hercules-ci", "repo": "hercules-ci-effects", - "rev": "0ab08b23ce3c3f75fe9a5598756b6fb8bcf0b414", + "rev": "11e4b8dc112e2f485d7c97e1cee77f9958f498f5", "type": "github" }, "original": { @@ -1036,11 +1036,11 @@ "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1719248596, - "narHash": "sha256-GBDmumQ0XYxawPdUncI6fW413MMSjGl6TwCQTexUpnE=", + "lastModified": 1719517669, + "narHash": "sha256-k3hbQfg6XOHLY01oAXQ07ZPEj67Uh/Y8DOLkWHn4Aq4=", "owner": "nvim-neorocks", "repo": "lz.n", - "rev": "24f9fe1024c936d9fa6a5607b73a4ae1958c9d77", + "rev": "2b9b3ee2a4d94d04454efe6e692d878a79f8433c", "type": "github" }, "original": { @@ -1080,11 +1080,11 @@ "nixpkgs": "nixpkgs_10" }, "locked": { - "lastModified": 1719293065, - "narHash": "sha256-fm9B0BZNBXS6DAdyBFFpu9qfxi5mqQhSHWMeDQZc9Rc=", + "lastModified": 1719552233, + "narHash": "sha256-srQ8MbcPgXrQj2xywQLKy/p/x+kFYStUhdNhFK2pZL0=", "owner": "nvim-neorocks", "repo": "neorocks", - "rev": "6571ae96ae7b8e698f144eef34bd0d0a52e94f5c", + "rev": "8c01ff3cba17c57271a0a55558ee9c93fe0f0ea1", "type": "github" }, "original": { @@ -1148,11 +1148,11 @@ "nixpkgs": "nixpkgs_9" }, "locked": { - "lastModified": 1719211247, - "narHash": "sha256-GaEckCf2RaHzoEDj/j07BIV6eyDOT5wCFVSdbbkZ87U=", + "lastModified": 1719467057, + "narHash": "sha256-8gQ0txwuLoBpBeIhTAkl+/7Hi/AD4KE5m4YhOn1OA3E=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "820da0e6b6127df9ad05ef3af40d767577e21ba1", + "rev": "bb6bea003dc464a4248a173e71a007d368691092", "type": "github" }, "original": { @@ -1203,11 +1203,11 @@ "neovim-src_2": { "flake": false, "locked": { - "lastModified": 1719138008, - "narHash": "sha256-+rM0RjvuW6/vzxdJxEU6KvQEF159NXrgB+irtS044Cc=", + "lastModified": 1719414226, + "narHash": "sha256-h/qJ+1R+BtY+mX02UsqYW82hEl78mrHTGAs9yjpFEzU=", "owner": "neovim", "repo": "neovim", - "rev": "be999e6a0e5b251b2b37500d06636d4167334c6e", + "rev": "fc9b70826ec88ca2e6c0624c522b872e87aa7ac1", "type": "github" }, "original": { @@ -1454,11 +1454,11 @@ }, "nixpkgs_10": { "locked": { - "lastModified": 1719082008, - "narHash": "sha256-jHJSUH619zBQ6WdC21fFAlDxHErKVDJ5fpN0Hgx4sjs=", + "lastModified": 1719468428, + "narHash": "sha256-vN5xJAZ4UGREEglh3lfbbkIj+MPEYMuqewMn4atZFaQ=", "owner": "nixos", "repo": "nixpkgs", - "rev": "9693852a2070b398ee123a329e68f0dab5526681", + "rev": "1e3deb3d8a86a870d925760db1a5adecc64d329d", "type": "github" }, "original": { @@ -1470,11 +1470,11 @@ }, "nixpkgs_11": { "locked": { - "lastModified": 1719344533, - "narHash": "sha256-gEI2jcA79D253X1VrL8TieFqFHIF+i41lcYXfCFVcW4=", + "lastModified": 1719661864, + "narHash": "sha256-txbrBDHB90ODUuV/hMThv229tVUApa42qfHDFbb4HZk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e3b85fd928344945e7bd6f2a6f32d93c07489728", + "rev": "7de69e22aba1b4887306f05cf276f39798a45a28", "type": "github" }, "original": { @@ -1645,11 +1645,11 @@ }, "nixpkgs_9": { "locked": { - "lastModified": 1719082008, - "narHash": "sha256-jHJSUH619zBQ6WdC21fFAlDxHErKVDJ5fpN0Hgx4sjs=", + "lastModified": 1719379843, + "narHash": "sha256-u+D+IOAMMl70+CJ9NKB+RMrASjInuIWMHzjLWQjPZ6c=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9693852a2070b398ee123a329e68f0dab5526681", + "rev": "b3f3c1b13fb08f3828442ee86630362e81136bbc", "type": "github" }, "original": { @@ -1738,11 +1738,11 @@ "pre-commit-hooks": "pre-commit-hooks_3" }, "locked": { - "lastModified": 1719326926, - "narHash": "sha256-+K0Q8HsVOlpTS9vGqVIKktAVtXQQp5mSigBKKqTPVgY=", + "lastModified": 1719616919, + "narHash": "sha256-F5ekIbu/956vjoN6RlV1ROrPOiL9+TPBBgo/NEhGNT0=", "owner": "nvim-neorocks", "repo": "rocks.nvim", - "rev": "9b9fddb33be249df4518344ef45c83ea07b2a04e", + "rev": "3b626fd1fe3b3529aa0ed961c7113f4bbbd9da83", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 65a5e64..7451d6b 100644 --- a/flake.nix +++ b/flake.nix @@ -63,10 +63,13 @@ ]; }; + rocks-nvim = rocks-nvim-flake.packages.${system}.rocks-nvim; + lz-n = lz-n-flake.packages.${system}.lz-n-luaPackage; + luarc = pkgs.mk-luarc { nvim = pkgs.neovim-nightly; - plugins = with pkgs.lua51Packages; [ - rocks-nvim-flake.packages.${system}.rocks-nvim + plugins = [ + rocks-nvim lz-n ]; }; @@ -102,6 +105,8 @@ ++ (with pkgs; [ busted-nlua lua-language-server + rocks-nvim + lz-n ]); }; in { @@ -129,7 +134,7 @@ }; }; flake = { - overlays.default = import ./nix/overlay.nix {inherit self rocks-nvim-flake;}; + overlays.default = import ./nix/overlay.nix {inherit self inputs;}; }; }; } diff --git a/nix/overlay.nix b/nix/overlay.nix index aab322b..da2c3e7 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -1,33 +1,13 @@ { self, - rocks-nvim-flake, + inputs, }: final: prev: let name = "rocks-lazy.nvim"; luaPackage-override = luaself: luaprev: { - rocks-nvim = rocks-nvim-flake.packages.${final.system}.rocks-nvim; + rocks-nvim = inputs.rocks-nvim-flake.packages.${final.system}.rocks-nvim; - lz-n = luaself.callPackage ({ - buildLuarocksPackage, - fetchurl, - fetchzip, - luaOlder, - }: - buildLuarocksPackage { - pname = "lz.n"; - version = "1.2.4-1"; - knownRockspec = - (fetchurl { - url = "mirror://luarocks/lz.n-1.2.4-1.rockspec"; - sha256 = "sha256-DR0wr7wczl0P1PEMDSc9w9gU30KstX/rWBjAcx97k7A="; - }) - .outPath; - src = fetchzip { - url = "https://github.com/nvim-neorocks/lz.n/archive/v1.2.4.zip"; - sha256 = "sha256-T4gRlf7GoiPhwvQnvomKLU4y21v1zFm3YcKvsdgkSds="; - }; - disabled = luaOlder "5.1"; - }) {}; + lz-n = inputs.lz-n-flake.packages.${final.system}.lz-n-luaPackage; rocks-lazy-nvim = luaself.callPackage ({ luaOlder, @@ -58,9 +38,9 @@ luajitPackages = final.luajit.pkgs; neovim-with-rocks = let - rocks = rocks-nvim-flake.packages.${final.system}.rocks-nvim; + rocks = inputs.rocks-nvim-flake.packages.${final.system}.rocks-nvim; rocks-lazy = final.luajitPackages.rocks-lazy-nvim; - lz-n = final.luajitPackages.lz-n; + lz-n = inputs.lz-n-flake.packages.${final.system}.lz-n-luaPackage; neovimConfig = final.neovimUtils.makeNeovimConfig { withPython3 = true; viAlias = false; diff --git a/spec/rocks_lazy_spec.lua b/spec/rocks_lazy_spec.lua index 18306d4..a30da1f 100644 --- a/spec/rocks_lazy_spec.lua +++ b/spec/rocks_lazy_spec.lua @@ -2,6 +2,8 @@ vim.g.lz_n = { load = function() end, } +vim.cmd.packadd = function() end + local tempdir = vim.fn.tempname() local config_path = vim.fs.joinpath(tempdir, "rocks.toml")