My Nix Configuration

[modules.home] Update theming, wayland, and xdg modules

+2 -3
modules/home/theming/default.nix
···
pkgs,
config,
lib,
-
osConfig,
...
}:
let
-
osPro = osConfig.py.profiles;
in
{
catppuccin = {
flavor = "mocha";
accent = "blue";
};
-
gtk = lib.mkIf osPro.graphical.enable {
enable = true;
catppuccin = {
enable = true;
···
pkgs,
config,
lib,
...
}:
let
+
pro = config.py.profiles;
in
{
catppuccin = {
flavor = "mocha";
accent = "blue";
};
+
gtk = lib.mkIf pro.gui.enable {
enable = true;
catppuccin = {
enable = true;
+2 -1
modules/home/wayland/keybindings.nix
···
slurp-screen = "\"$(slurp -c -b '#1e1e2e80' -o -r)\" -";
slurp-box = "\"$(slurp -c '#f38ba8ff' -b '#1e1e2e80' -w 1 -d -F 'IBM Plex Mono')\" -";
satty = "satty -f -";
in
{
-
wayland.windowManager.sway.config.keybindings = lib.mkOptionDefault {
"${mod}+d" = "${menu}";
"${mod}+Shift+F" = "exec MOZ_DISABLE_RDD_SANDBOX=1 firefox";
"${mod}+Return" = "exec ${term}";
···
slurp-screen = "\"$(slurp -c -b '#1e1e2e80' -o -r)\" -";
slurp-box = "\"$(slurp -c '#f38ba8ff' -b '#1e1e2e80' -w 1 -d -F 'IBM Plex Mono')\" -";
satty = "satty -f -";
+
cfg = config.py.gui;
in
{
+
config.wayland.windowManager.sway.config.keybindings = lib.mkOptionDefault lib.mkIf cfg.enable {
"${mod}+d" = "${menu}";
"${mod}+Shift+F" = "exec MOZ_DISABLE_RDD_SANDBOX=1 firefox";
"${mod}+Return" = "exec ${term}";
+1 -1
modules/home/wayland/sway.nix
···
XDG_CURRENT_DESKTOP = "sway";
};
wayland.windowManager.sway = {
-
enable = true;
package = null;
catppuccin.enable = true;
# nix-community/home-manager/issues/5311
···
XDG_CURRENT_DESKTOP = "sway";
};
wayland.windowManager.sway = {
+
enable = lib.mkDefault true;
package = null;
catppuccin.enable = true;
# nix-community/home-manager/issues/5311
+6 -2
modules/home/wayland/swaylock.nix
···
{
-
programs.swaylock = {
-
enable = true;
catppuccin.enable = true;
settings = {
daemonize = true;
···
+
{ lib, config, ... }:
+
let
+
cfg = config.py.gui;
+
in
{
+
programs.swaylock = lib.mkIf cfg.enable {
+
enable = lib.mkDefault true;
catppuccin.enable = true;
settings = {
daemonize = true;
+37
modules/home/wayland/waybar-mocha.css
···
···
+
/*
+
*
+
* Catppuccin Mocha palette
+
* Maintainer: rubyowo
+
*
+
*/
+
+
@define-color base #1e1e2e;
+
@define-color mantle #181825;
+
@define-color crust #11111b;
+
+
@define-color text #cdd6f4;
+
@define-color subtext0 #a6adc8;
+
@define-color subtext1 #bac2de;
+
+
@define-color surface0 #313244;
+
@define-color surface1 #45475a;
+
@define-color surface2 #585b70;
+
+
@define-color overlay0 #6c7086;
+
@define-color overlay1 #7f849c;
+
@define-color overlay2 #9399b2;
+
+
@define-color blue #89b4fa;
+
@define-color lavender #b4befe;
+
@define-color sapphire #74c7ec;
+
@define-color sky #89dceb;
+
@define-color teal #94e2d5;
+
@define-color green #a6e3a1;
+
@define-color yellow #f9e2af;
+
@define-color peach #fab387;
+
@define-color maroon #eba0ac;
+
@define-color red #f38ba8;
+
@define-color mauve #cba6f7;
+
@define-color pink #f5c2e7;
+
@define-color flamingo #f2cdcd;
+
@define-color rosewater #f5e0dc;
+119
modules/home/wayland/waybar-style.css
···
···
+
@import "mocha.css";
+
#waybar {
+
font-family:
+
BlexMono Nerd Font,
+
sans-serif;
+
font-size: 16px;
+
}
+
+
#window {
+
padding: 0 10px;
+
}
+
+
window#waybar {
+
border: none;
+
border-radius: 0;
+
box-shadow: none;
+
text-shadow: none;
+
transition-duration: 0s;
+
color: @text;
+
background: @base;
+
}
+
+
#workspaces {
+
margin: 0 5px;
+
}
+
+
#workspaces button {
+
padding: 0 8px;
+
color: @text;
+
border: 2px solid @subtext0;
+
border-radius: 10px;
+
min-width: 25px;
+
margin-right: 8px;
+
}
+
+
#workspaces button.visible {
+
color: @subtext0;
+
}
+
+
#workspaces button.focused {
+
border: 3px solid @mauve;
+
}
+
+
#workspaces button.urgent {
+
background-color: @red;
+
}
+
+
#workspaces button:hover {
+
box-shadow: inherit;
+
border-color: @blue;
+
color: @blue;
+
}
+
+
/* Repeat style here to ensure properties are overwritten as there's no !important and button:hover above resets the colour */
+
+
#workspaces button.focused {
+
color: @subtext0;
+
}
+
#workspaces button.focused:hover {
+
color: @text;
+
}
+
+
#tray,
+
#mode,
+
#battery,
+
#temperature,
+
#cpu,
+
#memory,
+
#network,
+
#pulseaudio,
+
#clock,
+
#idle_inhibitor,
+
#sway-language,
+
#backlight {
+
padding: 2px 8px;
+
margin: 2px 5px;
+
color: @text;
+
}
+
+
#tray:hover,
+
#mode:hover,
+
#battery:hover,
+
#temperature:hover,
+
#cpu:hover,
+
#memory:hover,
+
#network:hover,
+
#pulseaudio:hover,
+
#clock:hover,
+
#idle_inhibitor:hover,
+
#sway-language:hover,
+
#backlight:hover {
+
padding: 2px 8px;
+
margin: 2px 5px;
+
color: @base;
+
background-color: @subtext1;
+
}
+
+
#clock {
+
font-weight: bold;
+
}
+
+
#battery.warning {
+
color: @yellow;
+
}
+
+
#battery.critical {
+
color: @red;
+
}
+
+
#battery.charging {
+
color: @green;
+
}
+
+
@keyframes blink {
+
to {
+
background-color: #ffffff;
+
color: black;
+
}
+
}
+144 -130
modules/home/wayland/waybar.nix
···
-
{ pkgs, lib, ... }:
{
-
programs.waybar = {
-
enable = true;
-
catppuccin.enable = false;
-
systemd.enable = true;
-
systemd.target = "sway-session.target";
-
# style = "/home/thehedgehog/.config/waybar/style.css"
-
settings = {
-
mainBar = {
-
layer = "top";
-
position = "top";
-
height = 32;
-
modules-left = [
-
"sway/workspaces"
-
"sway/mode"
-
];
-
modules-center = [ "custom/media" ];
-
modules-right = [
-
"idle_inhibitor"
-
"wireplumber"
-
"network"
-
"temperature"
-
"backlight"
-
"battery"
-
"clock"
-
"tray"
-
];
-
"sway/workspaces" = {
-
disable-scroll = true;
-
enable-bar-scroll = false;
-
active-only = false;
-
all-outputs = false;
-
format = "{icon}";
-
};
-
"idle_inhibitor" = {
-
format = "{icon}";
-
format-icons = {
-
"activated" = "";
-
"deactivated" = "";
-
};
-
};
-
"tray" = {
-
icon-size = 25;
-
spacing = 12;
-
};
-
"clock" = {
-
tooltip-format = "<tt><small>{calendar}</small></tt>";
-
format = "{:%H:%M:%S}  ";
-
format-alt = "{%d %b %Y}";
-
interval = 1;
-
};
-
"cpu" = {
-
format = "{usage}% ";
-
interval = 5;
-
tooltip = false;
-
};
-
"memory" = {
-
format = "{}% ";
-
};
-
"temperature" = {
-
critical-threshold = 80;
-
format = "{temperatureC}°C {icon}";
-
format-icons = [
-
""
-
""
-
""
-
""
-
""
];
-
};
-
"backlight" = {
-
format = "{percent}% {icon}";
-
format-icons = [
-
"󰃚"
-
"󰃛"
-
"󰃜"
-
"󰃝"
-
"󰃞"
-
"󰃟"
-
"󰃠"
];
-
};
-
"battery" = {
-
states = {
-
good = 80;
-
warning = 30;
-
critical = 15;
};
-
format = "{capacity}% {icon}";
-
format-charging = "{capacity}% 󰂄";
-
format-plugged = "{capacity}% ";
-
format-alt = "{time} {icon}";
-
format-icons = [
-
"󰂎"
-
"󰁺"
-
"󰁻"
-
"󰁼"
-
"󰁽"
-
"󰁾"
-
"󰁿"
-
"󰂀"
-
"󰂁"
-
"󰂂"
-
"󰁹"
-
];
-
};
-
"network" = {
-
format-wifi = "{essid} <big></big>";
-
format-ethernet = "{ifname}: {ipaddr}/{cidr} 󰈀";
-
format-linked = "{ifname} (No IP) 󰄡";
-
format-disconnected = "Disconnected! ⚠";
-
format-alt = "{ifname}: {ipaddr}/{cidr}";
-
on-click = lib.getExe pkgs.networkmanagerapplet;
-
};
-
"wireplumber" = {
-
format = "{volume}% {icon}";
-
format-muted = "󰝟";
-
format-icons = [
-
""
-
""
-
""
-
];
-
on-click = lib.getExe pkgs.helvum;
-
};
-
"custom/media" = {
-
format = "{icon}{}";
-
return-type = "json";
-
format-icons = {
-
Paused = " ";
-
Playing = " ";
};
-
max-length = 70;
-
exec = ''${lib.getExe pkgs.playerctl} -a metadata --format '{"text": "{{playerName}}: {{artist}} - {{markup_escape(title)}}", "tooltip": "{{playerName}} : {{markup_escape(title)}}", "alt": "{{status}}", "class": "{{status}}"}' -F'';
-
on-click = "${lib.getExe pkgs.playerctl} play-pause";
};
};
};
···
{
+
pkgs,
+
lib,
+
config,
+
...
+
}:
+
let
+
cfg = config.py.gui;
+
in
+
{
+
config = {
+
xdg.configFile."waybar/mocha.css" = lib.mkIf cfg.enable {
+
source = ./waybar-mocha.css;
+
recursive = false;
+
};
+
programs.waybar = lib.mkIf cfg.enable {
+
enable = lib.mkDefault true;
+
catppuccin.enable = false;
+
systemd.enable = true;
+
systemd.target = "sway-session.target";
+
style = ./waybar-style.css;
+
settings = {
+
mainBar = {
+
layer = "top";
+
position = "top";
+
height = 32;
+
modules-left = [
+
"sway/workspaces"
+
"sway/mode"
];
+
modules-center = [ "custom/media" ];
+
modules-right = [
+
"idle_inhibitor"
+
"wireplumber"
+
"network"
+
"temperature"
+
"backlight"
+
"battery"
+
"clock"
+
"tray"
];
+
"sway/workspaces" = {
+
disable-scroll = true;
+
enable-bar-scroll = false;
+
active-only = false;
+
all-outputs = false;
+
format = "{icon}";
};
+
"idle_inhibitor" = {
+
format = "{icon}";
+
format-icons = {
+
"activated" = "";
+
"deactivated" = "";
+
};
+
};
+
"tray" = {
+
icon-size = 25;
+
spacing = 12;
+
};
+
"clock" = {
+
tooltip-format = "<tt><small>{calendar}</small></tt>";
+
format = "{:%H:%M:%S}  ";
+
format-alt = "{%d %b %Y}";
+
interval = 1;
+
};
+
"cpu" = {
+
format = "{usage}% ";
+
interval = 5;
+
tooltip = false;
+
};
+
"memory" = {
+
format = "{}% ";
+
};
+
"temperature" = {
+
critical-threshold = 80;
+
format = "{temperatureC}°C {icon}";
+
format-icons = [
+
""
+
""
+
""
+
""
+
""
+
];
+
};
+
"backlight" = {
+
format = "{percent}% {icon}";
+
format-icons = [
+
"󰃚"
+
"󰃛"
+
"󰃜"
+
"󰃝"
+
"󰃞"
+
"󰃟"
+
"󰃠"
+
];
+
};
+
"battery" = {
+
states = {
+
good = 80;
+
warning = 30;
+
critical = 15;
+
};
+
format = "{capacity}% {icon}";
+
format-charging = "{capacity}% 󰂄";
+
format-plugged = "{capacity}% ";
+
format-alt = "{time} {icon}";
+
format-icons = [
+
"󰂎"
+
"󰁺"
+
"󰁻"
+
"󰁼"
+
"󰁽"
+
"󰁾"
+
"󰁿"
+
"󰂀"
+
"󰂁"
+
"󰂂"
+
"󰁹"
+
];
};
+
"network" = {
+
format-wifi = "{essid} <big></big>";
+
format-ethernet = "{ifname}: {ipaddr}/{cidr} 󰈀";
+
format-linked = "{ifname} (No IP) 󰄡";
+
format-disconnected = "Disconnected! ⚠";
+
format-alt = "{ifname}: {ipaddr}/{cidr}";
+
on-click = lib.getExe pkgs.networkmanagerapplet;
+
};
+
"wireplumber" = {
+
format = "{volume}% {icon}";
+
format-muted = "󰝟";
+
format-icons = [
+
""
+
""
+
""
+
];
+
on-click = lib.getExe pkgs.helvum;
+
};
+
"custom/media" = {
+
format = "{icon}{}";
+
return-type = "json";
+
format-icons = {
+
Paused = " ";
+
Playing = " ";
+
};
+
max-length = 70;
+
exec = ''${lib.getExe pkgs.playerctl} -a metadata --format '{"text": "{{playerName}}: {{artist}} - {{markup_escape(title)}}", "tooltip": "{{playerName}} : {{markup_escape(title)}}", "alt": "{{status}}", "class": "{{status}}"}' -F'';
+
on-click = "${lib.getExe pkgs.playerctl} play-pause";
+
};
};
};
};
+4 -5
modules/home/xdg/default.nix
···
config,
lib,
pkgs,
-
osConfig,
...
}:
let
homeDir = config.home.homeDirectory;
-
osPro = osConfig.py.profiles;
in
{
xdg = {
enable = true;
-
mime.enable = lib.mkIf osPro.graphical.enable true;
configHome = lib.mkForce "${homeDir}/.config";
dataHome = lib.mkForce "${homeDir}/.local/share";
-
portal = lib.mkIf osPro.graphical.enable {
enable = true;
xdgOpenUsePortal = true;
extraPortals = [
···
};
};
};
-
mimeApps = lib.mkIf osPro.graphical.enable {
enable = true;
associations.added = {
"application/pdf" = [ "firefox.desktop" ];
···
config,
lib,
pkgs,
...
}:
let
homeDir = config.home.homeDirectory;
+
pro = config.py.profiles;
in
{
xdg = {
enable = true;
+
mime.enable = lib.mkIf pro.gui.enable true;
configHome = lib.mkForce "${homeDir}/.config";
dataHome = lib.mkForce "${homeDir}/.local/share";
+
portal = lib.mkIf pro.gui.enable {
enable = true;
xdgOpenUsePortal = true;
extraPortals = [
···
};
};
};
+
mimeApps = lib.mkIf pro.gui.enable {
enable = true;
associations.added = {
"application/pdf" = [ "firefox.desktop" ];