From 2afa19ef5dc5dfb363a0dd381e4fbe4a983c370e Mon Sep 17 00:00:00 2001 From: Seongmin Lee Date: Sun, 13 Oct 2024 07:42:32 +0000 Subject: [PATCH] chore: update flakes - replace `flake-utils` to `flake-parts` - move luarocks setup script from `Makefile` to `nix` - (wip) testing with nix --- Makefile | 7 -- flake.lock | 269 +++++++++++++++++++++++++++---------------- flake.nix | 36 ++++-- nix/test-overlay.nix | 29 +++++ 4 files changed, 226 insertions(+), 115 deletions(-) diff --git a/Makefile b/Makefile index 014b2ae4..f4a0bf2f 100644 --- a/Makefile +++ b/Makefile @@ -8,11 +8,4 @@ format: stylua . test: - # TODO: install tree-sitter-http as a test dependency using nix - # or version it appart from NURR - # LUA_PATH="$(shell luarocks path --lr-path --lua-version 5.1 --local)" \ - # LUA_CPATH="$(shell luarocks path --lr-cpath --lua-version 5.1 --local)" \ - # luarocks install --local --lua-version 5.1 --dev tree-sitter-http - LUA_PATH="$(shell luarocks path --lr-path --lua-version 5.1 --local)" \ - LUA_CPATH="$(shell luarocks path --lr-cpath --lua-version 5.1 --local)" \ luarocks test --local --lua-version 5.1 --dev diff --git a/flake.lock b/flake.lock index 3109400b..9a80dc1c 100644 --- a/flake.lock +++ b/flake.lock @@ -3,14 +3,15 @@ "cats-doc": { "inputs": { "flake-parts": "flake-parts", + "git-hooks": "git-hooks", "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1724663048, - "narHash": "sha256-QWry7jMdrEXZShZPb9pbMxWCgOGGTWTD7k9+6QfcVSQ=", + "lastModified": 1726045206, + "narHash": "sha256-/ekQF2pE/juZ7AVge9bqodQLx4n0uaV4j2taD5U78R0=", "owner": "mrcjkb", "repo": "vimcats", - "rev": "5ddcbca614e8dd4b80fec2b20ce97c1a9ede51ce", + "rev": "fd213ad22ffbfff87899c872752a1c92814c93fa", "type": "github" }, "original": { @@ -83,16 +84,32 @@ "type": "github" } }, + "flake-compat_5": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1696343447, - "narHash": "sha256-B2xAZKLkkeRFG5XcHHSXXcP7To9Xzr59KXeZiRf4vdQ=", + "lastModified": 1725234343, + "narHash": "sha256-+ebgonl3NbiKD2UD0x4BszCZQ6sTfL4xioaM49o5B3Y=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "c9afaba3dfa4085dbd2ccb38dfade5141e33d9d4", + "rev": "567b938d64d4b4112ee253b9274472dc3a346eb6", "type": "github" }, "original": { @@ -106,11 +123,11 @@ "nixpkgs-lib": "nixpkgs-lib_2" }, "locked": { - "lastModified": 1722555600, - "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=", + "lastModified": 1727826117, + "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "8471fe90ad337a8074e957b69ca4d0089218391d", + "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", "type": "github" }, "original": { @@ -120,6 +137,24 @@ } }, "flake-parts_3": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_3" + }, + "locked": { + "lastModified": 1727826117, + "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_4": { "inputs": { "nixpkgs-lib": [ "neorocks", @@ -128,11 +163,11 @@ ] }, "locked": { - "lastModified": 1722555600, - "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=", + "lastModified": 1727826117, + "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "8471fe90ad337a8074e957b69ca4d0089218391d", + "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", "type": "github" }, "original": { @@ -141,7 +176,7 @@ "type": "github" } }, - "flake-parts_4": { + "flake-parts_5": { "inputs": { "nixpkgs-lib": [ "neorocks", @@ -163,37 +198,44 @@ "type": "indirect" } }, - "flake-utils": { + "git-hooks": { "inputs": { - "systems": "systems" + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "cats-doc", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "lastModified": 1725438226, + "narHash": "sha256-lL4hQ+g2qiZ02WfidLkrujaT23c6E2Wm7S0ZQhSB8Jk=", + "owner": "mrcjkb", + "repo": "git-hooks.nix", + "rev": "ec0f4d97f48a1f32bd87804e2390f03999790ec0", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "mrcjkb", + "ref": "clippy", + "repo": "git-hooks.nix", "type": "github" } }, - "git-hooks": { + "git-hooks_2": { "inputs": { - "flake-compat": "flake-compat_2", - "gitignore": "gitignore", + "flake-compat": "flake-compat_3", + "gitignore": "gitignore_2", "nixpkgs": "nixpkgs_2", - "nixpkgs-stable": "nixpkgs-stable" + "nixpkgs-stable": "nixpkgs-stable_2" }, "locked": { - "lastModified": 1723803910, - "narHash": "sha256-yezvUuFiEnCFbGuwj/bQcqg7RykIEqudOy/RBrId0pc=", + "lastModified": 1728778939, + "narHash": "sha256-WybK5E3hpGxtCYtBwpRj1E9JoiVxe+8kX83snTNaFHE=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "bfef0ada09e2c8ac55bbcd0831bd0c9d42e651ba", + "rev": "ff68f91754be6f3427e4986d7949e6273659be1d", "type": "github" }, "original": { @@ -202,10 +244,10 @@ "type": "github" } }, - "git-hooks_2": { + "git-hooks_3": { "inputs": { - "flake-compat": "flake-compat_4", - "gitignore": "gitignore_2", + "flake-compat": "flake-compat_5", + "gitignore": "gitignore_3", "nixpkgs": [ "neorocks", "neovim-nightly", @@ -218,11 +260,11 @@ ] }, "locked": { - "lastModified": 1723803910, - "narHash": "sha256-yezvUuFiEnCFbGuwj/bQcqg7RykIEqudOy/RBrId0pc=", + "lastModified": 1728580416, + "narHash": "sha256-nKttjKg6lE7O5S+wlBOkXsUGdOgVxZ8SWaCOyodW5so=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "bfef0ada09e2c8ac55bbcd0831bd0c9d42e651ba", + "rev": "4ebefcac44b5116cf5741be858245db769ddedd1", "type": "github" }, "original": { @@ -234,7 +276,7 @@ "gitignore": { "inputs": { "nixpkgs": [ - "neorocks", + "cats-doc", "git-hooks", "nixpkgs" ] @@ -254,6 +296,28 @@ } }, "gitignore_2": { + "inputs": { + "nixpkgs": [ + "neorocks", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gitignore_3": { "inputs": { "nixpkgs": [ "neorocks", @@ -278,7 +342,7 @@ }, "hercules-ci-effects": { "inputs": { - "flake-parts": "flake-parts_4", + "flake-parts": "flake-parts_5", "nixpkgs": [ "neorocks", "neovim-nightly", @@ -286,11 +350,11 @@ ] }, "locked": { - "lastModified": 1719226092, - "narHash": "sha256-YNkUMcCUCpnULp40g+svYsaH1RbSEj6s4WdZY/SHe38=", + "lastModified": 1724947644, + "narHash": "sha256-MHHrHasTngp7EYQOObHJ1a/IsRF+wodHqOckhH6uZbk=", "owner": "hercules-ci", "repo": "hercules-ci-effects", - "rev": "11e4b8dc112e2f485d7c97e1cee77f9958f498f5", + "rev": "dba4367b9a9d9615456c430a6d6af716f6e84cef", "type": "github" }, "original": { @@ -301,18 +365,18 @@ }, "neorocks": { "inputs": { - "flake-compat": "flake-compat", - "flake-parts": "flake-parts_2", - "git-hooks": "git-hooks", + "flake-compat": "flake-compat_2", + "flake-parts": "flake-parts_3", + "git-hooks": "git-hooks_2", "neovim-nightly": "neovim-nightly", "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1724045136, - "narHash": "sha256-wAjB2G+aOVF94xD+RSKCddaLnmQXEpKumoWYPDC7NWk=", + "lastModified": 1728797102, + "narHash": "sha256-jKzY6jeAjWJ8A6NvI0xo5+xDCJwqflX1i4hZ/ff3P9A=", "owner": "nvim-neorocks", "repo": "neorocks", - "rev": "8b18af8ac0449a590949ae431de3f32ad2e1174c", + "rev": "46990ba49c2b821046f5ba61631101c91ee4cc26", "type": "github" }, "original": { @@ -323,19 +387,19 @@ }, "neovim-nightly": { "inputs": { - "flake-compat": "flake-compat_3", - "flake-parts": "flake-parts_3", - "git-hooks": "git-hooks_2", + "flake-compat": "flake-compat_4", + "flake-parts": "flake-parts_4", + "git-hooks": "git-hooks_3", "hercules-ci-effects": "hercules-ci-effects", "neovim-src": "neovim-src", "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1723969597, - "narHash": "sha256-nNSmyoR8k2gEw9LZ+nFcBQm+bquflzw2R44BeJ4gmKk=", + "lastModified": 1728631701, + "narHash": "sha256-LPqpJVV8Ws4uDfzp/Huu6myMW33lmZbFGTMoZ9LyRCU=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "ec3ee3674c80882ac54d93b5575426c66e3f430d", + "rev": "a2de61747149100c904c01eb8915e1c6ecec0379", "type": "github" }, "original": { @@ -347,11 +411,11 @@ "neovim-src": { "flake": false, "locked": { - "lastModified": 1723936741, - "narHash": "sha256-x/0wYCshhLSA9zW4fvPK+W6g3gTqE8fMJQZrIucDyXg=", + "lastModified": 1728600525, + "narHash": "sha256-Q2QHD23/bkNdYTbXaRLaVYy/uUx3gw08NAehTfF5ZXs=", "owner": "neovim", "repo": "neovim", - "rev": "d1bdeacb00186ba72fa61f3c7f2951fd018ae21d", + "rev": "6f1601a1b94e6ea724d8436600c64760525d1d2b", "type": "github" }, "original": { @@ -362,11 +426,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1697379843, - "narHash": "sha256-RcnGuJgC2K/UpTy+d32piEoBXq2M+nVFzM3ah/ZdJzg=", + "lastModified": 1725910328, + "narHash": "sha256-n9pCtzGZ0httmTwMuEbi5E78UQ4ZbQMr1pzi5N0LAG8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "12bdeb01ff9e2d3917e6a44037ed7df6e6c3df9d", + "rev": "5775c2583f1801df7b790bf7f7d710a19bac66f4", "type": "github" }, "original": { @@ -378,32 +442,38 @@ }, "nixpkgs-lib": { "locked": { - "dir": "lib", - "lastModified": 1696019113, - "narHash": "sha256-X3+DKYWJm93DRSdC5M6K5hLqzSya9BjibtBsuARoPco=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "f5892ddac112a1e9b3612c39af1b72987ee5783a", - "type": "github" + "lastModified": 1725233747, + "narHash": "sha256-Ss8QWLXdr2JCBPcYChJhz4xJm+h/xjl4G0c0XlP6a74=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" }, "original": { - "dir": "lib", - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" } }, "nixpkgs-lib_2": { "locked": { - "lastModified": 1722555339, - "narHash": "sha256-uFf2QeW7eAHlYXuDktm9c25OxOyCoUOQmh5SZ9amE5Q=", + "lastModified": 1727825735, + "narHash": "sha256-0xHYkMkeLVQAMa7gvkddbPqpxph+hDzdu1XdGPJR+Os=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz" + } + }, + "nixpkgs-lib_3": { + "locked": { + "lastModified": 1727825735, + "narHash": "sha256-0xHYkMkeLVQAMa7gvkddbPqpxph+hDzdu1XdGPJR+Os=", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz" }, "original": { "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz" } }, "nixpkgs-stable": { @@ -422,6 +492,22 @@ "type": "github" } }, + "nixpkgs-stable_2": { + "locked": { + "lastModified": 1720386169, + "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "194846768975b7ad2c4988bdb82572c00222c0d7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1719082008, @@ -440,11 +526,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1723856861, - "narHash": "sha256-OTDg91+Zzs2SpU3csK4xVdSQFoG8cK1lNUwKmTqERyE=", + "lastModified": 1728538411, + "narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "cd7b95ee3725af7113bacbce91dd6549cee58ca5", + "rev": "b69de56fac8c2b6f8fd27f2eca01dcda8e0a4221", "type": "github" }, "original": { @@ -456,11 +542,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1723985069, - "narHash": "sha256-MGtXhZHLZGKhtZT/MYXBJEuMkZB5DLYjY679EYNL7Es=", + "lastModified": 1728538411, + "narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "ff1c2669bbb4d0dd9e62cc94f0968cfa652ceec1", + "rev": "b69de56fac8c2b6f8fd27f2eca01dcda8e0a4221", "type": "github" }, "original": { @@ -472,11 +558,11 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1723637854, - "narHash": "sha256-med8+5DSWa2UnOqtdICndjDAEjxr5D7zaIiK4pn0Q7c=", + "lastModified": 1728492678, + "narHash": "sha256-9UTxR8eukdg+XZeHgxW5hQA9fIKHsKCdOIUycTryeVw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "c3aa7b8938b17aebd2deecf7be0636000d62a2b9", + "rev": "5633bcff0c6162b9e4b5f1264264611e950c8ec7", "type": "github" }, "original": { @@ -489,25 +575,10 @@ "root": { "inputs": { "cats-doc": "cats-doc", - "flake-utils": "flake-utils", + "flake-parts": "flake-parts_2", "neorocks": "neorocks", "nixpkgs": "nixpkgs_5" } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index e6ba12c2..2cd8f61c 100644 --- a/flake.nix +++ b/flake.nix @@ -5,7 +5,7 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; neorocks.url = "github:nvim-neorocks/neorocks"; - flake-utils.url = "github:numtide/flake-utils"; + flake-parts.url = "github:hercules-ci/flake-parts"; cats-doc.url = "github:mrcjkb/vimcats"; }; @@ -13,15 +13,27 @@ self, nixpkgs, neorocks, - flake-utils, + flake-parts, ... }: let test-overlay = import ./nix/test-overlay.nix { inherit self inputs; }; in - flake-utils.lib.eachDefaultSystem (system: - let + flake-parts.lib.mkFlake {inherit inputs;} { + systems = [ + "x86_64-linux" + "x86_64-darwin" + "aarch64-linux" + "aarch64-darwin" + ]; + perSystem = { + config, + self', + inputs', + system, + ... + }: let pkgs = import nixpkgs { inherit system; overlays = [ @@ -35,11 +47,15 @@ shellHook = '' export LUA_PATH="$(luarocks path --lr-path --lua-version 5.1 --local)" export LUA_CPATH="$(luarocks path --lr-cpath --lua-version 5.1 --local)" + # HACK: install tree-sitter-http manually + # TODO: add it as a test dependency using nix + luarocks install --local --lua-version 5.1 --dev tree-sitter-http ''; buildInputs = [ pkgs.sumneko-lua-language-server pkgs.stylua pkgs.docgen + pkgs.neovim (pkgs.lua5_1.withPackages (ps: with ps; [luarocks luacheck])) ]; }; @@ -60,10 +76,12 @@ }; checks = { - neorocks-test = pkgs.neorocksTest { - src = self; - name = "rest.nvim"; - }; + inherit + (pkgs) + # integration-stable + integration-nightly + ; }; - }); + }; + }; } diff --git a/nix/test-overlay.nix b/nix/test-overlay.nix index 1e10d1fa..f9cfc87c 100644 --- a/nix/test-overlay.nix +++ b/nix/test-overlay.nix @@ -2,6 +2,33 @@ self, inputs, }: final: prev: let + mkNeorocksTest = name: nvim: + with final; + neorocksTest { + inherit name; + pname = "rest.nvim"; + src = self; + neovim = nvim; + luaPackages = ps: + with ps; [ + nvim-nio + mimetypes + xml2lua + fidget-nvim + # FIXME: this doesn't work + # tree-sitter-http + ]; + extraPackages = [ + ]; + + preCheck = '' + # Neovim expects to be able to create log files, etc. + export HOME=$(realpath .) + export LUA_PATH="$(luarocks path --lr-path --lua-version 5.1 --local)" + export LUA_CPATH="$(luarocks path --lr-cpath --lua-version 5.1 --local)" + # luarocks install --local --lua-version 5.1 --dev tree-sitter-http + ''; + }; docgen = final.writeShellApplication { name = "docgen"; runtimeInputs = [ @@ -15,5 +42,7 @@ ''; }; in { + integration-stable = mkNeorocksTest "integration-stable" final.neovim; + integration-nightly = mkNeorocksTest "integration-nightly" final.neovim-nightly; inherit docgen; }