From f84fc266665ec70ffa125b0617978b1747dd24ac Mon Sep 17 00:00:00 2001 From: elwrcl Date: Mon, 27 Jul 2026 22:12:20 +0300 Subject: [PATCH] great refactor 2 --- main/darwin/home.nix | 12 ++ main/nixos/home.nix | 12 ++ main/nixos/packages.nix | 16 +-- modules/darwin/default.nix | 1 + modules/darwin/homebrew/default.nix | 20 +-- modules/home/home.nix | 160 +--------------------- modules/home/linux.nix | 155 +++++++++++++++++++++ modules/home/programs/default.nix | 7 + modules/home/programs/discord/default.nix | 21 +++ modules/home/programs/ghostty/default.nix | 124 +++++++++++++++++ modules/home/programs/shell/default.nix | 7 + modules/home/programs/shell/nu.nix | 69 ++++++++++ 12 files changed, 428 insertions(+), 176 deletions(-) create mode 100644 main/darwin/home.nix create mode 100644 main/nixos/home.nix create mode 100644 modules/home/linux.nix create mode 100644 modules/home/programs/default.nix create mode 100644 modules/home/programs/discord/default.nix create mode 100644 modules/home/programs/ghostty/default.nix create mode 100644 modules/home/programs/shell/default.nix create mode 100644 modules/home/programs/shell/nu.nix diff --git a/main/darwin/home.nix b/main/darwin/home.nix new file mode 100644 index 0000000..0d3663d --- /dev/null +++ b/main/darwin/home.nix @@ -0,0 +1,12 @@ +{ ... }: + +{ + imports = [ + ../../modules/home + ]; + + home.username = "sohryu"; + home.homeDirectory = "/Users/sohryu"; + home.stateVersion = "25.05"; + # nu or zsh +} diff --git a/main/nixos/home.nix b/main/nixos/home.nix new file mode 100644 index 0000000..7bf213a --- /dev/null +++ b/main/nixos/home.nix @@ -0,0 +1,12 @@ +{ ... }: + +{ + imports = [ + ../../modules/home + ../../modules/home/linux.nix + ]; + + home.username = "elars"; + home.homeDirectory = "/home/elars"; + home.stateVersion = "25.05"; +} diff --git a/main/nixos/packages.nix b/main/nixos/packages.nix index 435ec9c..93bcf80 100755 --- a/main/nixos/packages.nix +++ b/main/nixos/packages.nix @@ -23,12 +23,10 @@ with pkgs; antigravity obs-studio localsend - spotatui picotool sunshine - equibop spotify - ghostty + equibop heroic loupe gimp @@ -49,6 +47,7 @@ with pkgs; kdePackages.ark kdePackages.kio kdePackages.kdf + nautilus # utils poppler-utils @@ -91,7 +90,9 @@ with pkgs; wget fish htop + tmux btop + yazi zip eza bat @@ -111,6 +112,8 @@ with pkgs; mesa-demos lm_sensors exfatprogs + pci-utils + dmidecode libsecret apfs-fuse gptfdisk @@ -169,8 +172,8 @@ with pkgs; # editors lite-xl - vscode neovim + vscode # media ffmpegthumbnailer @@ -189,9 +192,4 @@ with pkgs; inputs.helium.packages.${system}.default pkgs.qt6Packages.qtwebsockets ]; - environment.variables = { - NAUTILUS_4_EXTENSION_DIR = "${pkgs.nautilus-python}/lib/nautilus/extensions-4"; - PYTHONPATH = "${pythonEnv}/${pythonEnv.sitePackages}"; - GI_TYPELIB_PATH = "${pkgs.gtk4}/lib/girepository-1.0:${pkgs.libadwaita}/lib/girepository-1.0"; - }; } diff --git a/modules/darwin/default.nix b/modules/darwin/default.nix index a8f2059..8fbc227 100755 --- a/modules/darwin/default.nix +++ b/modules/darwin/default.nix @@ -1,4 +1,5 @@ { ... }: + { imports = [ ../home/git.nix diff --git a/modules/darwin/homebrew/default.nix b/modules/darwin/homebrew/default.nix index 034e9e4..31dddcf 100755 --- a/modules/darwin/homebrew/default.nix +++ b/modules/darwin/homebrew/default.nix @@ -1,14 +1,14 @@ -{ ... }: +{ pkgs, ... }: { - homebrew = { - enable = true; - onActivation = { - autoUpdate = true; - upgrade = true; - cleanup = "none"; - }; - brews = [ ]; - casks = [ ]; + system.primaryUser = "sohryu"; + users.users.sohryu = { + name = "sohryu"; + home = "/Users/sohryu"; + shell = pkgs.zsh; }; + + programs.zsh.enable = true; + environment.systemPackages = [ pkgs.nh ]; + environment.variables.NH_FLAKE = "/Users/sohryu/copland"; } diff --git a/modules/home/home.nix b/modules/home/home.nix index bae4777..7f382be 100755 --- a/modules/home/home.nix +++ b/modules/home/home.nix @@ -1,164 +1,10 @@ -{ pkgs, ... }: +{ ... }: + { imports = [ - ./niri.nix + ./programs ]; - home.packages = with pkgs; [ - (discord-canary.override { withMoonlight = true; }) - ]; - - home.username = "elars"; - home.homeDirectory = "/home/elars"; - home.stateVersion = "25.05"; - programs.home-manager.enable = true; fonts.fontconfig.enable = true; - - home.sessionVariables = { - BROWSER = "zen-beta.desktop"; - }; - - programs.zsh = { - enable = true; - enableCompletion = true; - autosuggestion.enable = true; - syntaxHighlighting.enable = true; - initContent = '' - export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border' - export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git' - - alias ls='eza --icons --group-directories-first' - alias ll='eza -lah --icons --group-directories-first' - alias la='eza -a --icons --group-directories-first' - alias lt='eza --tree --level=2 --icons' - - alias cd='z' - alias cat='bat' - alias grep='grep --color=auto' - alias df='df -h' - alias du='du -h' - alias free='free -h' - - alias cp='cp -i' - alias mv='mv -i' - alias rm='trash-put' - - alias sysinfo='fastfetch' - alias monitor='sudo btop' - alias ports='sudo ss -tulpn' - alias myip='curl ifconfig.me' - - alias ..='cd ..' - alias ...='cd ../..' - alias ....='cd ../../..' - alias ~='cd ~' - alias -- -='cd -' - - alias gs='git status' - alias ga='git add' - alias gc='git commit -m' - alias gp='git push' - alias gl='git log --oneline --graph --decorate' - - alias rebuild='git -C ~/copland add -A && git -C ~/copland commit -m "update" && nh os switch' - alias rebuild-dry='nh os switch --dry' - alias rebuild-cop='nix flake update --flake ~/copland && git -C ~/copland add -A && git -C ~/copland commit -m "flake update $(date +%Y-%m-%d)" && nh os switch' - - extract() { - if [ -f "$1" ]; then - case "$1" in - *.tar.bz2) tar xjf "$1" ;; *.tar.gz) tar xzf "$1" ;; - *.bz2) bunzip2 "$1" ;; *.rar) unrar e "$1" ;; - *.gz) gunzip "$1" ;; *.tar) tar xf "$1" ;; - *.zip) unzip "$1" ;; *.7z) 7z x "$1" ;; - *) echo "'$1' can't be extracted" ;; - esac - fi - } - - HISTSIZE=10000 - SAVEHIST=10000 - HISTFILE=~/.zsh_history - setopt HIST_IGNORE_DUPS HIST_IGNORE_SPACE SHARE_HISTORY AUTO_CD - zstyle ':completion:*' menu select - zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' - - export MESA_SHADER_CACHE_MAX_SIZE=2G - export MESA_SHADER_CACHE_DIR=/tmp/mesa_shader_cache - export PATH="$HOME/.local/bin:$PATH" - - /home/elars/.config/copetch/animated-copetch.sh - ''; - }; - - programs.starship.enable = true; - programs.fzf.enable = true; - programs.zoxide.enable = true; - - home.pointerCursor = { - enable = true; - name = "macOS"; - package = pkgs.apple-cursor; - size = 24; - gtk.enable = true; - x11.enable = true; - }; - - gtk = { - enable = true; - theme.name = "WhiteSur-Dark"; - theme.package = pkgs.whitesur-gtk-theme; - gtk4.theme.name = "WhiteSur-Dark"; - gtk4.theme.package = pkgs.whitesur-gtk-theme; - iconTheme.name = "WhiteSur-dark"; - iconTheme.package = pkgs.whitesur-icon-theme; - font = { - name = "JetBrainsMono Nerd Font"; - size = 11; - }; - }; - - dconf.settings."org/gnome/desktop/interface" = { - color-scheme = "prefer-dark"; - gtk-application-prefer-dark-theme = true; - gtk-theme = "WhiteSur-Dark"; - }; - - qt = { - enable = true; - platformTheme.name = "kde"; - style.name = "kvantum"; - }; - - xdg.configFile."Kvantum/WhiteSur-Dark/WhiteSur-Dark.kvconfig".source = - "${pkgs.whitesur-kde}/share/Kvantum/WhiteSur/WhiteSurDark.kvconfig"; - xdg.configFile."Kvantum/WhiteSur-Dark/WhiteSur-Dark.svg".source = - "${pkgs.whitesur-kde}/share/Kvantum/WhiteSur/WhiteSurDark.svg"; - - xdg.configFile."Kvantum/kvantum.kvconfig".text = '' - [General] - theme=WhiteSur-Dark - ''; - - xdg.configFile."kdeglobals".text = '' - [General] - font=JetBrainsMono Nerd Font,11,-1,5,50,0,0,0,0,0 - fixed=JetBrainsMono Nerd Font,11,-1,5,50,0,0,0,0,0 - menuFont=JetBrainsMono Nerd Font,11,-1,5,50,0,0,0,0,0 - toolBarFont=JetBrainsMono Nerd Font,11,-1,5,50,0,0,0,0,0 - smallestReadableFont=JetBrainsMono Nerd Font,9,-1,5,50,0,0,0,0,0 - ''; - - xdg.mimeApps = { - enable = true; - defaultApplications = { - "inode/directory" = [ "org.kde.dolphin.desktop" ]; - "x-scheme-handler/http" = [ "zen-beta.desktop" ]; - "x-scheme-handler/https" = [ "zen-beta.desktop" ]; - "x-scheme-handler/about" = [ "zen-beta.desktop" ]; - "x-scheme-handler/unknown" = [ "zen-beta.desktop" ]; - }; - }; - services.easyeffects.enable = true; } diff --git a/modules/home/linux.nix b/modules/home/linux.nix new file mode 100644 index 0000000..0c8af27 --- /dev/null +++ b/modules/home/linux.nix @@ -0,0 +1,155 @@ +{ pkgs, ... }: +{ + imports = [ + ./niri.nix + ./programs/discord + ]; + + home.sessionVariables = { + BROWSER = "zen-beta.desktop"; + }; + + # TODO nu + programs.zsh = { + enable = true; + enableCompletion = true; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + initContent = '' + export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border' + export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git' + + alias ls='eza --icons --group-directories-first' + alias ll='eza -lah --icons --group-directories-first' + alias la='eza -a --icons --group-directories-first' + alias lt='eza --tree --level=2 --icons' + + alias cd='z' + alias cat='bat' + alias grep='grep --color=auto' + alias df='df -h' + alias du='du -h' + alias free='free -h' + + alias cp='cp -i' + alias mv='mv -i' + alias rm='trash-put' + + alias sysinfo='fastfetch' + alias monitor='sudo btop' + alias ports='sudo ss -tulpn' + alias myip='curl ifconfig.me' + + alias ..='cd ..' + alias ...='cd ../..' + alias ....='cd ../../..' + alias ~='cd ~' + alias -- -='cd -' + + alias gs='git status' + alias ga='git add' + alias gc='git commit -m' + alias gp='git push' + alias gl='git log --oneline --graph --decorate' + + alias rebuild='git -C ~/copland add -A && git -C ~/copland commit -m "update" && nh os switch' + alias rebuild-dry='nh os switch --dry' + alias rebuild-cop='nix flake update --flake ~/copland && git -C ~/copland add -A && git -C ~/copland commit -m "flake update $(date +%Y-%m-%d)" && nh os switch' + + extract() { + if [ -f "$1" ]; then + case "$1" in + *.tar.bz2) tar xjf "$1" ;; *.tar.gz) tar xzf "$1" ;; + *.bz2) bunzip2 "$1" ;; *.rar) unrar e "$1" ;; + *.gz) gunzip "$1" ;; *.tar) tar xf "$1" ;; + *.zip) unzip "$1" ;; *.7z) 7z x "$1" ;; + *) echo "'$1' can't be extracted" ;; + esac + fi + } + + HISTSIZE=10000 + SAVEHIST=10000 + HISTFILE=~/.zsh_history + setopt HIST_IGNORE_DUPS HIST_IGNORE_SPACE SHARE_HISTORY AUTO_CD + zstyle ':completion:*' menu select + zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' + + export MESA_SHADER_CACHE_MAX_SIZE=2G + export MESA_SHADER_CACHE_DIR=/tmp/mesa_shader_cache + export PATH="$HOME/.local/bin:$PATH" + + /home/elars/.config/copetch/animated-copetch.sh + ''; + }; + + programs.starship.enable = true; + programs.fzf.enable = true; + programs.zoxide.enable = true; + + home.pointerCursor = { + enable = true; + name = "macOS"; + package = pkgs.apple-cursor; + size = 24; + gtk.enable = true; + x11.enable = true; + }; + + gtk = { + enable = true; + theme.name = "WhiteSur-Dark"; + theme.package = pkgs.whitesur-gtk-theme; + gtk4.theme.name = "WhiteSur-Dark"; + gtk4.theme.package = pkgs.whitesur-gtk-theme; + iconTheme.name = "WhiteSur-dark"; + iconTheme.package = pkgs.whitesur-icon-theme; + font = { + name = "JetBrainsMono Nerd Font"; + size = 11; + }; + }; + + dconf.settings."org/gnome/desktop/interface" = { + color-scheme = "prefer-dark"; + gtk-application-prefer-dark-theme = true; + gtk-theme = "WhiteSur-Dark"; + }; + + qt = { + enable = true; + platformTheme.name = "kde"; + style.name = "kvantum"; + }; + + xdg.configFile."Kvantum/WhiteSur-Dark/WhiteSur-Dark.kvconfig".source = + "${pkgs.whitesur-kde}/share/Kvantum/WhiteSur/WhiteSurDark.kvconfig"; + xdg.configFile."Kvantum/WhiteSur-Dark/WhiteSur-Dark.svg".source = + "${pkgs.whitesur-kde}/share/Kvantum/WhiteSur/WhiteSurDark.svg"; + + xdg.configFile."Kvantum/kvantum.kvconfig".text = '' + [General] + theme=WhiteSur-Dark + ''; + + xdg.configFile."kdeglobals".text = '' + [General] + font=JetBrainsMono Nerd Font,11,-1,5,50,0,0,0,0,0 + fixed=JetBrainsMono Nerd Font,11,-1,5,50,0,0,0,0,0 + menuFont=JetBrainsMono Nerd Font,11,-1,5,50,0,0,0,0,0 + toolBarFont=JetBrainsMono Nerd Font,11,-1,5,50,0,0,0,0,0 + smallestReadableFont=JetBrainsMono Nerd Font,9,-1,5,50,0,0,0,0,0 + ''; + + xdg.mimeApps = { + enable = true; + defaultApplications = { + "inode/directory" = [ "org.kde.dolphin.desktop" ]; + "x-scheme-handler/http" = [ "zen-beta.desktop" ]; + "x-scheme-handler/https" = [ "zen-beta.desktop" ]; + "x-scheme-handler/about" = [ "zen-beta.desktop" ]; + "x-scheme-handler/unknown" = [ "zen-beta.desktop" ]; + }; + }; + services.easyeffects.enable = true; +} diff --git a/modules/home/programs/default.nix b/modules/home/programs/default.nix new file mode 100644 index 0000000..ff25e83 --- /dev/null +++ b/modules/home/programs/default.nix @@ -0,0 +1,7 @@ +{ ... }: +{ + imports = [ + ./ghostty + ./shell + ]; +} diff --git a/modules/home/programs/discord/default.nix b/modules/home/programs/discord/default.nix new file mode 100644 index 0000000..c1f1701 --- /dev/null +++ b/modules/home/programs/discord/default.nix @@ -0,0 +1,21 @@ +{ inputs, ... }: + +{ + imports = [ + inputs.nixcord.homeModules.nixcord + ]; + + programs.nixcord = { + enable = true; + legcord = { + enable = true; + settings = { + channel = "stable"; + tray = "dynamic"; + minimizeToTray = true; + mods = [ "shelter" ]; + doneSetup = true; + }; + }; + }; +} diff --git a/modules/home/programs/ghostty/default.nix b/modules/home/programs/ghostty/default.nix new file mode 100644 index 0000000..67260dc --- /dev/null +++ b/modules/home/programs/ghostty/default.nix @@ -0,0 +1,124 @@ +{ pkgs, lib, ... }: + +let + isDarwin = pkgs.stdenv.isDarwin; + + linuxKeybinds = [ + "alt+r=reload_config" + "alt+q=close_surface" + + "ctrl+space=new_tab" + "ctrl+page_down=next_tab" + "ctrl+page_up=previous_tab" + "alt+comma=move_tab:-1" + "alt+period=move_tab:1" + + "alt+1=goto_tab:1" + "alt+2=goto_tab:2" + "alt+3=goto_tab:3" + "alt+4=goto_tab:4" + "alt+5=goto_tab:5" + "alt+6=goto_tab:6" + "alt+7=goto_tab:7" + "alt+8=goto_tab:8" + "alt+9=goto_tab:9" + + "ctrl+shift+backslash=new_split:right" + "ctrl+shift+minus=new_split:down" + + "alt+h=goto_split:left" + "alt+j=goto_split:bottom" + "alt+k=goto_split:top" + "alt+l=goto_split:right" + + "ctrl+shift+z=toggle_split_zoom" + "ctrl+shift+e=equalize_splits" + ]; + + darwinKeybinds = [ + "cmd+s>r=reload_config" + "cmd+s>x=close_surface" + "cmd+s>n=new_window" + + "cmd+s>c=new_tab" + "cmd+s>shift+l=next_tab" + "cmd+s>shift+h=previous_tab" + "cmd+s>comma=move_tab:-1" + "cmd+s>period=move_tab:1" + + "cmd+s>1=goto_tab:1" + "cmd+s>2=goto_tab:2" + "cmd+s>3=goto_tab:3" + "cmd+s>4=goto_tab:4" + "cmd+s>5=goto_tab:5" + "cmd+s>6=goto_tab:6" + "cmd+s>7=goto_tab:7" + "cmd+s>8=goto_tab:8" + "cmd+s>9=goto_tab:9" + + "cmd+s>\\=new_split:right" + "cmd+s>-=new_split:down" + "cmd+s>h=goto_split:left" + "cmd+s>j=goto_split:bottom" + "cmd+s>k=goto_split:top" + "cmd+s>l=goto_split:right" + "cmd+s>z=toggle_split_zoom" + "cmd+s>e=equalize_splits" + ]; +in +{ + programs.ghostty = { + enable = true; + installBatSyntax = true; + enableZshIntegration = true; + + settings = { + font-family = "JetBrainsMono Nerd Font"; + font-size = 11; + + window-padding-x = 10; + window-padding-y = 10; + window-padding-balance = true; + window-save-state = "always"; + + mouse-hide-while-typing = true; + mouse-scroll-multiplier = 2; + shell-integration-features = "no-cursor,sudo,no-title"; + + palette = [ + "0=#090E13" + "1=#c4746e" + "2=#8a9a7b" + "3=#c4b28a" + "4=#8ba4b0" + "5=#a292a3" + "6=#8ea4a2" + "7=#a4a7a4" + "8=#5C6066" + "9=#e46876" + "10=#87a987" + "11=#e6c384" + "12=#7fb4ca" + "13=#938aa9" + "14=#7aa89f" + "15=#c5c9c7" + ]; + + background = "#090E13"; + foreground = "#c5c9c7"; + cursor-color = "#c5c9c7"; + cursor-text = "#9cdef2"; + selection-background = "#22262D"; + selection-foreground = "#c5c9c7"; + cursor-style = "block"; + cursor-style-blink = true; + adjust-cell-height = "35%"; + background-opacity = 0.96; + + keybind = linuxKeybinds ++ lib.optionals isDarwin darwinKeybinds; + } + // lib.optionalAttrs isDarwin { + macos-titlebar-style = "transparent"; + }; + }; +} diff --git a/modules/home/programs/shell/default.nix b/modules/home/programs/shell/default.nix new file mode 100644 index 0000000..da6b940 --- /dev/null +++ b/modules/home/programs/shell/default.nix @@ -0,0 +1,7 @@ +{ ... }: + +{ + imports = [ + ./nu.nix + ]; +} diff --git a/modules/home/programs/shell/nu.nix b/modules/home/programs/shell/nu.nix new file mode 100644 index 0000000..f64efa8 --- /dev/null +++ b/modules/home/programs/shell/nu.nix @@ -0,0 +1,69 @@ +{ ... }: + +{ + programs.nushell = { + enable = true; + + shellAliases = { + ls = "eza --icons --group-directories-first"; + ll = "eza -lah --icons --group-directories-first"; + la = "eza -a --icons --group-directories-first"; + lt = "eza --tree --level=2 --icons"; + cat = "bat"; + df = "df -h"; + du = "du -h"; + free = "free -h"; + rm = "trash-put"; + sysinfo = "fastfetch"; + monitor = "sudo btop"; + ports = "sudo ss -tulpn"; + myip = "curl ifconfig.me"; + gs = "git status"; + ga = "git add"; + gp = "git push"; + gl = "git log --oneline --graph --decorate"; + ".." = "cd .."; + "..." = "cd ../.."; + "...." = "cd ../../.."; + }; + + environmentVariables = { + MESA_SHADER_CACHE_MAX_SIZE = "2G"; + MESA_SHADER_CACHE_DIR = "/tmp/mesa_shader_cache"; + }; + + extraEnv = '' + $env.PATH = ($env.PATH | prepend $"($env.HOME)/.local/bin") + ''; + + extraConfig = '' + $env.config.show_banner = false + def gc [msg: string] { git commit -m $msg } + def rebuild [] { + git -C ~/copland add -A + git -C ~/copland commit -m "update" + nh os switch + } + + def rebuild-dry [] { nh os switch --dry } + def rebuild-cop [] { + nix flake update --flake ~/copland + git -C ~/copland add -A + git -C ~/copland commit -m $"flake update (date now | format date '%Y-%m-%d')" + nh os switch + } + def extract [file: string] { + let ext = ($file | path parse | get extension) + match $ext { + "gz" => { tar xzf $file }, + "bz2" => { tar xjf $file }, + "tar" => { tar xf $file }, + "zip" => { unzip $file }, + "7z" => { 7z x $file }, + "rar" => { unrar e $file }, + _ => { print $"'($file)' can't be extracted" } + } + } + ''; + }; +}