From a41bcc4cd9cddde9e03cc99b2a57e6356e062d8d Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Wed, 20 May 2026 13:56:12 +0100 Subject: zsh: add hm wrapper for flake-based home-manager The standalone 'home-manager' command defaults to the legacy ~/.config/home-manager/home.nix and errors out for flake users. The wrapper auto-selects the host/vm profile by /etc/os-release ID and points at whichever dotfiles checkout exists on the machine. Usage: hm news hm switch hm generations --- dot_config/zsh/dot_zshrc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dot_config/zsh/dot_zshrc b/dot_config/zsh/dot_zshrc index f94b82e..0bca505 100644 --- a/dot_config/zsh/dot_zshrc +++ b/dot_config/zsh/dot_zshrc @@ -360,6 +360,18 @@ alias j='just' alias dj='just --justfile ~/dotfiles/justfile --working-directory ~/dotfiles' alias rj='just --justfile ~/.local/share/dotfiles/nix/justfile --working-directory ~/.local/share/dotfiles/nix' +# Home-Manager (flake-based; standalone HM defaults to legacy ~/.config/home-manager) +hm() { + local profile=host + [ -r /etc/os-release ] && . /etc/os-release + case "${ID:-}" in + ubuntu|debian) profile=vm ;; + esac + local flake="$HOME/dotfiles/nix#${profile}" + [ -d "$HOME/.local/share/dotfiles/nix" ] && flake="$HOME/.local/share/dotfiles/nix#${profile}" + nix run home-manager/master -- "$@" --flake "$flake" +} + # LLVM / Clang tooling alias ncmake='cmake -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_FLAGS="$DEV_CFLAGS" -DCMAKE_CXX_FLAGS="$DEV_CFLAGS" -DCMAKE_INSTALL_PREFIX=build/install -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -B build' alias ircc='clang -S -emit-llvm -fno-discard-value-names -O0 -Xclang -disable-O0-optnone -o -' -- cgit v1.3.1