big refactor

This commit is contained in:
Asaki Yuki 2026-04-09 10:36:32 +07:00
commit 76d68230f6
81 changed files with 3065 additions and 0 deletions

View file

@ -0,0 +1,62 @@
{ lib, osconfig, ... }: {
programs.bash = {
enable = true;
shellAliases = {
cls = "clear";
cleanup = "sudo nix-collect-garbage -d";
cls-log = "sudo journalctl --vacuum-time=1s";
logout = "pkill -KILL -u $USER";
nrs = "sudo nixos-rebuild switch --flake /etc/nixos#${osconfig.device.flake-name}";
wss = "waydroid session stop; exit;";
flake-upgrade = "nix flake update";
spf = "superfile";
};
shellOptions = [
"histappend"
"checkwinsize"
"extglob"
"globstar"
"checkjobs"
"autocd"
];
initExtra = ''
function git-commit() {
git add .
git commit -m "$1"
}
function git-push() {
git-commit "$1"
git push origin HEAD
}
function git-pull() {
git fetch origin HEAD
git pull origin HEAD
}
function get-hash() {
nix hash to-sri --type sha256 $(nix-prefetch-url --unpack "$1")
}
'' +
lib.optionalString osconfig.device.programs.tmux.enable ''
allowed_terms=("xterm-kitty" "xterm-ghostty")
should_run_tmux=false
for term in "${"$" + "{allowed_terms[@]" + "}"}"; do
if [[ "$TERM" == "$term" ]]; then
should_run_tmux=true
break
fi
done
if [ -z "$TMUX" ] && [ "$should_run_tmux" = true ]; then
exec tmux
fi
'';
};
}

View file

@ -0,0 +1,176 @@
{ lib, osconfig, ... }:
{
programs.fastfetch = lib.mkIf osconfig.device.programs.fastfetch.enable {
enable = true;
settings = {
logo = {
padding.top = 1;
color = {
"1" = "#89b4fa";
"2" = "#cdd6f4";
"3" = "#89b4fa";
"4" = "#cdd6f4";
"5" = "#89b4fa";
"6" = "#cdd6f4";
};
};
display = {
color = {
title = "#cdd6f4";
output = "#cdd6f4";
separator = "black";
};
bar = {
width = 10;
charTotal = " ";
border.left = "[";
border.right = "]";
char.elapsed = "";
color = {
border = "green";
elapsed = "green";
total = "black";
};
};
percent = {
type = 3;
color = {
green = "green";
yellow = "yellow";
red = "red";
};
};
separator = " ";
brightColor = true;
};
modules = [
{
type = "title";
format = " {user-name}@{host-name}";
outputColor = "bright_yellow";
}
{
type = "separator";
string = "";
length = 24;
outputColor = "white";
}
{
type = "os";
key = "";
keyColor = "green";
}
{
type = "kernel";
key = "󰌽";
keyColor = "green";
}
{
type = "shell";
key = "";
keyColor = "green";
}
{
type = "packages";
key = "󰆧";
keyColor = "green";
}
{
type = "uptime";
key = "󱑁";
keyColor = "green";
}
"break"
{
type = "host";
keyColor = "blue";
key = "󰧨";
}
{
type = "cpu";
key = "";
keyColor = "blue";
}
{
type = "gpu";
key = "";
keyColor = "blue";
}
{
type = "sound";
key = "";
format = "{name}";
keyColor = "blue";
}
{
type = "memory";
format = "{percentage-bar} {used} / {total}";
key = "";
keyColor = "blue";
}
{
type = "disk";
format = "{size-percentage-bar} {name} ({mountpoint}) {size-used} / {size-total} - {filesystem}";
key = "󰋊";
keyColor = "blue";
}
{
type = "localip";
key = "";
keyColor = "blue";
}
"break"
{
type = "terminal";
key = "";
keyColor = "yellow";
}
{
type = "wm";
key = "󰨇";
keyColor = "yellow";
}
{
type = "de";
key = "󰨇";
keyColor = "yellow";
}
{
type = "bios";
key = "";
keyColor = "yellow";
}
{
type = "theme";
key = "󱓓";
keyColor = "yellow";
}
{
type = "icons";
key = "󱓓";
keyColor = "yellow";
}
{
type = "cursor";
key = "󱓓";
keyColor = "yellow";
}
"break"
"colors"
];
};
};
}

View file

@ -0,0 +1,50 @@
{ lib, osconfig, ... }: {
programs.ghostty = lib.mkIf (osconfig.device.programs.terminal == "ghostty") {
enable = true;
settings = {
theme = "catppuccin-mocha";
font-size = 10;
font-family = "SauceCodePro NFP Bold";
window-width = 230;
window-height = 68;
window-padding-x = 5;
window-padding-y = 0;
keybind = [
"ctrl+shift+n=unbind"
"ctrl+shift+i=unbind"
];
};
themes = {
catppuccin-mocha = {
background = "1e1e2e";
cursor-color = "f5e0dc";
foreground = "cdd6f4";
palette = [
"0=#45475a"
"1=#f38ba8"
"2=#a6e3a1"
"3=#f9e2af"
"4=#89b4fa"
"5=#f5c2e7"
"6=#94e2d5"
"7=#bac2de"
"8=#585b70"
"9=#f38ba8"
"10=#a6e3a1"
"11=#f9e2af"
"12=#89b4fa"
"13=#f5c2e7"
"14=#94e2d5"
"15=#a6adc8"
];
selection-background = "353749";
selection-foreground = "cdd6f4";
};
};
};
}

View file

@ -0,0 +1,75 @@
{ lib, osconfig, ... }: {
programs.kitty = lib.mkIf (osconfig.device.programs.terminal == "kitty") {
enable = true;
keybindings = {
"ctrl+c" = "copy_to_clipboard";
"ctrl+v" = "paste_from_clipboard";
};
settings = {
window_padding_width = 2;
window_padding_height = 2;
cursor_shape = "beam";
# background_opacity = 0.5;
font_family = "Tahoma";
font_size = 9;
foreground = "#cdd6f4";
background = "#1e1e2e";
selection_foreground = "#1e1e2e";
selection_background = "#f5e0dc";
cursor = "#f5e0dc";
cursor_text_color = "#1e1e2e";
url_color = "#f5e0dc";
active_border_color = "#b4befe";
inactive_border_color = "#6c7086";
bell_border_color = "#f9e2af";
wayland_titlebar_color = "system";
macos_titlebar_color = "system";
active_tab_foreground = "#11111b";
active_tab_background = "#cba6f7";
inactive_tab_foreground = "#cdd6f4";
inactive_tab_background = "#181825";
tab_bar_background = "#11111b";
mark1_foreground = "#1e1e2e";
mark1_background = "#b4befe";
mark2_foreground = "#1e1e2e";
mark2_background = "#cba6f7";
mark3_foreground = "#1e1e2e";
mark3_background = "#74c7ec";
color0 = "#45475a";
color8 = "#585b70";
color1 = "#f38ba8";
color9 = "#f38ba8";
color2 = "#a6e3a1";
color10 = "#a6e3a1";
color3 = "#f9e2af";
color11 = "#f9e2af";
color4 = "#89b4fa";
color12 = "#89b4fa";
color5 = "#f5c2e7";
color13 = "#f5c2e7";
color6 = "#94e2d5";
color14 = "#94e2d5";
color7 = "#bac2de";
color15 = "#a6adc8";
};
};
}

View file

@ -0,0 +1,11 @@
{ osconfig, lib, ... }: {
programs.niri = lib.mkIf osconfig.device.wm.niri.enable {
enable = true;
settings = {
binds = {
# "Ctrl+Alt+T" = "ghostty";
# "Mod+D" = "fuzzel";
};
};
};
}

View file

@ -0,0 +1,5 @@
{ pkgs, custom, lib, osconfig, ... }:
lib.mkIf osconfig.device.programs.obs-studio.enable {
programs.obs-studio.enable = true;
home.file.".config/obs-studio/themes".source = pkgs.callPackage custom.catppuccin-obs { };
}

View file

@ -0,0 +1,14 @@
{
pkgs,
lib,
osconfig,
...
}:
{
home.packages = with pkgs; [
hyprshot
antigravity
(lib.mkIf osconfig.device.programs.cider-2.enable cider-2)
];
}

View file

@ -0,0 +1,81 @@
{ lib, osconfig, ... }: {
programs.starship = lib.mkIf osconfig.device.programs.starship.enable {
enable = true;
settings = {
add_newline = true;
scan_timeout = 10;
format = ''
$os $shell $cmake$java$nodejs$git_branch$character
$cmd_duration$sudo$directory > '';
sudo = {
format = "[$symbol]($style) ";
symbol = "";
disabled = false;
};
java = {
format = "[$symbol $version]($style) ";
symbol = "";
};
cmake = {
format = "[$symbol $version](bold blue) ";
symbol = "";
};
nodejs = {
format = "[$symbol $version](bold green) ";
symbol = "󰎙";
};
git_branch = {
format = "[$symbol $branch]($style) ";
symbol = "";
style = "red";
disabled = false;
};
directory = {
format = "[$read_only]($read_only_style)[$path]($style)";
style = "#2e8be8";
truncation_length = 2;
read_only = "󰌾 ";
};
character = {
success_symbol = "[](green)";
error_symbol = "[](red)";
disabled = false;
};
cmd_duration = {
min_time = 1;
format = "[\\[$duration\\]]($style) ";
style = "#C0C0C0";
show_milliseconds = true;
};
shell = {
disabled = false;
bash_indicator = "bash";
fish_indicator = "fish";
zsh_indicator = "zsh";
powershell_indicator = "pwsh";
format = "[$indicator]($style)";
style = "white";
};
os = {
format = "[$symbol]($style)";
disabled = false;
symbols = {
Arch = "[󰣇](bold blue)";
Windows = "[](bold blue)";
NixOS = "[](bold blue)";
};
};
};
};
}

View file

@ -0,0 +1,50 @@
{ pkgs, lib, ... }:
let
catppuccin-gtk = pkgs.catppuccin-gtk.override {
variant = "mocha";
accents = [ "sapphire" ];
size = "compact";
};
in
{
home.activation.copyGtkTheme = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
mkdir -p "$HOME/.themes/"
if [ ! -d "$HOME/.themes/catppuccin-mocha-sapphire-compact" ]; then
cp -r "${catppuccin-gtk}/share/themes/catppuccin-mocha-sapphire-compact" "$HOME/.themes/"
fi
if [ ! -d "$HOME/.themes/catppuccin-mocha-sapphire-compact-hdpi" ]; then
cp -r "${catppuccin-gtk}/share/themes/catppuccin-mocha-sapphire-compact-hdpi" "$HOME/.themes/"
fi
if [ ! -d "$HOME/.themes/catppuccin-mocha-sapphire-compact-xhdpi" ]; then
cp -r "${catppuccin-gtk}/share/themes/catppuccin-mocha-sapphire-compact-xhdpi" "$HOME/.themes/"
fi
'';
# QT
qt = {
enable = true;
platformTheme.name = "qtct";
style = {
package = with pkgs; [
catppuccin-qt5ct
catppuccin-kde
kdePackages.breeze
];
};
};
# GTK
gtk.theme.name = "catppuccin-mocha-sapphire-compact";
# Catppuccin
catppuccin = {
accent = "blue";
flavor = "mocha";
fcitx5.enable = true;
obs.enable = true;
};
}

View file

@ -0,0 +1,81 @@
{ lib, osconfig, pkgs, ... }:
let
TOP_PANEL = ''
set -g pane-border-status top
set -g pane-border-lines single
set -g pane-border-indicators colour
set -g pane-border-format "#{E:@asa-module-icon} #{pane_index} #{E:@asa-module-text} #{pane_current_path} #[default]"
'';
OPTIONS = ''
set-option -g destroy-unattached on
set -g allow-passthrough on
'';
BINDS = ''
unbind r
bind r source-file ~/.config/tmux/tmux.conf;
'';
BOTTOM_PANEL = ''
set -g status-justify "centre"
set -g window-status-format "#{E:@asa-module-icon} #I #{E:@asa-module-text} #W "
set -g window-status-current-format "#{E:@asa-module-icon} #I #{E:@asa-module-text} #W "
set -gg status-left "#{E:@asa-module-text} %A %d/%m/%Y #[default] "
set -ag status-left "#{E:@asa-module-text} %I:%M %p #[default] "
set -g status-left-length 100
set -g status-right "#{E:@asa-module-icon} #{E:@asa-module-text} #S #[default] "
set -ag status-right "#{E:@asa-module-icon} CPU #{E:@asa-module-text} #{cpu_percentage} #[default] "
set -ag status-right "#{E:@asa-module-icon} RAM #{E:@asa-module-text} #{ram_percentage} "
set -g status-right-length 100
setw -g automatic-rename off
'';
CATPPUCCIN = ''
set -g @catppuccin_flavor 'mocha'
set -ogq @asa-module-icon "#[bg=#{E:@thm_sapphire},fg=#{E:@thm_surface_0}]"
set -ogq @asa-module-text "#[bg=#{E:@thm_surface_0},fg=#{E:@thm_fg}]"
'';
YANK = ''
set -g @yank_selection 'primary'
set -g @yank_selection_mouse 'primary'
'';
EXTRA_CONFIG = ''
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi V send-keys -X select-line
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
'';
in
{
programs.tmux = lib.mkIf osconfig.device.programs.tmux.enable {
enable = true;
keyMode = "vi";
disableConfirmationPrompt = true;
prefix = "c-a";
extraConfig = TOP_PANEL + OPTIONS + BINDS + EXTRA_CONFIG;
plugins = with pkgs.tmuxPlugins; [
{
plugin = yank;
extraConfig = YANK;
}
{
plugin = catppuccin;
extraConfig = CATPPUCCIN;
}
{
plugin = cpu;
extraConfig = BOTTOM_PANEL;
}
];
};
}

View file

@ -0,0 +1,5 @@
{ ... }: {
programs.vscode = {
enable = true;
};
}

View file

@ -0,0 +1,14 @@
{ pkgs, lib, osconfig, ... }: {
xdg.portal = lib.mkIf osconfig.device.wm.hyprland.enable {
enable = true;
xdgOpenUsePortal = true;
config = {
common.default = ["gtk"];
hyprland.default = ["gtk" "hyprland"];
};
extraPortals = [
pkgs.xdg-desktop-portal-gtk
pkgs.xdg-desktop-portal-hyprland
];
};
}