mirror of
https://github.com/nix-community/home-manager
synced 2024-11-10 07:04:17 +00:00
home-manager: use hostname
from GNU inetutils
This partially reverts commit 89670e27e1
.
Co-authored-by: Johannes Maier <johannes.maier@mailbox.org>
This commit is contained in:
parent
2b1957a0a3
commit
c82fc8cf3f
2 changed files with 3 additions and 12 deletions
|
@ -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}' \
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue