Add helix theme switching
parent
8574b348a1
commit
25e6aecd5c
|
@ -52,8 +52,8 @@
|
|||
end
|
||||
end
|
||||
'';
|
||||
environment.variables.SHELL = "${pkgs.fish}/bin/fish";
|
||||
environment.loginShell = "${pkgs.fish}/bin/fish";
|
||||
environment.variables.SHELL = "/run/current-system/sw/bin/fish";
|
||||
environment.loginShell = "/run/current-system/sw/bin/fish";
|
||||
|
||||
# Install and setup ZSH to work with nix(-darwin) as well
|
||||
programs.zsh.enable = true;
|
||||
|
|
|
@ -287,6 +287,7 @@
|
|||
files = import ./home/files.nix;
|
||||
fish = import ./home/fish.nix;
|
||||
git = import ./home/git.nix;
|
||||
helix = import ./home/helix.nix;
|
||||
kitty = import ./home/kitty.nix;
|
||||
programs = import ./home/programs.nix;
|
||||
starship = import ./home/starship.nix;
|
||||
|
@ -298,8 +299,8 @@
|
|||
darwin.fullCopies = true;
|
||||
};
|
||||
# modules
|
||||
# TODO: migrate to helix
|
||||
# programs-kakoune-extras = import ./modules/home/programs/kakoune/extras.nix;
|
||||
programs-kakoune-extras = import ./modules/home/programs/kakoune/extras.nix; # currently unused
|
||||
programs-helix-extras = import ./modules/home/programs/helix/extras.nix;
|
||||
programs-kitty-extras = import ./modules/home/programs/kitty/extras.nix;
|
||||
home-primary-user = { lib, ... }: {
|
||||
options.home.primaryUser =
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
}
|
||||
];
|
||||
|
||||
home.file."${config.xdg.configHome}/fish/fish_plugins".text = ''
|
||||
xdg.configFile."fish/fish_plugins".text = ''
|
||||
jorgebucaran/autopair.fish
|
||||
jorgebucaran/replay.fish
|
||||
jorgebucaran/getopts.fish
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.helix.enable = true;
|
||||
|
||||
programs.helix.package = pkgs.helix-flake;
|
||||
|
||||
programs.helix.settings = {
|
||||
editor.bufferline = "multiple";
|
||||
editor.color-modes = true;
|
||||
editor.indent-guides.render = true;
|
||||
editor.indent-guides.skip-levels = 1;
|
||||
editor.line-number = "relative";
|
||||
editor.whitespace.render = {
|
||||
space = "none";
|
||||
tab = "all";
|
||||
newline = "all";
|
||||
};
|
||||
};
|
||||
|
||||
programs.helix.extras.autoTheme = {
|
||||
enable = true;
|
||||
light = "rose_pine_dawn";
|
||||
dark = "rose_pine";
|
||||
};
|
||||
|
||||
home.sessionVariables = {
|
||||
EDITOR = "hx";
|
||||
};
|
||||
}
|
|
@ -5,9 +5,7 @@ let
|
|||
in
|
||||
{
|
||||
# Programs + packages with configuration --------------------------------------------------------------- {{{
|
||||
home.sessionVariables = {
|
||||
EDITOR = "hx";
|
||||
} // lib.optionalAttrs pkgs.stdenv.isDarwin {
|
||||
home.sessionVariables = lib.optionalAttrs pkgs.stdenv.isDarwin {
|
||||
SSH_AUTH_SOCK = secretiveAuthSocket;
|
||||
};
|
||||
programs = {
|
||||
|
@ -26,14 +24,6 @@ in
|
|||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
helix = {
|
||||
enable = true;
|
||||
package = pkgs.helix-flake;
|
||||
settings = {
|
||||
theme = "rose_pine";
|
||||
editor.indent-guides.render = true;
|
||||
};
|
||||
};
|
||||
nix-index = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.programs.helix;
|
||||
inherit (cfg) extras;
|
||||
tomlFormat = pkgs.formats.toml { };
|
||||
inherit (lib) mkIf mkEnableOption mkOption types;
|
||||
in
|
||||
{
|
||||
options.programs.helix.extras = {
|
||||
autoTheme.enable = mkEnableOption "Automatically switch helix theme with night mode";
|
||||
|
||||
autoTheme.light = mkOption {
|
||||
type = types.str;
|
||||
description = "Light mode theme";
|
||||
};
|
||||
|
||||
autoTheme.dark = mkOption {
|
||||
type = types.str;
|
||||
description = "Dark mode theme";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (cfg.enable && extras.autoTheme.enable) {
|
||||
xdg.configFile = {
|
||||
"helix/light.toml".source = tomlFormat.generate "helix-autotheme" (cfg.settings // { theme = extras.autoTheme.light; });
|
||||
"helix/dark.toml".source = tomlFormat.generate "helix-autotheme" (cfg.settings // { theme = extras.autoTheme.dark; });
|
||||
};
|
||||
|
||||
programs.fish.shellAbbrs = {
|
||||
hxl = "${cfg.package} --config ${config.xdg.configHome}/helix/light.toml";
|
||||
hxd = "${cfg.package} --config ${config.xdg.configHome}/helix/dark.toml";
|
||||
};
|
||||
|
||||
programs.fish.functions = {
|
||||
hx = {
|
||||
description = "Helix invocation wrapper to automatically select the right theme";
|
||||
body = ''
|
||||
if is-dark-mode
|
||||
hxd $argv
|
||||
else
|
||||
hxl $argv
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,5 +1,3 @@
|
|||
# TODO: migrate this to helix
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
|
Loading…
Reference in New Issue