Skip to content

Commit

Permalink
[alacritty] Extract code to a separate module
Browse files Browse the repository at this point in the history
  • Loading branch information
sestrella committed May 30, 2024
1 parent 5a723ca commit 979276c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 26 deletions.
27 changes: 1 addition & 26 deletions home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

# Custom configuration
imports = [
./home/alacritty
./home/bat
./home/git
./home/home-manager
Expand Down Expand Up @@ -45,19 +46,6 @@

home.sessionVariables.SHELL = "${pkgs.fish}/bin/fish";

programs.alacritty = {
enable = true;
settings = {
import = [ "~/.config/alacritty/theme.yml" ];
font.normal = {
family = "FiraCode Nerd Font Mono";
style = "Medium";
};
font.size = 16;
shell.program = "${pkgs.fish}/bin/fish";
};
};

programs.direnv.enable = true;

programs.fzf.enable = true;
Expand Down Expand Up @@ -89,17 +77,4 @@
programs.starship.enable = true;

programs.zoxide.enable = true;

home.activation.alacrittyTheme = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
theme() {
local style=$(/usr/bin/defaults read -g AppleInterfaceStyle 2> /dev/null || echo "Light")
if [ "$style" == "Dark" ]; then
echo "${pkgs.alacritty-theme}/solarized_dark.yaml"
else
echo "${pkgs.alacritty-theme}/solarized_light.yaml"
fi
}
ln -sf "$(theme)" ~/.config/alacritty/theme.yml
'';
}
29 changes: 29 additions & 0 deletions home/alacritty/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{ lib, pkgs, ... }:

{
programs.alacritty = {
enable = true;
settings = {
import = [ "~/.config/alacritty/theme.yml" ];
font.normal = {
family = "FiraCode Nerd Font Mono";
style = "Medium";
};
font.size = 16;
shell.program = "${pkgs.fish}/bin/fish";
};
};

home.activation.alacrittyTheme = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
theme() {
local style=$(/usr/bin/defaults read -g AppleInterfaceStyle 2> /dev/null || echo "Light")
if [ "$style" == "Dark" ]; then
echo "${pkgs.alacritty-theme}/solarized_dark.yaml"
else
echo "${pkgs.alacritty-theme}/solarized_light.yaml"
fi
}
ln -sf "$(theme)" ~/.config/alacritty/theme.yml
'';
}

0 comments on commit 979276c

Please sign in to comment.