ITADN

Activation emits "warning: 'install' is a deprecated alias for 'add'" (nix profile install) on recent Nix

#9598Openojhermann 创建于 2026-07-04
O
ojhermanncommented
### Are you following the right branch? Yes — I have verified the current `master` still exhibits this. ### Is there an existing issue for this? I searched open/closed issues and found none tracking this specific deprecation warning. ### Issue description When activating a Home Manager generation on a system running a recent Nix (Determinate Nix 3.17.1 / Nix 2.33.3), the `installPackages` activation step prints: ``` warning: 'install' is a deprecated alias for 'add' ``` This is because `installPackages` unconditionally invokes `nix profile install`. Recent Nix renamed the subcommand `nix profile install` → `nix profile add`, keeping `install` as a **deprecated alias**, so every `home-manager switch` (or `nixos-rebuild` that activates HM) now emits this warning. The relevant code in `modules/home-environment.nix` (still present on `master`): ```sh function nixReplaceProfile() { local oldNix="$(command -v nix)" nixProfileRemove 'home-manager-path' run $oldNix profile install $1 } if [[ -e ${cfg.profileDirectory}/manifest.json ]] ; then INSTALL_CMD="nix profile install" INSTALL_CMD_ACTUAL="nixReplaceProfile" ... ``` The existing detection only distinguishes modern Nix (`nix profile install`) from legacy `nix-env -i` (via the presence of `manifest.json`); it does not account for the newer `add` spelling. ### Expected behavior Activation should not emit a deprecation warning on Nix versions where `nix profile add` is the canonical subcommand. ### Suggested fix Detect support for `nix profile add` (e.g. probe `nix profile add --help` / check the Nix version) and prefer it, falling back to `nix profile install` on older Nix that lacks `add`. That keeps backward compatibility while silencing the warning on current Nix. ### Metadata - Home Manager: release `26.11`, rev `062581938b4a` - Nix: Determinate Nix 3.17.1 (Nix 2.33.3) - Platform: `aarch64-darwin`
0 条评论