chore: Simplify variable usage

Changes made:

- Preferred "inherits" where possible
- Removed unnecessary comments
- Added variables to avoid duplicate strings
- Reduced usage of "with x;"
This commit is contained in:
Donovan Glover 2024-04-05 13:28:23 -04:00
parent 41ce56718b
commit e2e8971eb3
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
10 changed files with 60 additions and 81 deletions

View File

@ -1,13 +1,16 @@
{ pkgs, ... }: { pkgs, ... }:
let
inherit (pkgs) libnotify papirus-icon-theme;
in
{ {
home.packages = with pkgs; [ libnotify ]; home.packages = [ libnotify ];
services.dunst = { services.dunst = {
enable = true; enable = true;
iconTheme = { iconTheme = {
package = pkgs.papirus-icon-theme; package = papirus-icon-theme;
name = "Papirus"; name = "Papirus";
}; };

View File

@ -2,6 +2,7 @@
let let
inherit (config.home) homeDirectory; inherit (config.home) homeDirectory;
inherit (config.xdg.userDirs) download documents music pictures videos;
in in
{ {
home.packages = with pkgs; [ eww ]; home.packages = with pkgs; [ eww ];
@ -10,11 +11,11 @@ in
(defwidget icons [] (defwidget icons []
(box :orientation "h" :spacing 32 (box :orientation "h" :spacing 32
(icon :img "default-user-home" :exec "${homeDirectory}") (icon :img "default-user-home" :exec "${homeDirectory}")
(icon :img "default-folder-download" :exec "${homeDirectory}/") (icon :img "default-folder-download" :exec "${download}")
(icon :img "default-folder-documents" :exec "${homeDirectory}/") (icon :img "default-folder-documents" :exec "${documents}")
(icon :img "default-folder-music" :exec "${homeDirectory}/") (icon :img "default-folder-music" :exec "${music}")
(icon :img "default-folder-pictures" :exec "${homeDirectory}/") (icon :img "default-folder-pictures" :exec "${pictures}")
(icon :img "default-folder-video" :exec "${homeDirectory}/"))) (icon :img "default-folder-video" :exec "${videos}")))
(defwidget icon [img exec] (defwidget icon [img exec]
(eventbox :cursor "pointer" :onclick "lnch thunar ''${exec}" :tooltip "''${exec}" (eventbox :cursor "pointer" :onclick "lnch thunar ''${exec}" :tooltip "''${exec}"

View File

@ -1,15 +1,21 @@
{ config, ... }: { config, ... }:
let
inherit (config.lib.stylix.colors) base01 base02 base05;
font = "Noto Sans CJK JP 16";
themeName = "base16";
in
{ {
xdg.dataFile = { xdg.dataFile = {
"fcitx5/themes/base16/theme.conf".text = with config.lib.stylix.colors; /* ini */ '' "fcitx5/themes/${themeName}/theme.conf".text = /* ini */ ''
[Metadata] [Metadata]
Name=base16 Name=${themeName}
Version=0.1 Version=0.1
ScaleWithDPI=True ScaleWithDPI=True
[InputPanel] [InputPanel]
Font=Noto Sans CJK JP 16 Font=${font}
NormalColor=#${base05} NormalColor=#${base05}
HighlightCandidateColor=#${base05} HighlightCandidateColor=#${base05}
HighlightColor=#${base05} HighlightColor=#${base05}
@ -104,23 +110,14 @@
force = true; force = true;
text = /* ini */ '' text = /* ini */ ''
[Hotkey] [Hotkey]
# Enumerate when press trigger key repeatedly
EnumerateWithTriggerKeys=True EnumerateWithTriggerKeys=True
# Temporally switch between first and current Input Method
AltTriggerKeys= AltTriggerKeys=
# Enumerate Input Method Forward
EnumerateForwardKeys= EnumerateForwardKeys=
# Enumerate Input Method Backward
EnumerateBackwardKeys= EnumerateBackwardKeys=
# Skip first input method while enumerating
EnumerateSkipFirst=False EnumerateSkipFirst=False
# Enumerate Input Method Group Forward
EnumerateGroupForwardKeys= EnumerateGroupForwardKeys=
# Enumerate Input Method Group Backward
EnumerateGroupBackwardKeys= EnumerateGroupBackwardKeys=
# Activate Input Method
ActivateKeys= ActivateKeys=
# Deactivate Input Method
DeactivateKeys= DeactivateKeys=
[Hotkey/TriggerKeys] [Hotkey/TriggerKeys]
@ -142,31 +139,18 @@
0=Control+Alt+P 0=Control+Alt+P
[Behavior] [Behavior]
# Active By Default
ActiveByDefault=False ActiveByDefault=False
# Share Input State
ShareInputState=No ShareInputState=No
# Show preedit in application
PreeditEnabledByDefault=True PreeditEnabledByDefault=True
# Show Input Method Information when switch input method
ShowInputMethodInformation=True ShowInputMethodInformation=True
# Show Input Method Information when changing focus
showInputMethodInformationWhenFocusIn=False showInputMethodInformationWhenFocusIn=False
# Show compact input method information
CompactInputMethodInformation=True CompactInputMethodInformation=True
# Show first input method information
ShowFirstInputMethodInformation=True ShowFirstInputMethodInformation=True
# Default page size
DefaultPageSize=5 DefaultPageSize=5
# Override Xkb Option
OverrideXkbOption=False OverrideXkbOption=False
# Custom Xkb Option
CustomXkbOption= CustomXkbOption=
# Force Enabled Addons
EnabledAddons= EnabledAddons=
# Force Disabled Addons
DisabledAddons= DisabledAddons=
# Preload input method to be used by default
PreloadInputMethod=True PreloadInputMethod=True
''; '';
}; };
@ -175,23 +159,16 @@
force = true; force = true;
text = /* ini */ '' text = /* ini */ ''
[Groups/0] [Groups/0]
# Group Name
Name="Group 1" Name="Group 1"
# Layout
Default Layout=us Default Layout=us
# Default Input Method
DefaultIM=mozc DefaultIM=mozc
[Groups/0/Items/0] [Groups/0/Items/0]
# Name
Name=keyboard-us Name=keyboard-us
# Layout
Layout= Layout=
[Groups/0/Items/1] [Groups/0/Items/1]
# Name
Name=mozc Name=mozc
# Layout
Layout= Layout=
[GroupOrder] [GroupOrder]
@ -199,44 +176,29 @@
''; '';
}; };
"fcitx5/conf/classicui.conf" = with config.lib.stylix.colors; { "fcitx5/conf/classicui.conf" = {
force = true; force = true;
text = /* ini */ '' text = /* ini */ ''
# Vertical Candidate List
Vertical Candidate List=False Vertical Candidate List=False
# Use Per Screen DPI
PerScreenDPI=True PerScreenDPI=True
# Use mouse wheel to go to prev or next page
WheelForPaging=True WheelForPaging=True
# Font Font="${font}"
Font="Noto Sans CJK JP 16" MenuFont="${font}"
# Menu Font TrayFont="${font}"
MenuFont="Noto Sans CJK JP 16"
# Tray Font
TrayFont="Noto Sans CJK JP Medium 16"
# Tray Label Outline Color
TrayOutlineColor=#${base02} TrayOutlineColor=#${base02}
# Tray Label Text Color
TrayTextColor=#${base05} TrayTextColor=#${base05}
# Prefer Text Icon
PreferTextIcon=False PreferTextIcon=False
# Show Layout Name In Icon
ShowLayoutNameInIcon=True ShowLayoutNameInIcon=True
# Use input method language to display text
UseInputMethodLangaugeToDisplayText=True UseInputMethodLangaugeToDisplayText=True
# Theme Theme=${themeName}
Theme=base16
''; '';
}; };
"fcitx5/conf/clipboard.conf" = { "fcitx5/conf/clipboard.conf" = {
force = true; force = true;
text = /* ini */ '' text = /* ini */ ''
# Trigger Key
TriggerKey= TriggerKey=
# Paste Primary
PastePrimaryKey= PastePrimaryKey=
# Number of entries
Number of entries=5 Number of entries=5
''; '';
}; };
@ -244,15 +206,10 @@
"fcitx5/conf/mozc.conf" = { "fcitx5/conf/mozc.conf" = {
force = true; force = true;
text = /* ini */ '' text = /* ini */ ''
# Initial Mode
InitialMode=Hiragana InitialMode=Hiragana
# Vertical candidate list
Vertical=True Vertical=True
# Expand Usage (Requires vertical candidate list)
ExpandMode="On Focus" ExpandMode="On Focus"
# Fix embedded preedit cursor at the beginning of the preedit
PreeditCursorPositionAtBeginning=False PreeditCursorPositionAtBeginning=False
# Hotkey to expand usage
ExpandKey=Control+Alt+H ExpandKey=Control+Alt+H
''; '';
}; };

View File

@ -1,9 +1,12 @@
{ pkgs, ... }: { pkgs, ... }:
let
inherit (pkgs) pinentry-curses;
in
{ {
programs.gpg = { programs.gpg = {
enable = true; enable = true;
# homedir = "${config.xdg.dataHome}/gnupg"
settings = { settings = {
personal-digest-preferences = "SHA512"; personal-digest-preferences = "SHA512";
cert-digest-algo = "SHA512"; cert-digest-algo = "SHA512";
@ -18,7 +21,7 @@
services.gpg-agent = { services.gpg-agent = {
enable = true; enable = true;
pinentryPackage = pkgs.pinentry-curses; pinentryPackage = pinentry-curses;
defaultCacheTtl = 43200; defaultCacheTtl = 43200;
maxCacheTtl = 43200; maxCacheTtl = 43200;
}; };

View File

@ -1,11 +1,14 @@
{ pkgs, ... }: { pkgs, ... }:
let
inherit (pkgs) phinger-cursors fluent-icon-theme;
in
{ {
gtk = { gtk = {
enable = true; enable = true;
cursorTheme = { cursorTheme = {
package = pkgs.phinger-cursors; package = phinger-cursors;
name = "phinger-cursors"; name = "phinger-cursors";
}; };
@ -19,7 +22,7 @@
}; };
iconTheme = { iconTheme = {
package = pkgs.fluent-icon-theme; package = fluent-icon-theme;
name = "Fluent-dark"; name = "Fluent-dark";
}; };
}; };

View File

@ -1,13 +1,13 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
inherit (builtins) attrValues toJSON; inherit (builtins) toJSON;
inherit (lib) singleton; inherit (lib) singleton;
inherit (config.lib.stylix.colors) base00 base01 base04 base05 base09;
inherit (pkgs) ironbar;
in in
{ {
home.packages = attrValues { home.packages = [ ironbar ];
inherit (pkgs) ironbar;
};
xdg.configFile."ironbar/config.json".text = toJSON { xdg.configFile."ironbar/config.json".text = toJSON {
name = "main"; name = "main";
@ -67,7 +67,7 @@ in
]; ];
}; };
xdg.configFile."ironbar/style.css".text = with config.lib.stylix.colors; /* css */ '' xdg.configFile."ironbar/style.css".text = /* css */ ''
* { * {
font-family: "Noto Sans CJK JP", "Font Awesome 6 Free Solid"; font-family: "Noto Sans CJK JP", "Font Awesome 6 Free Solid";
font-size: 16px; font-size: 16px;

View File

@ -1,5 +1,8 @@
{ config, ... }: { config, ... }:
let
inherit (config.lib.stylix.colors) base00;
in
{ {
programs.kitty = { programs.kitty = {
enable = true; enable = true;
@ -23,7 +26,7 @@
scrollback_pager = "less --chop-long-lines --raw-control-chars +INPUT_LINE_NUMBER"; scrollback_pager = "less --chop-long-lines --raw-control-chars +INPUT_LINE_NUMBER";
}; };
extraConfig = with config.lib.stylix.colors; '' extraConfig = ''
tab_bar_background #${base00} tab_bar_background #${base00}
inactive_tab_background #${base00} inactive_tab_background #${base00}
map F1 send_text all \x1afg;notify-send "$(pwd)" "Task Completed."\r map F1 send_text all \x1afg;notify-send "$(pwd)" "Task Completed."\r

View File

@ -1,5 +1,8 @@
{ pkgs, ... }: { pkgs, ... }:
let
inherit (pkgs.mpvScripts) mpris uosc thumbfast;
in
{ {
programs.mpv = { programs.mpv = {
enable = true; enable = true;
@ -35,7 +38,7 @@
"ctrl+a" = "script-message osc-visibility cycle"; "ctrl+a" = "script-message osc-visibility cycle";
}; };
scripts = with pkgs.mpvScripts; [ scripts = [
mpris mpris
uosc uosc
thumbfast thumbfast

View File

@ -1,11 +1,15 @@
{ pkgs, config, ... }: { pkgs, config, ... }:
let let
vim-nix-rummik = with pkgs.vimUtils; buildVimPlugin { inherit (pkgs) fetchFromGitHub;
pname = "vim-nix"; inherit (pkgs.vimUtils) buildVimPlugin;
version = "0def8020f152a51c011a707680780dac61a8989a"; inherit (config.lib.stylix.scheme) slug;
src = pkgs.fetchFromGitHub { vim-nix-rummik = buildVimPlugin {
pname = "vim-nix-rummik";
version = "2022-11-16";
src = fetchFromGitHub {
owner = "rummik"; owner = "rummik";
repo = "vim-nix"; repo = "vim-nix";
rev = "0def8020f152a51c011a707680780dac61a8989a"; rev = "0def8020f152a51c011a707680780dac61a8989a";
@ -406,7 +410,7 @@ in
{ {
plugin = base16-nvim; plugin = base16-nvim;
type = "lua"; type = "lua";
config = "vim.cmd('colorscheme base16-${config.lib.stylix.scheme.slug}')"; config = "vim.cmd('colorscheme base16-${slug}')";
} }
{ {
plugin = lualine-nvim; plugin = lualine-nvim;

View File

@ -5,6 +5,7 @@ let
inherit (config.modules.system) username; inherit (config.modules.system) username;
inherit (cfg) japanese bloat wine; inherit (cfg) japanese bloat wine;
inherit (builtins) attrValues; inherit (builtins) attrValues;
inherit (nix-config.packages.${pkgs.system}) aleo-fonts;
theme = "monokai"; theme = "monokai";
opacity = 0.95; opacity = 0.95;
@ -33,6 +34,7 @@ in
thunar = { thunar = {
enable = true; enable = true;
plugins = attrValues { plugins = attrValues {
inherit (pkgs.xfce) thunar-volman; inherit (pkgs.xfce) thunar-volman;
}; };
@ -169,7 +171,7 @@ in
fonts = with pkgs; { fonts = with pkgs; {
serif = { serif = {
package = (callPackage ../packages/aleo-fonts.nix { }); package = aleo-fonts;
name = "Aleo"; name = "Aleo";
}; };