jordanisaacs / neovim-flake

Nix flake for neovim with configuration
https://jordanisaacs.github.io/neovim-flake
MIT License
259 stars 56 forks source link

Make theme module configurable #21

Closed antotocar34 closed 1 year ago

antotocar34 commented 1 year ago

Allows user to add their own themes when using neovim-flake as an input. Example (which we may want to add to docs once extra-inputs is merged into master).

{
  inputs = {
      neovim-flake.url = "path:antotocar34/neovim-flake?ref=theme_modularize";

      nord = {
        url = "github:shaunsingh/nord.nvim";
        flake = false;
      };
  };

  outputs = {nixpkgs, neovim-flake, ...}@inputs: let
    system = "x86_64-linux";
    pkgs = nixpkgs.legacyPackages.${system};

    configModule.config.vim = {
      theme.enable = true;
      theme.name = "nord";
      theme.supportedThemes."nord" = {
        setup = ''
        require('nord').set()
        vim.cmd[[colorscheme nord]]
        '';
      };
    };

    customNeovim = neovim-flake.lib.neovimConfiguration {
      extraInputs = {
        inherit (inputs) nord;
      };
      modules = [ configModule ];
      inherit pkgs;
    };
  in {
    packages.${system}.neovim = customNeovim.neovim;
  };
}
jordanisaacs commented 1 year ago

Looks great just two things:

  1. Can you rename the file back to supported_themes.nix There were too many changes for git to pick it up as a file rename.
  2. Can you add a changelog to https://github.com/jordanisaacs/neovim-flake/blob/main/docs/release-notes/rl-0.1.adoc
antotocar34 commented 1 year ago

Should I squash into one commit?

jordanisaacs commented 1 year ago

Yep if you could squash it please. Otherwise lgtm!