diff --git a/config/default.nix b/config/default.nix new file mode 100644 index 0000000..e69de29 diff --git a/flake.nix b/flake.nix index 6e98f42..0604113 100644 --- a/flake.nix +++ b/flake.nix @@ -1,34 +1,47 @@ { description = "💤 LazyVim + ❄️ NixVim = LixyVim"; - outputs = - inputs: - inputs.snowfall-lib.mkFlake { - inherit inputs; - - src = ./.; - - alias.packages.default = "lixyvim"; - - overlays = with inputs; [ nixvim.overlays.default ]; - - outputs-builder = channels: { - formatter = channels.nixpkgs.nixfmt-rfc-style; - }; - }; - inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - unstable.url = "github:nixos/nixpkgs/nixos-unstable"; - - snowfall-lib = { - url = "github:snowfallorg/lib"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - nixvim = { - url = "github:nix-community/nixvim"; - inputs.nixpkgs.follows = "unstable"; - }; + nixvim.url = "github:nix-community/nixvim"; + flake-parts.url = "github:hercules-ci/flake-parts"; }; -} + + outputs = + { nixvim, flake-parts, ... }@inputs: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + + perSystem = + { pkgs, system, ... }: + let + nixvimLib = nixvim.lib.${system}; + nixvim' = nixvim.legacyPackages.${system}; + nixvimModule = { + inherit pkgs; + module = import ./config; # import the module directly + # You can use `extraSpecialArgs` to pass additional arguments to your module files + extraSpecialArgs = { + # inherit (inputs) foo; + }; + }; + nvim = nixvim'.makeNixvimWithModule nixvimModule; + in + { + checks = { + # Run `nix flake check .` to verify that your config is not broken + default = nixvimLib.check.mkTestDerivationFromNixvimModule nixvimModule; + }; + + packages = { + # Lets you run `nix run .` to start nixvim + default = nvim; + }; + }; + }; +} diff --git a/packages/lixyvim/default.nix b/packages/lixyvim/default.nix deleted file mode 100644 index 21db8c2..0000000 --- a/packages/lixyvim/default.nix +++ /dev/null @@ -1,65 +0,0 @@ -{ lib -, pkgs -, inputs -, neovim-settings ? { } -, neovim-config ? { } -, ... -}: -let - raw-modules = lib.snowfall.fs.get-default-nix-files-recursive ( - lib.snowfall.fs.get-file "/modules/nixvim" - ); - - wrapped-modules = builtins.map - ( - raw-module: - args@{ ... }: - let - module = import raw-module; - result = - if builtins.isFunction module then - module - ( - args - // { - # NOTE: nixvim doesn't allow for these to be customized so we must work around the - # module system here... - inherit lib pkgs; - } - ) - else - module; - in - result // { _file = raw-module; } - ) - raw-modules; - - raw-neovim = pkgs.nixvim.makeNixvimWithModule { - inherit pkgs; - - module = { - imports = wrapped-modules; - - config = lib.mkMerge [ - { - _module.args = { - settings = neovim-settings; - lib = lib.mkForce lib; - }; - } - - neovim-config - ]; - }; - }; - - neovim = raw-neovim.overrideAttrs (attrs: { - meta = attrs.meta // { - # NOTE: The default platforms specified aren't actually all - # supported by nixvim. Instead, only support the ones that can build with - # the module system. - platforms = builtins.attrNames inputs.nixvim.legacyPackages; - }; - }); -in -neovim