diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..06635cd --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use_flake . diff --git a/flake.lock b/flake.lock index c6e3634..32678bb 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,21 @@ { "nodes": { + "flake-compat": { + "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" @@ -19,6 +35,24 @@ } }, "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_2" + }, + "locked": { + "lastModified": 1717285511, + "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_3": { "inputs": { "nixpkgs-lib": [ "nixvim", @@ -57,6 +91,73 @@ "type": "github" } }, + "gen-luarc": { + "inputs": { + "flake-parts": "flake-parts_2", + "git-hooks": "git-hooks", + "luvit-meta": "luvit-meta", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1755304025, + "narHash": "sha256-xVKfjFwc0zMbLMjLTiHz+0llggkjs93SmHkhaa9S3M4=", + "owner": "mrcjkb", + "repo": "nix-gen-luarc-json", + "rev": "1865b0ebb753ae5324d7381b1fa8c98c04ec7509", + "type": "github" + }, + "original": { + "owner": "mrcjkb", + "repo": "nix-gen-luarc-json", + "type": "github" + } + }, + "git-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "gen-luarc", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1723803910, + "narHash": "sha256-yezvUuFiEnCFbGuwj/bQcqg7RykIEqudOy/RBrId0pc=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "bfef0ada09e2c8ac55bbcd0831bd0c9d42e651ba", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "gen-luarc", + "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" + } + }, "ixx": { "inputs": { "flake-utils": [ @@ -85,13 +186,29 @@ "type": "github" } }, + "luvit-meta": { + "flake": false, + "locked": { + "lastModified": 1705776742, + "narHash": "sha256-zAAptV/oLuLAAsa2zSB/6fxlElk4+jNZd/cPr9oxFig=", + "owner": "Bilal2453", + "repo": "luvit-meta", + "rev": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60", + "type": "github" + }, + "original": { + "owner": "Bilal2453", + "repo": "luvit-meta", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1759036355, - "narHash": "sha256-0m27AKv6ka+q270dw48KflE0LwQYrO7Fm4/2//KCVWg=", + "lastModified": 1718714799, + "narHash": "sha256-FUZpz9rg3gL8NVPKbqU8ei1VkPLsTIfAJ2fdAf5qjak=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e9f00bd893984bc8ce46c895c3bf7cac95331127", + "rev": "c00d587b1a1afbf200b1d8f0b0e4ba9deb1c7f0e", "type": "github" }, "original": { @@ -116,7 +233,51 @@ "type": "github" } }, + "nixpkgs-lib_2": { + "locked": { + "lastModified": 1717284937, + "narHash": "sha256-lIbdfCsf8LMFloheeE6N31+BMIeixqyQWbSr2vk79EQ=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" + } + }, + "nixpkgs-stable": { + "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": 1759036355, + "narHash": "sha256-0m27AKv6ka+q270dw48KflE0LwQYrO7Fm4/2//KCVWg=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "e9f00bd893984bc8ce46c895c3bf7cac95331127", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1758763312, "narHash": "sha256-puBMviZhYlqOdUUgEmMVJpXqC/ToEqSvkyZ30qQ09xM=", @@ -134,8 +295,8 @@ }, "nixvim": { "inputs": { - "flake-parts": "flake-parts_2", - "nixpkgs": "nixpkgs_2", + "flake-parts": "flake-parts_3", + "nixpkgs": "nixpkgs_3", "nuschtosSearch": "nuschtosSearch", "systems": "systems_2" }, @@ -179,7 +340,8 @@ "root": { "inputs": { "flake-parts": "flake-parts", - "nixpkgs": "nixpkgs", + "gen-luarc": "gen-luarc", + "nixpkgs": "nixpkgs_2", "nixvim": "nixvim" } }, diff --git a/flake.nix b/flake.nix index dc55749..3c277d8 100644 --- a/flake.nix +++ b/flake.nix @@ -5,10 +5,14 @@ nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; flake-parts.url = "github:hercules-ci/flake-parts"; nixvim.url = "github:nix-community/nixvim"; + gen-luarc.url = "github:mrcjkb/nix-gen-luarc-json"; }; outputs = { flake-parts, ... }@inputs: + let + neovim-overlay = import ./nix/neovim-overlay.nix { inherit inputs; }; + in flake-parts.lib.mkFlake { inherit inputs; } { # debug = true; @@ -18,7 +22,30 @@ ]; imports = [ - ./flake-module.nix + ./nixvim.nix ]; + + perSystem = + { pkgs, system, ... }: + { + _module.args.pkgs = import inputs.nixpkgs { + inherit system; + overlays = [ + neovim-overlay + inputs.gen-luarc.overlays.default + ]; + }; + + devShells.default = pkgs.mkShell { + name = "nvim-devShell"; + buildInputs = with pkgs; [ + lua-language-server + nil + stylua + luajitPackages.luacheck + nvim-dev + ]; + }; + }; }; } diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix new file mode 100644 index 0000000..597c604 --- /dev/null +++ b/nix/neovim-overlay.nix @@ -0,0 +1,37 @@ +{ inputs }: +final: prev: +with final.pkgs.lib; +let + pkgs = final; + + # Make sure we use the pinned nixpkgs instance for wrapNeovimUnstable, + # otherwise it could have an incompatible signature when applying this overlay. + pkgs-locked = inputs.nixpkgs.legacyPackages.${pkgs.system}; + + mkNeovim = pkgs.callPackage ./mkNeovim.nix { + inherit (pkgs-locked) neovimUtils wrapNeovimUnstable; + }; + + plugins = [ ]; + + extraPackages = with pkgs; [ + lua-language-server + nil + ]; +in +{ + # This is the neovim derivation + # returned by the overlay + nvim-pkg = mkNeovim { + inherit extraPackages plugins; + }; + + # This is meant to be used within a devshell. + # Instead of loading the lua Neovim configuration from + # the Nix store, it is loaded from $XDG_CONFIG_HOME/nvim-dev + nvim-dev = mkNeovim { + inherit extraPackages plugins; + appName = "nvim-dev"; + wrapRc = false; + }; +} diff --git a/flake-module.nix b/nixvim.nix similarity index 100% rename from flake-module.nix rename to nixvim.nix