mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 03:29:45 +01: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
|
{ runCommand, lib, bash, callPackage, coreutils, findutils, gettext, gnused, jq
|
||||||
, less, ncurses, unixtools
|
, less, ncurses, inetutils
|
||||||
# used for pkgs.path for nixos-option
|
# used for pkgs.path for nixos-option
|
||||||
, pkgs
|
, pkgs
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ in runCommand "home-manager" {
|
||||||
less
|
less
|
||||||
ncurses
|
ncurses
|
||||||
nixos-option
|
nixos-option
|
||||||
unixtools.hostname
|
inetutils # for `hostname`
|
||||||
]
|
]
|
||||||
}" \
|
}" \
|
||||||
--subst-var-by HOME_MANAGER_LIB '${../lib/bash/home-manager.sh}' \
|
--subst-var-by HOME_MANAGER_LIB '${../lib/bash/home-manager.sh}' \
|
||||||
|
|
|
@ -198,18 +198,9 @@ function setFlakeAttribute() {
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
local name="$USER"
|
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
|
# Check FQDN, long, and short hostnames; long first to preserve
|
||||||
# pre-existing behaviour in case both happen to be defined.
|
# pre-existing behaviour in case both happen to be defined.
|
||||||
hostnameArray+=( "$USER@$(hostname)" "$USER@$(hostname -s)" )
|
for n in "$USER@$(hostname -f)" "$USER@$(hostname)" "$USER@$(hostname -s)"; do
|
||||||
|
|
||||||
for n in "${hostnameArray[@]}"; do
|
|
||||||
if [[ "$(nix eval "$flake#homeConfigurations" --apply "x: x ? \"$n\"")" == "true" ]]; then
|
if [[ "$(nix eval "$flake#homeConfigurations" --apply "x: x ? \"$n\"")" == "true" ]]; then
|
||||||
name="$n"
|
name="$n"
|
||||||
if [[ -v VERBOSE ]]; then
|
if [[ -v VERBOSE ]]; then
|
||||||
|
|
Loading…
Reference in a new issue