kitty now changes color scheme inside of nix-shell
This commit is contained in:
26
flake.lock
generated
26
flake.lock
generated
@@ -125,11 +125,11 @@
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1732030699,
|
||||
"narHash": "sha256-SBosboLvLqDv+7mNgRTIYDQbHE61rDDkXTJWiRX3PPo=",
|
||||
"lastModified": 1732109232,
|
||||
"narHash": "sha256-iYh6h8yueU8IyOfNclbiBG2+fBFcjjUfXm90ZBzk0c0=",
|
||||
"owner": "nix-community",
|
||||
"repo": "disko",
|
||||
"rev": "da52cf40206d7d1a419d07640eb47b2fb9ac2c21",
|
||||
"rev": "a0c384e0a3b8bcaed30a6bcf3783f8a7c8b35be4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -490,11 +490,11 @@
|
||||
"xdph": "xdph"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731978971,
|
||||
"narHash": "sha256-P9DXCxDvjFt4aMc2x67hvSpNvSqX18X840w6cEVZXoo=",
|
||||
"lastModified": 1732100541,
|
||||
"narHash": "sha256-vFeNbKUstvSZbe9TD4bDYozZd+A/bKD+fxCye+p/Mp8=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "67cee430061626ccd73dc6d30eed9db289053608",
|
||||
"revCount": 5480,
|
||||
"rev": "940f7aa990dbc99815bab8d355999d8277534b17",
|
||||
"revCount": 5484,
|
||||
"submodules": true,
|
||||
"type": "git",
|
||||
"url": "https://github.com/hyprwm/Hyprland"
|
||||
@@ -886,11 +886,11 @@
|
||||
},
|
||||
"nur": {
|
||||
"locked": {
|
||||
"lastModified": 1732045661,
|
||||
"narHash": "sha256-SJW1HVIbav/8NlEFMqfiqrhaKcpbMqMFCTZ0cOikXgA=",
|
||||
"lastModified": 1732117323,
|
||||
"narHash": "sha256-QtvUTcCAfocg18O2V4VcnKn42tRooSuVC2S4s1rD8ek=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NUR",
|
||||
"rev": "8ee137273e4a24ac661b43a195848beac5b3bd04",
|
||||
"rev": "aa6fc91ec7d36fbd6c44f63e16cfbc89a993a3b8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -969,11 +969,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731989835,
|
||||
"narHash": "sha256-Y1S+x2jWLQB9hn4aG04/213ZlTp+30itKe9KcSsrFgw=",
|
||||
"lastModified": 1732076204,
|
||||
"narHash": "sha256-FnPuD4CnVos1vlHcLceBvv4hHkv2zHive7OzC4xy6ys=",
|
||||
"owner": "gerg-l",
|
||||
"repo": "spicetify-nix",
|
||||
"rev": "aac6c81489f61034916efa4ed62840dc1d72c413",
|
||||
"rev": "62ac6a2953a8bdfe7a0f7451f8a76ca1d73a6c9f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
right_format = "($custom)";
|
||||
|
||||
format = lib.concatStrings [
|
||||
"($ssh_symbol)($username)($hostname)(bold white)($cmd_duration)($character)"
|
||||
"($ssh_symbol)($username)($hostname)($nix_shell)(bold white)($cmd_duration)($character)"
|
||||
"($git_branch)($git_status)($rust)($nix-shell)"
|
||||
"($directory)"
|
||||
"$line_break[ > ](bold #89b4fa)"
|
||||
@@ -59,6 +59,11 @@
|
||||
format = "[@](bold blue)[$hostname](bold red)";
|
||||
};
|
||||
|
||||
nix_shell = {
|
||||
format = " via [$symbol]($style)";
|
||||
symbol = " ";
|
||||
};
|
||||
|
||||
custom.shellver = {
|
||||
command = "zsh --version";
|
||||
when = ''test $SHELL = "/run/current-system/sw/bin/zsh"'';
|
||||
|
||||
@@ -48,6 +48,7 @@ in {
|
||||
gtrash
|
||||
ripgrep
|
||||
toilet
|
||||
vkbasalt
|
||||
] ++ scripts;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -20,6 +20,11 @@ in
|
||||
export RESULT
|
||||
echo "\$RESULT = $RESULT"
|
||||
}
|
||||
nix-shell() {
|
||||
# set an environment variable to track if you're in a nix shell or not
|
||||
trap 'NIX_SHELL=false kitty_theme' EXIT
|
||||
NIX_SHELL=true command nix-shell "$@" --run zsh
|
||||
}
|
||||
nvim() {
|
||||
${shellsound} ${sndpath}/nvim.wav
|
||||
command nvim "$@"
|
||||
@@ -29,9 +34,11 @@ in
|
||||
command ssh "$@"
|
||||
kitty_ssh_theme
|
||||
}
|
||||
kitty_ssh_theme() {
|
||||
kitty_theme() {
|
||||
if [ -n "$SSH_CONNECTION" ]; then
|
||||
kitty @ set-colors -a ~/.config/kitty/ssh-theme.conf
|
||||
elif [ "$name" = "nix-shell-env" ] || [ "$NIX_SHELL" = "true" ]; then
|
||||
kitty @ set-colors -a ~/.config/kitty/nix-shell-theme.conf
|
||||
else
|
||||
kitty @ set-colors -a ~/.config/kitty/default-theme.conf
|
||||
fi
|
||||
@@ -154,7 +161,7 @@ in
|
||||
autoload -U down-line-or-beginning-search; zle -N down-line-or-beginning-search
|
||||
|
||||
bindkey -v
|
||||
kitty_ssh_theme
|
||||
kitty_theme
|
||||
type starship_zle-keymap-select >/dev/null || \
|
||||
{
|
||||
eval "$(starship init zsh)"
|
||||
|
||||
@@ -3,28 +3,34 @@
|
||||
# This folder is for programs that do not have existing configuration modules in NixOS.
|
||||
# Basically a to-do list for stuff I need to write my own modules for.
|
||||
let
|
||||
# Custom theme that activates in ssh
|
||||
ssh_base16 = "atelier-cave";
|
||||
# Extract color scheme from base_16 yaml file
|
||||
extractSchemeFromYaml = base16_scheme: let
|
||||
scheme_path = "${pkgs.base16-schemes}/share/themes/${base16_scheme}.yaml";
|
||||
scheme_string = builtins.readFile scheme_path;
|
||||
scheme_list = lib.splitString "\n" scheme_string;
|
||||
colors =
|
||||
lib.filter (line: builtins.match "^ *base[0-9A-F]{2}: .*" line != null)
|
||||
scheme_list;
|
||||
parsed_scheme = lib.lists.foldl' (acc: line:
|
||||
let
|
||||
splitLine = lib.splitString ": " line;
|
||||
key = builtins.elemAt splitLine 0;
|
||||
value = builtins.elemAt splitLine 1;
|
||||
trimmedKey = lib.trim key;
|
||||
cleanValue_step1 = lib.splitString " " value;
|
||||
cleanValue_step2 = builtins.elemAt cleanValue_step1 0;
|
||||
cleanValue_final =
|
||||
builtins.substring 1 (builtins.stringLength cleanValue_step2 - 2)
|
||||
cleanValue_step2;
|
||||
in acc // { "${trimmedKey}" = cleanValue_final; }) { } colors;
|
||||
in parsed_scheme;
|
||||
|
||||
ssh_scheme = extractSchemeFromYaml "atelier-cave" ;
|
||||
nix-shell_scheme = extractSchemeFromYaml "apathy";
|
||||
def_scheme = config.lib.stylix.colors;
|
||||
|
||||
scheme_path = "${pkgs.base16-schemes}/share/themes/${ssh_base16}.yaml";
|
||||
scheme_string = builtins.readFile scheme_path;
|
||||
scheme_list = lib.splitString "\n" "${scheme_string}";
|
||||
colors =
|
||||
lib.filter (line: builtins.match "^ *base[0-9A-F]{2}: .*" line != null)
|
||||
scheme_list;
|
||||
ssh_scheme = lib.lists.foldl' (acc: line:
|
||||
let
|
||||
splitLine = lib.splitString ": " line;
|
||||
key = builtins.elemAt splitLine 0;
|
||||
value = builtins.elemAt splitLine 1;
|
||||
trimmedKey = lib.trim key;
|
||||
cleanValue_step1 = lib.splitString " " value;
|
||||
cleanValue_step2 = builtins.elemAt cleanValue_step1 0;
|
||||
cleanValue_final =
|
||||
builtins.substring 1 (builtins.stringLength cleanValue_step2 - 2)
|
||||
cleanValue_step2;
|
||||
in acc // { "${trimmedKey}" = cleanValue_final; }) { } colors;
|
||||
|
||||
# Custom theme for nix-shell
|
||||
in {
|
||||
options = {
|
||||
movOpts.homeFiles.enable =
|
||||
@@ -210,6 +216,41 @@ in {
|
||||
color14 #${ssh_scheme.base0F}
|
||||
color15 #${ssh_scheme.base07}
|
||||
'';
|
||||
".config/kitty/nix-shell-theme.conf".text = ''
|
||||
background #${nix-shell_scheme.base00}
|
||||
foreground #${nix-shell_scheme.base05}
|
||||
selection_background #${nix-shell_scheme.base05}
|
||||
selection_foreground #${nix-shell_scheme.base00}
|
||||
url_color #${nix-shell_scheme.base04}
|
||||
cursor #${nix-shell_scheme.base05}
|
||||
active_border_color #${nix-shell_scheme.base03}
|
||||
inactive_border_color #${nix-shell_scheme.base01}
|
||||
active_tab_background #${nix-shell_scheme.base00}
|
||||
active_tab_foreground #${nix-shell_scheme.base05}
|
||||
inactive_tab_background #${nix-shell_scheme.base01}
|
||||
inactive_tab_foreground #${nix-shell_scheme.base04}
|
||||
tab_bar_background #${nix-shell_scheme.base01}
|
||||
|
||||
# normal
|
||||
color0 #${nix-shell_scheme.base01}
|
||||
color1 #${nix-shell_scheme.base08}
|
||||
color2 #${nix-shell_scheme.base0B}
|
||||
color3 #${nix-shell_scheme.base0A}
|
||||
color4 #${nix-shell_scheme.base0D}
|
||||
color5 #${nix-shell_scheme.base0E}
|
||||
color6 #${nix-shell_scheme.base0C}
|
||||
color7 #${nix-shell_scheme.base05}
|
||||
|
||||
# bright
|
||||
color8 #${nix-shell_scheme.base03}
|
||||
color9 #${nix-shell_scheme.base09}
|
||||
color10 #${nix-shell_scheme.base01}
|
||||
color11 #${nix-shell_scheme.base02}
|
||||
color12 #${nix-shell_scheme.base04}
|
||||
color13 #${nix-shell_scheme.base06}
|
||||
color14 #${nix-shell_scheme.base0F}
|
||||
color15 #${nix-shell_scheme.base07}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
./barbar.nix
|
||||
./cmp.nix
|
||||
./lsp.nix
|
||||
./rustaceanvim.nix
|
||||
./fidget.nix
|
||||
./lualine.nix
|
||||
./nvim-lightbulb.nix
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
nvim-surround.enable = true;
|
||||
rainbow-delimiters.enable = true;
|
||||
render-markdown.enable = true;
|
||||
rustaceanvim.enable = true;
|
||||
treesitter.enable = true;
|
||||
trim.enable = true;
|
||||
trouble.enable = true;
|
||||
|
||||
10
modules/home/programs/nixvim/plugins/rustaceanvim.nix
Normal file
10
modules/home/programs/nixvim/plugins/rustaceanvim.nix
Normal file
@@ -0,0 +1,10 @@
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
programs.nixvim.plugins.rustaceanvim = {
|
||||
enable = true;
|
||||
settings = {
|
||||
server.auto_attach = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -2,8 +2,7 @@
|
||||
pkgs.writeShellApplication {
|
||||
name = "nsp";
|
||||
text = ''
|
||||
#!/run/current-system/sw/bin/bash
|
||||
|
||||
nix-shell -p "$@" --run zsh
|
||||
trap 'NIX_SHELL=false kitty_theme' exit
|
||||
NIX_SHELL=true command nix-shell -p "$@" --run zsh
|
||||
'';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user