Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add contrib integrations to home-manager module #31

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion module/default.nix
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ imports = [ ./colorscheme.nix ]; }
{ imports = [ ./colorscheme.nix ./integrations.nix ]; }
66 changes: 66 additions & 0 deletions module/integrations.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
pkgs,
lib,
config,
...
}:
with lib; let
cfg = config.colorSchemeIntegrations;

lib-contrib = import ../lib/contrib {inherit pkgs;};

shellTheme = lib-contrib.shellThemeFromScheme {scheme = config.colorScheme;};
in {
options.colorSchemeIntegrations = {
bash.enable = mkEnableOption "the shell theme for bash";
zsh.enable = mkEnableOption "the shell theme for zsh";
fish.enable = mkEnableOption "the shell theme for fish";
gtk.enable = mkEnableOption "the GTK theme";
vim.enable = mkEnableOption "the vim theme";
gnomeNixWallpaper = {
enable = mkEnableOption "the Gnome Nix wallpaper";
width = mkOption {
type = types.ints.positive;
};
height = mkOption {
type = types.ints.positive;
};
logoScale = mkOption {
type = types.numbers.nonnegative;
default = 5.0;
};
};
};

config = {
programs.bash.initExtra = mkIf cfg.bash.enable ''
sh ${shellTheme}
'';

programs.zsh.initExtra = mkIf cfg.zsh.enable ''
sh ${shellTheme}
'';

programs.fish.interactiveShellInit = mkIf cfg.fish.enable ''
sh ${shellTheme}
'';

gtk.theme.package = mkIf cfg.gtk.enable (lib-contrib.gtkThemeFromScheme {
scheme = config.colorScheme;
});

programs.vim.plugins = mkIf cfg.vim.enable [
{
plugin = lib-contrib.vimThemeFromScheme {scheme = config.colorScheme;};
config = "colorscheme ${config.colorScheme.slug}";
}
];

dconf.settings."org/gnome/desktop/background" = mkIf cfg.gnomeNixWallpaper.enable {
picture-uri = builtins.toString (lib-contrib.nixWallpaperFromScheme {
scheme = config.colorScheme;
inherit (cfg.gnomeNixWallpaper) width height logoScale;
});
};
};
}