-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Global enable and style options
- Loading branch information
1 parent
bf46b84
commit 028318b
Showing
15 changed files
with
127 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ lib, config, ... }: { | ||
mkTokyonightOpt = name: { | ||
enable = lib.mkEnableOpt "Tokyonight theme" // { | ||
default = config.tokyonight.enable; | ||
}; | ||
style = lib.mkOption { | ||
type = lib.types.enum [ "storm" "night" "moon" "day" ]; | ||
default = config.tokyonight.style; | ||
description = "Set the tokyonight colorscheme style variant to use."; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# this imports all files in a directory (besides default.nix) | ||
# with our modified arguments | ||
{ lib, pkgs, inputs, ... }@args: | ||
dir: | ||
let | ||
# instead of letting `evalModules` pass arguments to each file | ||
# in our list, we import them directly | ||
applyImports = file: _: | ||
import "${dir}/${file}" (args // { | ||
lib = | ||
lib.extend (final: _: { ctp = import ./. (args // { lib = final; }); }); | ||
|
||
defaultSources = import ../../.sources; | ||
}); | ||
in lib.pipe dir [ | ||
builtins.readDir | ||
builtins.attrNames | ||
(lib.remove "default.nix") | ||
(map applyImports) | ||
] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ inputs, config, lib, ... }: | ||
let cfg = config.programs.bat.tokyonight; | ||
in { | ||
options.programs.bat.tokyonight = { | ||
enable = lib.mkEnableOption "tokyonight colorscheme"; | ||
}; | ||
config = lib.mkMerge [ | ||
(lib.mkIf cfg.enable { | ||
programs.bat = { | ||
config.theme = "tokyonight_${cfg.style}"; | ||
themes.${"tokyonight_${cfg.style}"} = { | ||
src = "${inputs.tokyonight}/extras/sublime/"; | ||
file = "tokyonight_${cfg.style}.tmTheme"; | ||
}; | ||
}; | ||
}) | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
inputs: args: { | ||
imports = import ../lib/mkImports.nix (args // { inherit inputs; }) ./.; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ inputs, config, lib, ... }: | ||
let cfg = config.programs.git.delta.tokyonight; | ||
in { | ||
options.programs.git.delta.tokyonight = | ||
lib.mkTokyonightOpt "tokyonight git delta"; | ||
config = lib.mkMerge [ | ||
(lib.mkIf cfg.enable { | ||
programs.git = { | ||
includes = [{ | ||
path = | ||
"${inputs.tokyonight}/extras/delta/tokyonight_${cfg.style}.gitconfig"; | ||
}]; | ||
delta.options.features = "tokyonight_${cfg.style}"; | ||
}; | ||
}) | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
inputs: | ||
{ config, lib, ... }: | ||
let inherit (config.tokyonight) style; | ||
{ inputs, config, lib, ... }: | ||
let cfg = config.programs.fish.tokyonight; | ||
in { | ||
options.programs.fish.tokyonight = { | ||
enable = lib.mkEnableOption "tokyonight colorscheme"; | ||
}; | ||
config = lib.mkMerge [ | ||
(lib.mkIf config.programs.fish.tokyonight.enable { | ||
(lib.mkIf cfg.enable { | ||
programs.fish.interactiveShellInit = builtins.readFile | ||
"${inputs.tokyonight}/extras/fish/tokyonight_${style}.fish"; | ||
"${inputs.tokyonight}/extras/fish/tokyonight_${cfg.style}.fish"; | ||
}) | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ config, lib, pkgs, ... }: | ||
let cfg = config.programs.neovim.tokyonight; | ||
in { | ||
options.programs.neovim.tokyonight = (lib.mkTokyonightOpt "tokyonight neovim") | ||
// { | ||
extraLua = lib.mkOption { | ||
type = lib.types.lines; | ||
default = '' | ||
require('tokyonight').setup({ | ||
style = "${cfg.style}" | ||
}) | ||
''; | ||
example = '' | ||
require('tokyonight').setup({ | ||
-- if you use this option, you must | ||
-- set the style property yourself | ||
-- e.g. | ||
style = "night", | ||
}) | ||
''; | ||
description = | ||
"Configure tokyonight.nvim yourself; see https://github.com/folke/tokyonight.nvim?#%EF%B8%8F-configuration for options."; | ||
}; | ||
}; | ||
config = lib.mkMerge [ | ||
(lib.mkIf cfg.enable { | ||
programs.neovim = { | ||
plugins = [ pkgs.vimPlugins.tokyonight-nvim ]; | ||
extraLuaConfig = '' | ||
${if builtins.hasAttr "extraLua" | ||
config.programs.neovim.tokyonight then | ||
config.programs.neovim.tokyonight.extraLua | ||
else | ||
""} | ||
vim.cmd.colorscheme("tokyonight-${cfg.style}") | ||
''; | ||
}; | ||
}) | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters