nix/home/home.nix
2023-08-10 16:03:36 +10:00

871 lines
23 KiB
Nix

{
inputs,
outputs,
lib,
config,
pkgs,
nur,
...
}: let
palette-hex = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette;
palette-shex = pkgs.lib.nix-rice.palette.toRGBShortHex pkgs.rice.palette;
in {
home.stateVersion = "22.11";
imports = [
inputs.ironbar.homeManagerModules.default
# ./programs/eww/default.nix
];
home.packages = with pkgs;
[
thunderbird
strawberry
inkscape
xfce.thunar
feh
zathura
btop
bat
ripgrep
fd
lazygit
fzf
zoxide
zellij
glib # for gsettings
grim
slurp
swaybg
wlogout
libnotify
xorg.xrdb
swayidle
swaynotificationcenter
gtklock
playerctl
kooha
nyxt
culr
swayosd
fuzzel
kdeconnect
keepassxc
git-credential-keepassxc
direnv
mpv
# libsForQt5.qtstyleplugin-kvantum
gtk-engine-murrine
]
++ pkgs.rice.fonts.pkgs
++ pkgs.rice.icons.pkgs;
systemd.user.targets.tray = {
Unit = {
Description = "Home Manager System Tray";
Requires = ["graphical-session-pre.target"];
};
};
fonts.fontconfig.enable = true;
services.syncthing = {
enable = true;
};
services.udiskie.enable = true;
programs.ironbar = with pkgs.rice; {
enable = true;
config = {
anchor_to_edges = true;
position = "top";
height = 10;
icon_theme = icons.name;
start = [
{ type = "workspaces"; all_monitors = true; }
{ type = "sys_info";
interval.memory = 30;
interval.cpu = 1;
format = [
" {cpu_percent}%"
" {memory_used} / {memory_total} GB"
];
}
];
center = [
{ type = "focused"; icon_size = 10; }
];
end = [
{ type = "music";
player_type = "mpris";
on_click_middle = "playerctl play-pause";
on_scroll_up = "playerctl volume +5";
on_scroll_down = "playerctl volume -5";
}
{ type = "clock"; }
];
};
style = with palette-hex; (builtins.replaceStrings
[
"#BG"
"#DARKBG"
"#BORDER"
"#ACTIVEBORDER"
"#TEXT"
"#URGENT"
"#FONT"
"#SZFONT"
]
[
util.bg
normal.black
normal.black
normal.black
# normal.yellow
# bright.yellow
util.fg
normal.red
fonts.sans.name
(builtins.toString fonts.sans.size)
]
(builtins.readFile dots/ironbar.css));
};
wayland.windowManager.sway = {
enable = true;
package = pkgs.sway;
config = with pkgs.rice; {
bars = [];
# reintroduces flicker
# output = {
# "*" = {
# adaptive_sync = "on";
# };
# };
focus = {
mouseWarping = "container";
wrapping = "no";
};
fonts = with fonts; {
names = [sans.name emoji.name];
size = 10.0;
};
gaps = {
inner = borders.gaps_in;
outer = borders.gaps_out;
smartGaps = true;
smartBorders = "no_gaps";
};
window = {
border = borders.thickness;
hideEdgeBorders = "smart";
titlebar = false;
};
workspaceAutoBackAndForth = false;
input = {
"*" = {
accel_profile = "flat";
pointer_accel = "0.0";
xkb_options = "caps:escape";
};
};
startup = [
{command = "mullvad connect";}
{command = "swaybg -i $HOME/.nix/wallpaper.png -m fill";}
{command = "ckb-next -c -b";}
{command = "xrdb -l ~/.Xresources";}
{command = "swayosd --max-volume 100";}
{command = "keepassxc";}
{command = "swaync";}
];
terminal = "kitty";
modifier = "Mod4";
keybindings = {
"Mod4+Return" = "exec kitty";
"Mod4+d" = "exec fuzzel";
"Mod4+e" = "exec thunar";
"Mod4+f" = "exec firefox";
"Mod4+Shift+e" = "exec wlogout";
"Mod4+Shift+s" = "exec grim -g \"$(slurp)\" -t png -o \"$HOME/Pictures/$(date +%F_%H-%m-%S).png\" && notify-send \"Screenshot taken.\"";
"Mod4+Shift+Ctrl+s" = "exec kooha";
"Mod4+n" = "exec swaync-client -t";
"Mod4+Space" = "floating toggle; move absolute position center";
"Mod4+c" = "focus floating; move absolute position center";
"Mod4+Shift+Space" = "fullscreen toggle";
"Mod4+a" = "focus parent";
"Mod4+Shift+a" = "focus child";
"Mod4+h" = "focus left";
"Mod4+j" = "focus down";
"Mod4+k" = "focus up";
"Mod4+l" = "focus right";
"Mod4+Shift+h" = "move left";
"Mod4+Shift+j" = "move down";
"Mod4+Shift+k" = "move up";
"Mod4+Shift+l" = "move right";
"Mod4+1" = "workspace 1";
"Mod4+Shift+1" = "move container to workspace 1";
"Mod4+2" = "workspace 2";
"Mod4+Shift+2" = "move container to workspace 2";
"Mod4+3" = "workspace 3";
"Mod4+Shift+3" = "move container to workspace 3";
"Mod4+4" = "workspace 4";
"Mod4+Shift+4" = "move container to workspace 4";
"Mod4+r" = "mode resize";
"Mod4+Shift+minus" = "move scratchpad";
"Mod4+minus" = "scratchpad show";
"Mod4+Shift+q" = "kill";
"Mod4+Shift+v" = "split horizontal";
"Mod4+v" = "split vertical";
"XF86AudioMute" = "exec swayosd --output-volume mute-toggle";
"XF86AudioRaiseVolume" = "exec swayosd --output-volume raise";
"XF86AudioLowerVolume" = "exec swayosd --output-volume lower";
"XF86AudioStop" = "exec playerctl stop";
"XF86AudioPlay" = "exec playerctl play-pause";
"XF86AudioPrev" = "exec playerctl previous";
"XF86AudioNext" = "exec playerctl next";
"XF86MonBrightnessUp" = "exec swayosd --brightness raise";
"XF86MonBrightnessDown" = "exec swayosd --brightness lower";
};
menu = "fuzzel";
colors = with palette-hex; {
background = util.bg;
focused = {
background = util.bg;
border = bright.yellow;
childBorder = bright.yellow;
indicator = normal.blue;
text = util.fg;
};
focusedInactive = {
background = normal.black;
border = normal.blue;
childBorder = normal.blue;
indicator = normal.blue;
text = normal.white;
};
placeholder = {
background = util.bg;
border = bright.green;
childBorder = bright.green;
indicator = normal.blue;
text = util.fg;
};
unfocused = {
background = normal.black;
border = util.bg;
childBorder = util.bg;
indicator = normal.blue;
text = normal.white;
};
urgent = {
background = normal.red;
border = normal.red;
childBorder = normal.red;
indicator = normal.red;
text = normal.blue;
};
};
};
systemd.enable = true;
wrapperFeatures = {
base = true;
gtk = true;
};
xwayland = true;
};
# extraConfig = with pkgs.rice; (builtins.replaceStrings
# [
# "#BGIMAGE"
# "#GTKTHEME"
# "#FONT"
# "#ICONTHEME"
# "#ACTIVEBORDER"
# "#BORDER"
# "#THICK"
# "#ROUND"
# "#GAPSIN"
# "#GAPSOUT"
# ]
# [
# "${bg.image}"
# gtk-theme.name
# fonts.sans.name
# icons.name
# palette-shex.bright.yellow
# palette-shex.util.bg
# (builtins.toString borders.thickness)
# (builtins.toString borders.rounding)
# (builtins.toString borders.gaps_in)
# (builtins.toString borders.gaps_out)
# ]
# (builtins.readFile dots/hyprland/hyprland.conf));
programs.starship = {
enable = true;
settings = {
# format = "$directory$os$all";
directory = {
truncate_to_repo = false;
};
};
};
# programs.eww-custom = {
# enable = true;
# package = pkgs.eww-wayland;
# colors = with palette-hex; (builtins.replaceStrings
# [
# "#BLACK"
# "#BLCKA"
# "#RED"
# "#RDA"
# "#GREEN"
# "#GRNA"
# "#YELLOW"
# "#YLWA"
# "#BLUE"
# "#BLUA"
# "#MAGENTA"
# "#MGNA"
# "#CYAN"
# "#CYNA"
# "#WHITE"
# "#WHTA"
# "#FG"
# "#BG"
# ]
# [
# normal.black
# bright.black
# normal.red
# bright.red
# normal.green
# bright.green
# normal.yellow
# bright.yellow
# normal.blue
# bright.blue
# normal.magenta
# bright.magenta
# normal.cyan
# bright.cyan
# normal.white
# bright.white
# util.fg
# util.bg
# ] (builtins.readFile dots/eww/colors.scss));
# };
systemd.user.startServices = "sd-switch";
xdg.enable = true;
xresources.properties = with palette-hex; {
"*.foreground" = util.fg;
"*.background" = util.bg;
"*.cursorColor" = util.cursor;
"*.selection_foreground" = util.fg_sel;
"*.selection_background" = util.bg_sel;
"*.color0" = normal.black;
"*.color1" = normal.red;
"*.color2" = normal.green;
"*.color3" = normal.yellow;
"*.color4" = normal.blue;
"*.color5" = normal.magenta;
"*.color6" = normal.cyan;
"*.color7" = normal.white;
"*.color8" = bright.black;
"*.color9" = bright.red;
"*.color10" = bright.green;
"*.color11" = bright.yellow;
"*.color12" = bright.blue;
"*.color13" = bright.magenta;
"*.color14" = bright.cyan;
"*.color15" = bright.white;
};
xdg.configFile =
builtins.mapAttrs (name: value: {
enable = true;
text = builtins.readFile value;
})
{
"swaync/config.json" = dots/swaync/config.json;
"swaync/configSchema.json" = dots/swaync/configSchema.json;
}
// {
"swaync/style.css" = {
enable = true;
text = with palette-hex; (builtins.replaceStrings
[
"#PANELBG"
"#BORDER"
"#NOTIBGNORM"
"#NOTIBGHOVER"
"#NOTIBGFOCUS"
"#NOTIBGCLOSE"
"#NOTIBGHVERCLOSE"
"#BGSELECTED"
"#FONT"
]
[
util.bg
normal.black
util.bg
bright.black
bright.black
normal.black
bright.black
bright.black
pkgs.rice.fonts.sans.name
]
(builtins.readFile dots/swaync/style.css));
};
};
xdg.systemDirs.data = [
"${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}"
"${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}"
];
programs.wlogout = {
enable = true;
layout = builtins.fromJSON (builtins.readFile dots/wlogout/layout);
style = with palette-hex; (builtins.replaceStrings
[
"/usr/share/wlogout"
"/etc/wlogout"
"#WINBG"
"#BTNCOL"
"#BTNBG"
"#BTNFOCUSBG"
]
[
"${pkgs.wlogout}/share/wlogout"
"${pkgs.wlogout}/etc/wlogout"
util.bg
bright.yellow
util.bg
normal.black
]
(builtins.readFile dots/wlogout/style.css));
};
programs.fuzzel = with pkgs.rice; {
enable = true;
settings = {
main = {
dpi-aware = "no";
font = with fonts.sans; lib.strings.concatStrings [name ":size=" (builtins.toString (size + 2))];
icon-theme = icons.name;
terminal = "kitty";
};
dmenu = {
exit-immediately-if-empty = "yes";
};
border = with borders; {
width = thickness;
radius = rounding;
};
colors = {
background = lib.strings.concatStrings [palette-hex.util.bg "A0"];
text = lib.strings.concatStrings [palette-hex.util.fg "FF"];
selection = lib.strings.concatStrings [palette-hex.bright.yellow "FF"];
selection-text = lib.strings.concatStrings [palette-hex.util.bg "FF"];
selection-match = lib.strings.concatStrings [palette-hex.normal.green "FF"];
match = lib.strings.concatStrings [palette-hex.bright.green "FF"];
border = lib.strings.concatStrings [palette-hex.bright.yellow "FF"];
};
};
};
gtk = with pkgs.rice; {
enable = true;
theme = with gtk-theme; {
inherit package name;
};
iconTheme = with icons; {
inherit package name;
};
font = with fonts.sans; {
inherit name size package;
};
};
programs.direnv = {
enable = true;
nix-direnv = {
enable = true;
};
};
programs.firefox = {
enable = true;
profiles.default = {
id = 0;
name = "Default";
settings = {
"browser.startup.homepage" = "about:blank";
};
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
vimium-c
darkreader
localcdn
ublock-origin
keepassxc-browser
user-agent-string-switcher
];
};
};
programs.helix = {
enable = true;
themes = with palette-hex; {
nix-rice = {
"attribute" = bright.cyan;
"keyword" = {fg = normal.red;};
"keyword.directive" = normal.red;
"namespace" = bright.cyan;
"punctuation" = bright.yellow;
"punctuation.delimiter" = bright.yellow;
"operator" = bright.magenta;
"special" = normal.magenta;
"variable.other.member" = bright.blue;
"variable" = util.fg;
"variable.builtin" = bright.yellow;
"variable.parameter" = bright.white;
"type" = normal.yellow;
"type.builtin" = normal.yellow;
"constructor" = {
fg = bright.magenta;
modifiers = ["bold"];
};
"function" = {
fg = normal.green;
modifiers = ["bold"];
};
"function.macro" = bright.cyan;
"function.builtin" = normal.yellow;
"tag" = normal.red;
"comment" = {
fg = normal.magenta;
modifiers = ["italic"];
};
"constant" = {fg = bright.magenta;};
"constant.builtin" = {
fg = bright.magenta;
modifiers = ["bold"];
};
"string" = normal.green;
"constant.numeric" = bright.magenta;
"constant.character.escape" = {
fg = bright.white;
modifiers = ["bold"];
};
"label" = bright.cyan;
"module" = bright.cyan;
"diff.plus" = bright.green;
"diff.delta" = bright.yellow;
"diff.minus" = bright.red;
"warning" = bright.yellow;
"error" = bright.red;
"info" = bright.cyan;
"hint" = bright.blue;
"ui.background" = {bg = util.bg;};
"ui.linenr" = {fg = normal.cyan;};
"ui.linenr.selected" = {
fg = normal.yellow;
modifiers = ["bold"];
};
"ui.cursorline" = {bg = normal.black;};
"ui.statusline" = {
fg = util.fg;
bg = bright.black;
};
"ui.statusline.normal" = {
fg = util.fg;
bg = bright.black;
};
"ui.statusline.insert" = {
fg = util.fg;
bg = normal.blue;
};
"ui.statusline.select" = {
fg = util.fg;
bg = bright.yellow;
};
"ui.statusline.inactive" = {
fg = normal.white;
bg = normal.black;
};
"ui.popup" = {bg = normal.black;};
"ui.window" = {bg = normal.black;};
"ui.help" = {
bg = normal.black;
fg = util.fg;
};
"ui.text" = {fg = util.fg;};
"ui.text.focus" = {fg = util.fg;};
"ui.selection" = {
# modifiers = ["reversed"];
bg = bright.yellow;
};
"ui.selection.primary" = {modifiers = ["reversed"];};
# "ui.selection.primary" = { bg = bright.cyan; };
"ui.cursor.primary" = {
bg = normal.white;
fg = normal.black;
};
"ui.cursor.match" = {bg = bright.cyan;};
"ui.menu" = {
fg = util.fg;
bg = bright.black;
};
"ui.menu.selected" = {
fg = bright.black;
bg = bright.blue;
modifiers = ["bold"];
};
"ui.virtual.whitespace" = bright.black;
"ui.virtual.ruler" = {bg = normal.black;};
"ui.virtual.inlay-hint" = {fg = normal.magenta;};
"diagnostic.warning" = {
underline = {
color = bright.yellow;
style = "curl";
};
};
"diagnostic.error" = {
underline = {
color = bright.red;
style = "curl";
};
};
"diagnostic.info" = {
underline = {
color = bright.cyan;
style = "curl";
};
};
"diagnostic.hint" = {
underline = {
color = bright.blue;
style = "curl";
};
};
"markup.heading" = bright.cyan;
"markup.bold" = {modifiers = ["bold"];};
"markup.italic" = {modifiers = ["italic"];};
"markup.strikethrough" = {modifiers = ["crossed_out"];};
"markup.link.url" = {
fg = bright.green;
modifiers = ["underlined"];
};
"markup.link.text" = bright.red;
"markup.raw" = bright.red;
# old theme
# "ui.background" = { bg = util.bg; };
# "ui.menu" = { fg = bright.cyan; bg = normal.black; };
# "ui.menu.selected" = { modifiers = [ "reversed" ]; };
# "ui.linenr" = { fg = bright.cyan; bg = normal.black; };
# "ui.popup" = { bg = bright.black; };
# "ui.linenr.selected" = { fg = normal.yellow; bg = normal.black; modifiers = [ "bold" ]; };
# "ui.selection" = { fg = bright.yellow; bg = normal.blue; };
# "ui.selection.primary" = { modifiers = [ "reversed" ]; };
# "comment" = { fg = bright.magenta; modifiers = [ "italics" ]; };
# "ui.statusline" = { fg = bright.cyan; bg = normal.black; };
# "ui.statusline.inactive" = { modifiers = [ "reversed" ]; };
# "ui.help" = { fg = normal.white; bg = bright.black; };
# # "ui.cursor" = { modifiers = [ "reversed" ]; };
# "variable" = normal.green;
# "variable.builtin" = normal.green;
# "constant.numeric" = normal.blue;
# "constant" = normal.cyan;
# "constant" = { fg = normal.cyan; modifiers = ["bold"]; };
# "attributes" = normal.yellow;
# "type" = normal.yellow;
# "ui.cursor.match" = { fg = normal.yellow; modifiers = [ "underlined" ]; };
# "string" = normal.green;
# "variable.other.member" = normal.red;
# "constant.character.escape" = { fg = normal.cyan; modifiers = ["bold"]; };
# "function" = { bright.blue; modifiers = ["bold"]; };
# "constructor" = { fg = normal.blue; modifiers = ["bold"]; };
# "special" = normal.blue;
# "keyword" = normal.magenta;
# "label" = normal.magenta;
# "namespace" = normal.blue;
# "diff.plus" = normal.green;
# "diff.delta" = normal.yellow;
# "diff.minus" = normal.red;
# "diagnostic" = { modifiers = [ "underlined" ]; };
# "ui.gutter" = { bg = normal.black; };
# "info" = normal.blue;
# "hint" = normal.magenta;
# "debug" = normal.magenta;
# "warning" = normal.yellow;
# "error" = normal.red;
};
};
settings = {
theme = "nix-rice";
editor.lsp.display-messages = true;
};
languages = {
language = [
{
name = "rust";
config = {
cargo = {
buildScripts = {
enable = true;
};
};
procMacro = {
enable = true;
};
check = {
command = "clippy"; # as i walk through the valley of the sha
};
};
}
];
};
};
programs.kitty = with pkgs.rice; {
enable = true;
font = with fonts; {
name = monospace.name;
size = monospace.size;
};
settings = with palette-hex; {
foreground = util.fg;
background = util.bg;
cursor = util.cursor;
cursor_text = util.bg;
selection_foreground = util.fg_sel;
selection_background = util.bg_sel;
color0 = normal.black;
color1 = normal.red;
color2 = normal.green;
color3 = normal.yellow;
color4 = normal.blue;
color5 = normal.magenta;
color6 = normal.cyan;
color7 = normal.white;
color8 = bright.black;
color9 = bright.red;
color10 = bright.green;
color11 = bright.yellow;
color12 = bright.blue;
color13 = bright.magenta;
color14 = bright.cyan;
color15 = bright.white;
sync_to_monitor = "yes";
};
};
programs.git = {
enable = true;
userName = "atagen";
userEmail = "atagen@boss.co";
extraConfig = {
credential.helper = "keepassxc";
};
};
programs.fzf = {
enable = true;
enableZshIntegration = true;
colors = with palette-hex; {
fg = util.fg;
bg = util.bg;
hl = util.bg_sel;
"fg+" = util.fg_sel;
"bg+" = util.bg_sel;
"hl+" = bright.green;
};
};
programs.zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
enableVteIntegration = true;
autocd = true;
defaultKeymap = "viins";
initExtra = builtins.readFile ./dots/zsh;
plugins = [
{
name = "powerlevel10k";
src = pkgs.zsh-powerlevel10k;
file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
}
{
name = "zsh-vi-mode";
src = pkgs.zsh-vi-mode;
file = "share/zsh-vi-mode/zsh-vi-mode.zsh";
}
{
name = "zsh-autopair";
src = pkgs.zsh-autopair;
file = "share/zsh-autopair/zsh-autopair.zsh";
}
{
name = "zsh-completions";
src = pkgs.zsh-completions;
file = "share/zsh-completions/zsh-completions.zsh";
}
{
name = "zsh-command-time";
src = pkgs.zsh-command-time;
file = "share/zsh-completions/zsh-command-time.zsh";
}
{
name = "zsh-autocomplete";
src = pkgs.zsh-autocomplete;
file = "share/zsh-autocomplete/zsh-autocomplete.zsh";
}
{
name = "zsh-fast-syntax-highlighting";
src = pkgs.zsh-fast-syntax-highlighting;
file = "share/zsh-fast-syntax-highlighting/zsh-fast-syntax-highlighting.zsh";
}
{
name = "zsh-nix-shell";
src = pkgs.zsh-nix-shell;
file = "share/zsh-nix-shell/zsh-nix-shell.zsh";
}
{
name = "any-nix-shell";
src = pkgs.any-nix-shell;
file = "share/any-nix-shell/any-nix-shell.zsh";
}
{
name = "nix-zsh-completions";
src = pkgs.nix-zsh-completions;
file = "share/nix-zsh-completions/nix-zsh-completions.zsh";
}
];
};
}