diff --git a/users/guanranwang/darwin/profiles/device-type/desktop/default.nix b/users/guanranwang/darwin/profiles/device-type/desktop/default.nix index 42e1a3f..c23db1d 100644 --- a/users/guanranwang/darwin/profiles/device-type/desktop/default.nix +++ b/users/guanranwang/darwin/profiles/device-type/desktop/default.nix @@ -1,12 +1,12 @@ {...}: { ### home-manager home-manager.users.guanranwang.imports = map (n: ../../../../home-manager/${n}) [ - "modules/terms/alacritty.nix" - "modules/shell/fish.nix" - "modules/shell/bash.nix" - "modules/editor/helix.nix" - "modules/editor/neovim.nix" - "modules/editor/vscode.nix" + "applications/alacritty" + "applications/fish" + "applications/bash" + "applications/helix" + "applications/neovim" + "applications/vscode" "profiles/graphical-stuff/darwin" ]; diff --git a/users/guanranwang/home-manager/applications/bat/default.nix b/users/guanranwang/home-manager/applications/bat/default.nix new file mode 100644 index 0000000..53157b6 --- /dev/null +++ b/users/guanranwang/home-manager/applications/bat/default.nix @@ -0,0 +1,7 @@ +{...}: { + programs.bat.enable = true; + home.sessionVariables = { + "MANPAGER" = "sh -c 'col -bx | bat -l man -p'"; + "MANROFFOPT" = "-c"; + }; +} diff --git a/users/guanranwang/home-manager/applications/eza/default.nix b/users/guanranwang/home-manager/applications/eza/default.nix new file mode 100644 index 0000000..d0680a4 --- /dev/null +++ b/users/guanranwang/home-manager/applications/eza/default.nix @@ -0,0 +1,15 @@ +{...}: { + programs.eza = { + enable = true; + git = true; + icons = true; + extraOptions = ["--header"]; + # Fish have builtin aliases for `ls`, alias `ls` to `eza` is the only thing we want to do + #enableAliases = true; + }; + + home.shellAliases = { + "ls" = "eza"; + "tree" = "ls --tree"; + }; +} diff --git a/users/guanranwang/home-manager/profiles/graphical-stuff/nixos/input-method.nix b/users/guanranwang/home-manager/applications/fcitx5/default.nix similarity index 95% rename from users/guanranwang/home-manager/profiles/graphical-stuff/nixos/input-method.nix rename to users/guanranwang/home-manager/applications/fcitx5/default.nix index 3b38a3c..61164b7 100644 --- a/users/guanranwang/home-manager/profiles/graphical-stuff/nixos/input-method.nix +++ b/users/guanranwang/home-manager/applications/fcitx5/default.nix @@ -1,5 +1,4 @@ {pkgs, ...}: { - # Chinese IME i18n.inputMethod = { enabled = "fcitx5"; fcitx5.addons = with pkgs; [ diff --git a/users/guanranwang/home-manager/applications/git/default.nix b/users/guanranwang/home-manager/applications/git/default.nix new file mode 100644 index 0000000..9ea39a0 --- /dev/null +++ b/users/guanranwang/home-manager/applications/git/default.nix @@ -0,0 +1,14 @@ +{...}: { + programs.git = { + enable = true; + userName = "Guanran Wang"; + userEmail = "guanran928@outlook.com"; + delta.enable = true; + signing.signByDefault = true; + signing.key = "~/.ssh/id_github_signing"; + extraConfig = { + gpg.format = "ssh"; + pull.rebase = true; + }; + }; +} diff --git a/users/guanranwang/home-manager/applications/nix/default.nix b/users/guanranwang/home-manager/applications/nix/default.nix index e4c3d53..8e16bf4 100644 --- a/users/guanranwang/home-manager/applications/nix/default.nix +++ b/users/guanranwang/home-manager/applications/nix/default.nix @@ -2,6 +2,8 @@ home.packages = with pkgs; [ nil # LSP alejandra # Formatter + sops + nix-output-monitor ]; ### VSCode diff --git a/users/guanranwang/home-manager/applications/skim/default.nix b/users/guanranwang/home-manager/applications/skim/default.nix new file mode 100644 index 0000000..ac42b2d --- /dev/null +++ b/users/guanranwang/home-manager/applications/skim/default.nix @@ -0,0 +1,9 @@ +{...}: { + programs.skim = { + enable = true; + defaultCommand = "rg --files || fd --type f || find ."; + # rg --files ran + # 4.40 ± 0.44 times faster than fd --type f + # 60.39 ± 5.80 times faster than find . + }; +} diff --git a/users/guanranwang/home-manager/applications/starship/default.nix b/users/guanranwang/home-manager/applications/starship/default.nix new file mode 100644 index 0000000..8dd012c --- /dev/null +++ b/users/guanranwang/home-manager/applications/starship/default.nix @@ -0,0 +1,25 @@ +{ + lib, + pkgs, + ... +}: { + programs.starship = { + enable = true; + settings = lib.mkMerge [ + { + add_newline = false; + line_break.disabled = true; + + character = { + success_symbol = "[>](bold green)"; + error_symbol = "[>](bold red)"; + vimcmd_symbol = "[<](bold green)"; + vimcmd_replace_one_symbol = "[<](bold purple)"; + vimcmd_replace_symbol = "[<](bold purple)"; + vimcmd_visual_symbol = "[<](bold yellow)"; + }; + } + (builtins.fromTOML (builtins.readFile "${pkgs.starship}/share/starship/presets/nerd-font-symbols.toml")) + ]; + }; +} diff --git a/users/guanranwang/home-manager/profiles/command-line/resources/common/default.nix b/users/guanranwang/home-manager/profiles/command-line/resources/common/default.nix index df36ae0..6784a3d 100644 --- a/users/guanranwang/home-manager/profiles/command-line/resources/common/default.nix +++ b/users/guanranwang/home-manager/profiles/command-line/resources/common/default.nix @@ -1,96 +1,33 @@ -{ - pkgs, - lib, - ... -}: { - home = { - shellAliases = { - # navigation - "ls" = "eza"; - "tree" = "ls --tree"; - ".." = "cd .."; +{pkgs, ...}: { + imports = [ + ../../../../applications/git + ../../../../applications/starship + ../../../../applications/eza + ../../../../applications/skim + ../../../../applications/bat + ]; - "farsee" = "curl -F 'c=@-' 'https://fars.ee/'"; # pb + home.shellAliases = { + ".." = "cd .."; + "farsee" = "curl -F 'c=@-' 'https://fars.ee/'"; # pb - # proxy - "setproxy" = let - proxy = "http://127.0.0.1:7890/"; - in "export http_proxy=${proxy} https_proxy=${proxy} ftp_proxy=${proxy} rsync_proxy=${proxy}"; - "unsetproxy" = "set -e http_proxy https_proxy all_proxy"; # fish syntax (?) - }; - sessionVariables = { - # Bat - "MANPAGER" = "sh -c 'col -bx | bat -l man -p'"; - "MANROFFOPT" = "-c"; - }; - - packages = with pkgs; [ - ### Nix - sops - nix-output-monitor - - ### Misc - wget - fd - hyperfine - ]; + # proxy + "setproxy" = let + proxy = "http://127.0.0.1:7890/"; + in "export http_proxy=${proxy} https_proxy=${proxy} ftp_proxy=${proxy} rsync_proxy=${proxy}"; + "unsetproxy" = "set -e http_proxy https_proxy all_proxy"; # fish syntax (?) }; + + home.packages = with pkgs; [ + wget + fd + hyperfine + ]; programs = { tealdeer.enable = true; zoxide.enable = true; - bat.enable = true; bottom.enable = true; joshuto.enable = true; ripgrep.enable = true; - - starship = { - enable = true; - settings = lib.mkMerge [ - { - add_newline = false; - line_break.disabled = true; - - character = { - success_symbol = "[>](bold green)"; - error_symbol = "[>](bold red)"; - vimcmd_symbol = "[<](bold green)"; - vimcmd_replace_one_symbol = "[<](bold purple)"; - vimcmd_replace_symbol = "[<](bold purple)"; - vimcmd_visual_symbol = "[<](bold yellow)"; - }; - } - (builtins.fromTOML (builtins.readFile "${pkgs.starship}/share/starship/presets/nerd-font-symbols.toml")) - ]; - }; - - eza = { - enable = true; - git = true; - icons = true; - extraOptions = ["--header"]; - # Fish have builtin aliases for `ls`, alias `ls` to `eza` is the only thing we want to do - #enableAliases = true; - }; - - skim = { - enable = true; - defaultCommand = "rg --files || fd --type f || find ."; - # rg --files ran - # 4.40 ± 0.44 times faster than fd --type f - # 60.39 ± 5.80 times faster than find . - }; - - git = { - enable = true; - userName = "Guanran Wang"; - userEmail = "guanran928@outlook.com"; - delta.enable = true; - signing.signByDefault = true; - signing.key = "~/.ssh/id_github_signing"; - extraConfig = { - gpg.format = "ssh"; - pull.rebase = true; - }; - }; }; } diff --git a/users/guanranwang/home-manager/profiles/graphical-stuff/nixos/default.nix b/users/guanranwang/home-manager/profiles/graphical-stuff/nixos/default.nix index 0507bb6..e222439 100644 --- a/users/guanranwang/home-manager/profiles/graphical-stuff/nixos/default.nix +++ b/users/guanranwang/home-manager/profiles/graphical-stuff/nixos/default.nix @@ -6,7 +6,6 @@ ./wallpapers ./packages.nix - ./input-method.nix ./theme.nix ./xdg-mime.nix ] @@ -42,6 +41,7 @@ "sway" # Misc + "fcitx5" "irssi" "mumble" ];