From 658910097bda5fc6ff07c145d8a3928f7b1ec551 Mon Sep 17 00:00:00 2001 From: Origami404 Date: Sun, 17 May 2026 10:24:49 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E4=B8=AA=E4=BA=BA=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 17 +++++++++++-- home/hosts/eris.nix | 4 ---- home/hosts/hypnos.nix | 1 - home/hosts/oparic-local-dev.nix | 4 ---- home/modules/shell-develop.nix | 9 +------ home/modules/shell.nix | 42 --------------------------------- home/modules/zsh.nix | 7 +----- home/standalone/.zsh.d/nix.zsh | 16 +++++++++++++ hosts/hypnos/configuration.nix | 2 +- hosts/modules/users/origami.nix | 6 ++--- 10 files changed, 37 insertions(+), 71 deletions(-) diff --git a/README.md b/README.md index b410243..a949ca5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,19 @@ # Origami404's flakes -Please check out [inclyc/flakes](https://github.com/inclyc/flakes), his repo is certainly more `__attribute__((pure))`-er than mine! +参考: [inclyc/flakes](https://github.com/inclyc/flakes). -请立刻查看 [inclyc/flakes](https://github.com/inclyc/flakes), 他的比我的 `__attribute__((pure))` 多了. +系统更新: +```bash +o4-nixos-switch +``` + +用户配置更新: +```bash +o4-home-switch +``` + +包更新: +```bash +nix flake update +``` diff --git a/home/hosts/eris.nix b/home/hosts/eris.nix index c5c55c0..9b1139d 100644 --- a/home/hosts/eris.nix +++ b/home/hosts/eris.nix @@ -21,8 +21,4 @@ ltrace # library call monitoring lsof # list open files ]; - - programs.fish.shellAliases = { - "flake-update" = "nixos-rebuild switch --use-remote-sudo --flake ${config.home.homeDirectory}/flakes#eris"; - }; } diff --git a/home/hosts/hypnos.nix b/home/hosts/hypnos.nix index 6d4562e..edf9a3b 100644 --- a/home/hosts/hypnos.nix +++ b/home/hosts/hypnos.nix @@ -22,7 +22,6 @@ ]; programs.zsh.shellAliases = { - "hm-update" = "home-manager switch --flake ${config.home.homeDirectory}/flakes#origami@hypnos"; "brew" = "/opt/homebrew/bin/brew"; "tailscale" = "/Applications/Tailscale.app/Contents/MacOS/Tailscale"; }; diff --git a/home/hosts/oparic-local-dev.nix b/home/hosts/oparic-local-dev.nix index e2e5054..a615a95 100644 --- a/home/hosts/oparic-local-dev.nix +++ b/home/hosts/oparic-local-dev.nix @@ -10,8 +10,4 @@ ../modules/shell-develop.nix ../modules/ssh.nix ]; - - programs.fish.shellAliases = { - "flake-update" = "nixos-rebuild switch --use-remote-sudo --flake ${config.home.homeDirectory}/flakes#oparic-local-dev"; - }; } diff --git a/home/modules/shell-develop.nix b/home/modules/shell-develop.nix index 3e920d8..e5fee71 100644 --- a/home/modules/shell-develop.nix +++ b/home/modules/shell-develop.nix @@ -5,15 +5,8 @@ clang-tools python312 python312Packages.ipython + direnv ]; - programs.fish.shellAliases = { - "ipy" = "ipython --no-confirm-exit"; - }; - - programs.direnv.enable = true; - programs.fish.shellInit = '' - direnv hook fish | source - ''; programs.git = { enable = true; diff --git a/home/modules/shell.nix b/home/modules/shell.nix index bb1e8b1..a35ae8a 100644 --- a/home/modules/shell.nix +++ b/home/modules/shell.nix @@ -13,7 +13,6 @@ btop # better top procs # better ps scc # better cloc - btop # better top grc # log file colorize fastfetch # show off mtr # better traceroute @@ -22,45 +21,4 @@ socat # better netcat nmap ]; - - programs.nix-index.enableFishIntegration = true; - programs.fzf.enableFishIntegration = false; # use fish.fzf keybinding - programs.fish = { - enable = true; - interactiveShellInit = '' - set fish_greeting # Disable greeting - ''; - plugins = with pkgs.fishPlugins; [ - { name = "z"; src = z.src; } - { name = "grc"; src = grc.src; } - { name = "fzf-fish"; src = fzf-fish.src; } - { name = "autopair"; src = autopair.src; } - { name = "colored-man-pages"; src = colored-man-pages.src; } - ]; - shellInit = '' - fzf_configure_bindings --directory=\cp --git_log=\cl --history=\cr \ - --git_status= --processes= --variables= - ''; - shellAbbrs = { - "..." = "../.."; - "...." = "../../.."; - }; - shellAliases = { - "ls" = "eza"; - "ll" = "eza -l"; - "la" = "eza -a"; - "grep" = "rg"; - "top" = "btop"; - "dig" = "q"; - "nc" = "socat"; - "netcat" = "socat"; - "find" = "fd"; - "du" = "dust"; - "df" = "duf"; - "cloc" = "scc"; - # "cat" = "bat"; - "x" = "atool -x"; - "cl" = "clear"; - }; - }; } diff --git a/home/modules/zsh.nix b/home/modules/zsh.nix index fd1960c..b26a9b1 100644 --- a/home/modules/zsh.nix +++ b/home/modules/zsh.nix @@ -1,11 +1,6 @@ { lib, pkgs, ... }: { - programs.zsh = { - enable = true; - # enableCompletion = true; - autosuggestion.enable = true; - syntaxHighlighting.enable = true; - }; + programs.zsh.enable = true; home.shell.enableZshIntegration = true; home.file = diff --git a/home/standalone/.zsh.d/nix.zsh b/home/standalone/.zsh.d/nix.zsh index 09ec3d8..1e42111 100644 --- a/home/standalone/.zsh.d/nix.zsh +++ b/home/standalone/.zsh.d/nix.zsh @@ -1,5 +1,21 @@ #!/usr/bin/env zsh +if command -v direnv &> /dev/null; then + eval "$(direnv hook zsh)" +fi + +o4-nixos-switch() { + if [[ "$(uname)" == "Darwin" ]]; then + darwin-rebuild switch --flake ~/flakes#$(hostname) + else + nixos-rebuild switch --use-remote-sudo --flake ~/flakes#$(hostname) + fi +} + +o4-home-switch() { + home-manager switch --flake ~/flakes#$(whoami)@$(hostname) +} + sops-update-file() { local src_file="$1" local yaml_file="$2" diff --git a/hosts/hypnos/configuration.nix b/hosts/hypnos/configuration.nix index 6e015de..a879edc 100644 --- a/hosts/hypnos/configuration.nix +++ b/hosts/hypnos/configuration.nix @@ -10,7 +10,7 @@ networking.hostName = "hypnos"; time.timeZone = "Asia/Shanghai"; - programs.fish.enable = true; + programs.zsh.enable = true; users.users.origami = { home = "/Users/origami"; diff --git a/hosts/modules/users/origami.nix b/hosts/modules/users/origami.nix index 9f616d9..01328bf 100644 --- a/hosts/modules/users/origami.nix +++ b/hosts/modules/users/origami.nix @@ -1,9 +1,9 @@ +{ pkgs, ... }: { - ... -}: -{ + programs.zsh.enable = true; users.users.origami = { isNormalUser = true; + shell = pkgs.zsh; description = "Origami404"; group = "origami"; openssh.authorizedKeys.keys = [