From 6fada03cd5e223aa9c111e7073118692065a7ee1 Mon Sep 17 00:00:00 2001 From: "Adam M. Szalkowski" Date: Fri, 7 Mar 2025 09:22:25 +0100 Subject: [PATCH] nvf: init (#939) Link: https://github.com/danth/stylix/pull/939 Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com> --- modules/nvf/darwin.nix | 1 + modules/nvf/hm.nix | 1 + modules/nvf/nixos.nix | 1 + modules/nvf/nvf.nix | 60 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+) create mode 100644 modules/nvf/darwin.nix create mode 100644 modules/nvf/hm.nix create mode 100644 modules/nvf/nixos.nix create mode 100644 modules/nvf/nvf.nix diff --git a/modules/nvf/darwin.nix b/modules/nvf/darwin.nix new file mode 100644 index 00000000..458d0464 --- /dev/null +++ b/modules/nvf/darwin.nix @@ -0,0 +1 @@ +import ./nvf.nix diff --git a/modules/nvf/hm.nix b/modules/nvf/hm.nix new file mode 100644 index 00000000..458d0464 --- /dev/null +++ b/modules/nvf/hm.nix @@ -0,0 +1 @@ +import ./nvf.nix diff --git a/modules/nvf/nixos.nix b/modules/nvf/nixos.nix new file mode 100644 index 00000000..458d0464 --- /dev/null +++ b/modules/nvf/nixos.nix @@ -0,0 +1 @@ +import ./nvf.nix diff --git a/modules/nvf/nvf.nix b/modules/nvf/nvf.nix new file mode 100644 index 00000000..fc134182 --- /dev/null +++ b/modules/nvf/nvf.nix @@ -0,0 +1,60 @@ +{ + config, + lib, + options, + ... +}: +let + cfg = config.stylix.targets.nvf; +in +{ + options.stylix.targets.nvf = { + enable = config.lib.stylix.mkEnableTarget "nvf" true; + plugin = lib.mkOption { + type = lib.types.enum [ + "base16" + "mini-base16" + ]; + default = "base16"; + description = "Plugin used for the colorscheme"; + }; + transparentBackground = lib.mkEnableOption "background transparency for the main Neovim window"; + }; + + config = + lib.mkIf (config.stylix.enable && cfg.enable && options.programs ? nvf) + ( + lib.optionalAttrs (options.programs ? nvf) { + programs.nvf.settings.vim = { + theme = { + enable = true; + name = cfg.plugin; + base16-colors = { + inherit (config.lib.stylix.colors.withHashtag) + base00 + base01 + base02 + base03 + base04 + base05 + base06 + base07 + base08 + base09 + base0A + base0B + base0C + base0D + base0E + base0F + ; + }; + transparent = cfg.transparentBackground; + }; + statusline = lib.mkIf (cfg.plugin == "base16") { + lualine.theme = "base16"; + }; + }; + } + ); +}