Using Nix Colors For Dynamic Theme Switching

This commit is contained in:
Tyler Kelley 2024-01-14 01:27:50 -06:00
parent 46993c8189
commit ed47377be5
5 changed files with 509 additions and 282 deletions

55
config/kitty.nix Normal file
View File

@ -0,0 +1,55 @@
{ pkgs, config, ... }:
{
# Configure Kitty
programs.kitty = {
enable = true;
package = pkgs.kitty;
font.name = "JetBrainsMono Nerd Font";
font.size = 16;
settings = {
scrollback_lines = 2000;
wheel_scroll_min_lines = 1;
window_padding_width = 6;
confirm_os_window_close = 0;
background_opacity = "0.85";
};
extraConfig = ''
foreground ${base15}
background ${base00}
color0 ${base00}
color8 ${base00}
color1 ${base01}
color9 ${base09}
color2 ${base02}
color10 ${base0A}
color3 ${base03}
color11 ${base0B}
color4 ${base04}
color12 ${base0C}
color5 ${base05}
color13 ${base0D}
color6 ${base06}
color14 ${base0E}
color7 ${base07}
color15 ${base0F}
cursor ${base07}
cursor_text_color ${base00}
selection_foreground none
selection_background ${base08}
url_color ${base02}
active_border_color ${base04}
inactive_border_color ${base00}
bell_border_color ${base03}
tab_bar_style fade
tab_fade 1
active_tab_foreground ${base04}
active_tab_background ${base00}
active_tab_font_style bold
inactive_tab_foreground ${base07}
inactive_tab_background ${base08}
inactive_tab_font_style bold
tab_bar_background ${base00}
'';
};
}

232
config/waybar.nix Normal file
View File

@ -0,0 +1,232 @@
{ pkgs, config, ... }:
{
# Configure & Theme Waybar
programs.waybar = {
enable = true;
package = pkgs.waybar;
settings = [{
layer = "top";
position = "top";
modules-left = [ "hyprland/window" ];
modules-center = [ "network" "pulseaudio" "cpu" "hyprland/workspaces" "memory" "disk" "clock" ];
modules-right = [ "custom/notification" "tray" ];
"hyprland/workspaces" = {
format = "{icon}";
format-icons = {
default = " ";
active = " ";
urgent = " ";
};
on-scroll-up = "hyprctl dispatch workspace e+1";
on-scroll-down = "hyprctl dispatch workspace e-1";
};
"clock" = {
format = "{: %I:%M %p}";
tooltip = false;
};
"hyprland/window" = {
max-length = 60;
separate-outputs = false;
};
"memory" = {
interval = 5;
format = " {}%";
tooltip = true;
};
"cpu" = {
interval = 5;
format = " {usage:2}%";
tooltip = true;
};
"disk" = {
format = " {free}";
tooltip = true;
};
"network" = {
format-icons = ["󰤯" "󰤟" "󰤢" "󰤥" "󰤨"];
format-ethernet = ": {bandwidthDownOctets} : {bandwidthUpOctets}";
format-wifi = "{icon} {signalStrength}%";
format-disconnected = "󰤮";
tooltip = false;
};
"tray" = {
spacing = 12;
};
"pulseaudio" = {
format = "{icon} {volume}% {format_source}";
format-bluetooth = "{volume}% {icon} {format_source}";
format-bluetooth-muted = " {icon} {format_source}";
format-muted = " {format_source}";
format-source = " {volume}%";
format-source-muted = "";
format-icons = {
headphone = "";
hands-free = "";
headset = "";
phone = "";
portable = "";
car = "";
default = ["" "" ""];
};
on-click = "pavucontrol";
};
"custom/notification" = {
tooltip = false;
format = "{icon} {}";
format-icons = {
notification = "<span foreground='red'><sup></sup></span>";
none = "";
dnd-notification = "<span foreground='red'><sup></sup></span>";
dnd-none = "";
inhibited-notification = "<span foreground='red'><sup></sup></span>";
inhibited-none = "";
dnd-inhibited-notification = "<span foreground='red'><sup></sup></span>";
dnd-inhibited-none = "";
};
return-type = "json";
exec-if = "which swaync-client";
exec = "swaync-client -swb";
on-click = "task-waybar";
escape = true;
};
"battery" = {
states = {
warning = 30;
critical = 15;
};
format = "{icon} {capacity}%";
format-charging = "󰂄 {capacity}%";
format-plugged = "󱘖 {capacity}%";
format-icons = ["󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"];
on-click = "";
tooltip = false;
};
}];
style = ''
* {
font-size: 16px;
font-family: JetBrainsMono Nerd Font, Font Awesome, sans-serif;
font-weight: bold;
}
window#waybar {
background-color: rgba(26,27,38,0);
border-bottom: 1px solid rgba(26,27,38,0);
border-radius: 0px;
color: ${base0F};
}
#workspaces {
background: linear-gradient(180deg, ${base00}, ${base08});
margin: 5px;
padding: 0px 1px;
border-radius: 15px;
border: 0px;
font-style: normal;
color: ${base00};
}
#workspaces button {
padding: 0px 5px;
margin: 4px 3px;
border-radius: 15px;
border: 0px;
color: ${base00};
background-color: ${base00};
opacity: 1.0;
transition: all 0.3s ease-in-out;
}
#workspaces button.active {
color: ${base00};
background: ${base04};
border-radius: 15px;
min-width: 40px;
transition: all 0.3s ease-in-out;
opacity: 1.0;
}
#workspaces button:hover {
color: ${base00};
background: ${base04};
border-radius: 15px;
opacity: 1.0;
}
tooltip {
background: ${base00};
border: 1px solid ${base04};
border-radius: 10px;
}
tooltip label {
color: ${base07};
}
#window {
color: ${base06};
background: ${base00};
border-radius: 0px 15px 50px 0px;
margin: 5px 5px 5px 0px;
padding: 2px 20px;
}
#memory {
color: ${base05};
background: ${base00};
border-radius: 15px 50px 15px 50px;
margin: 5px;
padding: 2px 20px;
}
#clock {
color: ${base07};
background: ${base00};
border-radius: 15px 50px 15px 50px;
margin: 5px;
padding: 2px 20px;
}
#cpu {
color: ${base05};
background: ${base00};
border-radius: 50px 15px 50px 15px;
margin: 5px;
padding: 2px 20px;
}
#disk {
color: ${base02};
background: ${base00};
border-radius: 15px 50px 15px 50px;
margin: 5px;
padding: 2px 20px;
}
#battery {
color: ${base01};
background: ${base00};
border-radius: 15px;
margin: 5px;
padding: 2px 20px;
}
#network {
color: ${base03};
background: ${base00};
border-radius: 50px 15px 50px 15px;
margin: 5px;
padding: 2px 20px;
}
#tray {
color: ${base07};
background: ${base00};
border-radius: 15px 0px 0px 50px;
margin: 5px 0px 5px 5px;
padding: 2px 20px;
}
#pulseaudio {
color: ${base05};
background: ${base00};
border-radius: 50px 15px 50px 15px;
margin: 5px;
padding: 2px 20px;
}
#custom-notification {
color: ${base04};
background: ${base00};
border-radius: 15px 50px 15px 50px;
margin: 5px;
padding: 2px 20px;
}
'';
};
}

211
flake.lock generated Normal file
View File

@ -0,0 +1,211 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1704980875,
"narHash": "sha256-IPZmMjk5f4TBbEpzUFBc3OC1W6OwDNEXk2w/0uVXX1o=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "5f0ab0eedc6ede69beb8f45561ffefa54edc6e65",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-23.11",
"repo": "home-manager",
"type": "github"
}
},
"hyprland": {
"inputs": {
"hyprland-protocols": "hyprland-protocols",
"nixpkgs": "nixpkgs",
"systems": "systems",
"wlroots": "wlroots",
"xdph": "xdph"
},
"locked": {
"lastModified": 1705070596,
"narHash": "sha256-Xq3JOddIH7AnACEHGaSKg71IF8CATE1zSTzdgR4pnlo=",
"owner": "hyprwm",
"repo": "Hyprland",
"rev": "c4da4b026deefd58f532353b64e9f17130e760ca",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "Hyprland",
"type": "github"
}
},
"hyprland-protocols": {
"inputs": {
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1691753796,
"narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=",
"owner": "hyprwm",
"repo": "hyprland-protocols",
"rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-protocols",
"type": "github"
}
},
"hyprlang": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1704287638,
"narHash": "sha256-TuRXJGwtK440AXQNl5eiqmQqY4LZ/9+z/R7xC0ie3iA=",
"owner": "hyprwm",
"repo": "hyprlang",
"rev": "6624f2bb66d4d27975766e81f77174adbe58ec97",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprlang",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1704194953,
"narHash": "sha256-RtDKd8Mynhe5CFnVT8s0/0yqtWFMM9LmCzXv/YKxnq4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "bd645e8668ec6612439a9ee7e71f7eac4099d4f6",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1702645756,
"narHash": "sha256-qKI6OR3TYJYQB3Q8mAZ+DG4o/BR9ptcv9UnRV2hzljc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "40c3c94c241286dd2243ea34d3aef8a488f9e4d0",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1704874635,
"narHash": "sha256-YWuCrtsty5vVZvu+7BchAxmcYzTMfolSPP5io8+WYCg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "3dc440faeee9e889fe2d1b4d25ad0f430d449356",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"hyprland": "hyprland",
"nixpkgs": "nixpkgs_3"
}
},
"systems": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
}
},
"wlroots": {
"flake": false,
"locked": {
"host": "gitlab.freedesktop.org",
"lastModified": 1703963193,
"narHash": "sha256-ke8drv6PTrdQDruWbajrRJffP9A9PU6FRyjJGNZRTs4=",
"owner": "wlroots",
"repo": "wlroots",
"rev": "f81c3d93cd6f61b20ae784297679283438def8df",
"type": "gitlab"
},
"original": {
"host": "gitlab.freedesktop.org",
"owner": "wlroots",
"repo": "wlroots",
"rev": "f81c3d93cd6f61b20ae784297679283438def8df",
"type": "gitlab"
}
},
"xdph": {
"inputs": {
"hyprland-protocols": [
"hyprland",
"hyprland-protocols"
],
"hyprlang": "hyprlang",
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1704400467,
"narHash": "sha256-IsEAKBCorRlN53FwFAMbyGLRsPVu/ZrWEJtCwykPds8=",
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"rev": "1c802128f6cc3db29a8ef01552b1a22f894eeefd",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View File

@ -6,6 +6,7 @@
home-manager.url = "github:nix-community/home-manager/release-23.11"; home-manager.url = "github:nix-community/home-manager/release-23.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
hyprland.url = "github:hyprwm/Hyprland"; hyprland.url = "github:hyprwm/Hyprland";
nix-colors.url = "github:misterio77/nix-colors";
}; };
outputs = inputs@{ nixpkgs, home-manager, ... }: outputs = inputs@{ nixpkgs, home-manager, ... }:

292
home.nix
View File

@ -1,4 +1,4 @@
{ config, pkgs, username, gitUsername, gitEmail, ... }: { config, pkgs, inputs, username, gitUsername, gitEmail, ... }:
{ {
# Home Manager Settings # Home Manager Settings
@ -6,6 +6,15 @@
home.homeDirectory = "/home/${username}"; home.homeDirectory = "/home/${username}";
home.stateVersion = "23.11"; home.stateVersion = "23.11";
# Set The Colorscheme
colorScheme = inputs.nix-colors.colorSchemes.gruvbox-dark-medium;
imports = [
inputs.nix-colors.homeManagerModules.default
./config/waybar.nix
./config/kitty.nix
];
# Place Files Inside Home Directory # Place Files Inside Home Directory
home.file.".config/zaney-stinger.mov".source = ./media/zaney-stinger.mov; home.file.".config/zaney-stinger.mov".source = ./media/zaney-stinger.mov;
home.file.".config/pipewire/pipewire.conf".source = ./config/pipewire/pipewire.conf; home.file.".config/pipewire/pipewire.conf".source = ./config/pipewire/pipewire.conf;
@ -143,286 +152,5 @@
}; };
}; };
# Configure Kitty
programs.kitty = {
enable = true;
package = pkgs.kitty;
font.name = "JetBrainsMono Nerd Font";
font.size = 16;
settings = {
scrollback_lines = 2000;
wheel_scroll_min_lines = 1;
window_padding_width = 6;
confirm_os_window_close = 0;
background_opacity = "0.85";
};
extraConfig = ''
foreground #a9b1d6
background #1a1b26
color0 #414868
color8 #414868
color1 #f7768e
color9 #f7768e
color2 #73daca
color10 #73daca
color3 #e0af68
color11 #e0af68
color4 #7aa2f7
color12 #7aa2f7
color5 #bb9af7
color13 #bb9af7
color6 #7dcfff
color14 #7dcfff
color7 #c0caf5
color15 #c0caf5
cursor #c0caf5
cursor_text_color #1a1b26
selection_foreground none
selection_background #28344a
url_color #9ece6a
active_border_color #3d59a1
inactive_border_color #101014
bell_border_color #e0af68
tab_bar_style fade
tab_fade 1
active_tab_foreground #3d59a1
active_tab_background #16161e
active_tab_font_style bold
inactive_tab_foreground #787c99
inactive_tab_background #16161e
inactive_tab_font_style bold
tab_bar_background #101014
'';
};
# Configure & Theme Waybar
programs.waybar = {
enable = true;
package = pkgs.waybar;
settings = [{
layer = "top";
position = "top";
modules-left = [ "hyprland/window" ];
modules-center = [ "network" "pulseaudio" "cpu" "hyprland/workspaces" "memory" "disk" "clock" ];
modules-right = [ "custom/notification" "tray" ];
"hyprland/workspaces" = {
format = "{icon}";
format-icons = {
default = " ";
active = " ";
urgent = " ";
};
on-scroll-up = "hyprctl dispatch workspace e+1";
on-scroll-down = "hyprctl dispatch workspace e-1";
};
"clock" = {
format = "{: %I:%M %p}";
tooltip = false;
};
"hyprland/window" = {
max-length = 60;
separate-outputs = false;
};
"memory" = {
interval = 5;
format = " {}%";
tooltip = true;
};
"cpu" = {
interval = 5;
format = " {usage:2}%";
tooltip = true;
};
"disk" = {
format = " {free}";
tooltip = true;
};
"network" = {
format-icons = ["󰤯" "󰤟" "󰤢" "󰤥" "󰤨"];
format-ethernet = ": {bandwidthDownOctets} : {bandwidthUpOctets}";
format-wifi = "{icon} {signalStrength}%";
format-disconnected = "󰤮";
tooltip = false;
};
"tray" = {
spacing = 12;
};
"pulseaudio" = {
format = "{icon} {volume}% {format_source}";
format-bluetooth = "{volume}% {icon} {format_source}";
format-bluetooth-muted = " {icon} {format_source}";
format-muted = " {format_source}";
format-source = " {volume}%";
format-source-muted = "";
format-icons = {
headphone = "";
hands-free = "";
headset = "";
phone = "";
portable = "";
car = "";
default = ["" "" ""];
};
on-click = "pavucontrol";
};
"custom/notification" = {
tooltip = false;
format = "{icon} {}";
format-icons = {
notification = "<span foreground='red'><sup></sup></span>";
none = "";
dnd-notification = "<span foreground='red'><sup></sup></span>";
dnd-none = "";
inhibited-notification = "<span foreground='red'><sup></sup></span>";
inhibited-none = "";
dnd-inhibited-notification = "<span foreground='red'><sup></sup></span>";
dnd-inhibited-none = "";
};
return-type = "json";
exec-if = "which swaync-client";
exec = "swaync-client -swb";
on-click = "task-waybar";
escape = true;
};
"battery" = {
states = {
warning = 30;
critical = 15;
};
format = "{icon} {capacity}%";
format-charging = "󰂄 {capacity}%";
format-plugged = "󱘖 {capacity}%";
format-icons = ["󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"];
on-click = "";
tooltip = false;
};
}];
style = ''
* {
font-size: 16px;
font-family: JetBrainsMono Nerd Font, Font Awesome, sans-serif;
font-weight: bold;
}
window#waybar {
background-color: rgba(26,27,38,0);
border-bottom: 1px solid rgba(26,27,38,0);
border-radius: 0px;
color: #f8f8f2;
}
#workspaces {
background: linear-gradient(180deg, #414868, #24283b);
margin: 5px;
padding: 0px 1px;
border-radius: 15px;
border: 0px;
font-style: normal;
color: #15161e;
}
#workspaces button {
padding: 0px 5px;
margin: 4px 3px;
border-radius: 15px;
border: 0px;
color: #15161e;
background-color: #1a1b26;
opacity: 1.0;
transition: all 0.3s ease-in-out;
}
#workspaces button.active {
color: #15161e;
background: #7aa2f7;
border-radius: 15px;
min-width: 40px;
transition: all 0.3s ease-in-out;
opacity: 1.0;
}
#workspaces button:hover {
color: #15161e;
background: #7aa2f7;
border-radius: 15px;
opacity: 1.0;
}
tooltip {
background: #1a1b26;
border: 1px solid #7aa2f7;
border-radius: 10px;
}
tooltip label {
color: #c0caf5;
}
#window {
color: #565f89;
background: #1a1b26;
border-radius: 0px 15px 50px 0px;
margin: 5px 5px 5px 0px;
padding: 2px 20px;
}
#memory {
color: #2ac3de;
background: #1a1b26;
border-radius: 15px 50px 15px 50px;
margin: 5px;
padding: 2px 20px;
}
#clock {
color: #c0caf5;
background: #1a1b26;
border-radius: 15px 50px 15px 50px;
margin: 5px;
padding: 2px 20px;
}
#cpu {
color: #b4f9f8;
background: #1a1b26;
border-radius: 50px 15px 50px 15px;
margin: 5px;
padding: 2px 20px;
}
#disk {
color: #9ece6a;
background: #1a1b26;
border-radius: 15px 50px 15px 50px;
margin: 5px;
padding: 2px 20px;
}
#battery {
color: #f7768e;
background: #1a1b26;
border-radius: 15px;
margin: 5px;
padding: 2px 20px;
}
#network {
color: #ff9e64;
background: #1a1b26;
border-radius: 50px 15px 50px 15px;
margin: 5px;
padding: 2px 20px;
}
#tray {
color: #bb9af7;
background: #1a1b26;
border-radius: 15px 0px 0px 50px;
margin: 5px 0px 5px 5px;
padding: 2px 20px;
}
#pulseaudio {
color: #bb9af7;
background: #1a1b26;
border-radius: 50px 15px 50px 15px;
margin: 5px;
padding: 2px 20px;
}
#custom-notification {
color: #7dcfff;
background: #1a1b26;
border-radius: 15px 50px 15px 50px;
margin: 5px;
padding: 2px 20px;
}
'';
};
programs.home-manager.enable = true; programs.home-manager.enable = true;
} }