diff --git a/configuration.nix b/configuration.nix index 78c1526..ca1c125 100644 --- a/configuration.nix +++ b/configuration.nix @@ -3,7 +3,7 @@ { imports = [ ./hardware-configuration.nix - ./programs/clash.nix + ./modules ]; # ── Nix 自身设置 ──────────────────────────────────────────── @@ -149,8 +149,6 @@ environment.systemPackages = with pkgs; [ rsync wget - htop - btop (python3.withPackages (ps: with ps; [ pip ])) zip unzip diff --git a/flake.lock b/flake.lock index 2c4a928..5c5ce1e 100644 --- a/flake.lock +++ b/flake.lock @@ -7,15 +7,16 @@ ] }, "locked": { - "lastModified": 1780099287, - "narHash": "sha256-efIPwVGtIWIjWcznhaop6XN6HxnOL8800hF6CBNvlqQ=", + "lastModified": 1779726825, + "narHash": "sha256-RUkMrREjKDQrA+dA9+xZviGAxM5W1aVdyOr/bSYpHrE=", "owner": "nix-community", "repo": "home-manager", - "rev": "7d8127d308c3fb9664f7e643eec944be74ebb37d", + "rev": "b179bde238977f7d4454fc770b1a727eaf55111c", "type": "github" }, "original": { "owner": "nix-community", + "ref": "release-26.05", "repo": "home-manager", "type": "github" } diff --git a/flake.nix b/flake.nix index 66bdfb6..25fa1e7 100644 --- a/flake.nix +++ b/flake.nix @@ -8,7 +8,7 @@ # 引入 Home Manager home-manager = { - url = "github:nix-community/home-manager"; + url = "github:nix-community/home-manager/release-26.05"; inputs.nixpkgs.follows = "nixpkgs"; # 保证 Home Manager 用的软件版本和系统一致 }; diff --git a/home.nix b/home.nix index 86b7d56..ab930c2 100644 --- a/home.nix +++ b/home.nix @@ -2,11 +2,7 @@ { imports = [ - ./programs/fish.nix - ./programs/git.nix - ./programs/plasma.nix - ./programs/rime.nix - ./programs/spicetify.nix + ./programs ]; # ⚠️ 极其重要:替换成你的实际系统用户名 @@ -20,6 +16,8 @@ jetbrains-toolbox google-chrome neovim + htop + btop telegram-desktop wechat gpu-screen-recorder @@ -37,7 +35,7 @@ nodejs pnpm kdePackages.kate - rime-ice + termius ]; # 让 nix-shell 等传统命令也能安装 unfree 软件 diff --git a/programs/clash.nix b/modules/clash.nix similarity index 100% rename from programs/clash.nix rename to modules/clash.nix diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..28a538d --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,7 @@ +{ ... }: + +{ + imports = [ + ./clash.nix + ]; +} diff --git a/programs/default.nix b/programs/default.nix new file mode 100644 index 0000000..951259e --- /dev/null +++ b/programs/default.nix @@ -0,0 +1,11 @@ +{ ... }: + +{ + imports = [ + ./fish.nix + ./git.nix + ./plasma.nix + ./rime.nix + ./spicetify.nix + ]; +} diff --git a/programs/fish.nix b/programs/fish.nix index 96846d2..4606a24 100644 --- a/programs/fish.nix +++ b/programs/fish.nix @@ -5,10 +5,150 @@ "$HOME/.npm-global/bin" ]; + programs.starship = { + enable = true; + enableFishIntegration = true; + settings = { + add_newline = true; + command_timeout = 1000; + + format = "$directory$git_branch$git_status$nix_shell$nodejs$python$cmd_duration$line_break$character"; + + palette = "luodh"; + palettes.luodh = { + blue = "#7aa2f7"; + cyan = "#7dcfff"; + green = "#9ece6a"; + orange = "#ff9e64"; + purple = "#bb9af7"; + red = "#f7768e"; + yellow = "#e0af68"; + }; + + character = { + success_symbol = "[❯](bold green)"; + error_symbol = "[❯](bold red)"; + vimcmd_symbol = "[❮](bold purple)"; + }; + + directory = { + style = "bold blue"; + truncation_length = 4; + truncate_to_repo = false; + read_only = " ro"; + }; + + git_branch = { + symbol = "git "; + style = "bold purple"; + format = "[$symbol$branch]($style) "; + }; + + git_status = { + style = "bold orange"; + format = "([$all_status$ahead_behind]($style) )"; + }; + + nix_shell = { + symbol = "nix "; + style = "bold cyan"; + format = "[$symbol$state( \\($name\\))]($style) "; + }; + + nodejs = { + symbol = "node "; + style = "bold green"; + format = "[$symbol$version]($style) "; + }; + + python = { + symbol = "py "; + style = "bold yellow"; + format = "[\${symbol}\${pyenv_prefix}(\${version} )(\\($virtualenv\\) )]($style)"; + }; + + cmd_duration = { + min_time = 500; + style = "bold yellow"; + format = "took [$duration]($style) "; + }; + }; + }; + programs.fish = { enable = true; + + shellAbbrs = { + c = "clear"; + cat = "bat"; + e = "$EDITOR"; + g = "git"; + ga = "git add"; + gc = "git commit"; + gd = "git diff"; + gl = "git log --oneline --decorate --graph"; + gp = "git push"; + gs = "git status --short --branch"; + l = "ls -lah"; + ll = "ls -alF"; + rebuild = "sudo nixos-rebuild switch --flake /etc/nixos#nixos"; + update = "sudo nix flake update --flake /etc/nixos && sudo nixos-rebuild switch --flake /etc/nixos#nixos"; + }; + interactiveShellInit = '' + set fish_greeting + + set -g fish_color_autosuggestion 6c7086 + set -g fish_color_cancel f7768e + set -g fish_color_command 7aa2f7 + set -g fish_color_comment 565f89 + set -g fish_color_cwd 9ece6a + set -g fish_color_cwd_root f7768e + set -g fish_color_end ff9e64 + set -g fish_color_error f7768e + set -g fish_color_escape bb9af7 + set -g fish_color_history_current --bold + set -g fish_color_match --background=313244 + set -g fish_color_normal c0caf5 + set -g fish_color_operator 7dcfff + set -g fish_color_param e0af68 + set -g fish_color_quote 9ece6a + set -g fish_color_redirection bb9af7 + set -g fish_color_search_match --background=313244 + set -g fish_color_selection --background=313244 + set -g fish_color_status f7768e + set -g fish_color_valid_path --underline + set -g fish_pager_color_completion c0caf5 + set -g fish_pager_color_description 6c7086 + set -g fish_pager_color_prefix 7aa2f7 --bold --underline + set -g fish_pager_color_progress 6c7086 + set -g fish_pager_color_selected_background --background=313244 + fish_add_path "$HOME/.npm-global/bin" ''; }; + + programs.bat.enable = true; + programs.fzf = { + enable = true; + enableFishIntegration = true; + colors = { + bg = "#1a1b26"; + fg = "#c0caf5"; + "bg+" = "#292e42"; + "fg+" = "#c0caf5"; + header = "#7dcfff"; + hl = "#7aa2f7"; + "hl+" = "#7aa2f7"; + info = "#bb9af7"; + marker = "#9ece6a"; + pointer = "#f7768e"; + prompt = "#7dcfff"; + spinner = "#e0af68"; + }; + }; + programs.zoxide = { + enable = true; + enableFishIntegration = true; + }; } diff --git a/programs/rime.nix b/programs/rime.nix index 0e985e3..c5ae651 100644 --- a/programs/rime.nix +++ b/programs/rime.nix @@ -1,6 +1,10 @@ { config, pkgs, ... }: { + home.packages = with pkgs; [ + rime-ice + ]; + home.file.".local/share/fcitx5/rime/default.custom.yaml".text = '' patch: schema_list: