diff --git a/home-manager/default.nix b/home-manager/default.nix index 5e0e1e462..50fda77e5 100644 --- a/home-manager/default.nix +++ b/home-manager/default.nix @@ -1,5 +1,5 @@ { runCommand, lib, bash, callPackage, coreutils, findutils, gettext, gnused, jq -, less, ncurses, unixtools +, less, ncurses, inetutils # used for pkgs.path for nixos-option , pkgs @@ -38,7 +38,7 @@ in runCommand "home-manager" { less ncurses nixos-option - unixtools.hostname + inetutils # for `hostname` ] }" \ --subst-var-by HOME_MANAGER_LIB '${../lib/bash/home-manager.sh}' \ diff --git a/home-manager/home-manager b/home-manager/home-manager index 8b7bbc76a..5bf796b47 100644 --- a/home-manager/home-manager +++ b/home-manager/home-manager @@ -198,18 +198,9 @@ function setFlakeAttribute() { ;; *) local name="$USER" - - local hostnameArray=() - # FQDN lookup can fail depending on the resolver. - local fqdn - if fqdn="$(hostname -f 2> /dev/null)"; then - hostnameArray+=( "$USER@$fqdn" ) - fi # Check FQDN, long, and short hostnames; long first to preserve # pre-existing behaviour in case both happen to be defined. - hostnameArray+=( "$USER@$(hostname)" "$USER@$(hostname -s)" ) - - for n in "${hostnameArray[@]}"; do + for n in "$USER@$(hostname -f)" "$USER@$(hostname)" "$USER@$(hostname -s)"; do if [[ "$(nix eval "$flake#homeConfigurations" --apply "x: x ? \"$n\"")" == "true" ]]; then name="$n" if [[ -v VERBOSE ]]; then