mirror of
https://github.com/nix-community/home-manager
synced 2024-11-22 12:43:14 +00:00
home-manager: check FQDN for '--flake .' attribute
Since nixpkgs commit 993baa587c4b82e791686f6ce711bcd4ee8ef933, `networking.hostName` is not allowed to be a FQDN. Add `hostname --fqdn` to the default flake attribute names that are searched. If netorking.hostname = "hostname"; networking.domain = "example.com"; is set in the system NixOS configuration, this allows defining homeConfigurations."username@hostname.example.com" = ... and still use home-manager switch --flake . instead of having to type out home-manager switch --flake .#$(whoami)@$(hostname --fqdn)
This commit is contained in:
parent
04bc391a90
commit
1b589257f7
1 changed files with 2 additions and 2 deletions
|
@ -198,9 +198,9 @@ function setFlakeAttribute() {
|
|||
;;
|
||||
*)
|
||||
local name="$USER"
|
||||
# Check both 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.
|
||||
for n in "$USER@$(hostname)" "$USER@$(hostname -s)"; do
|
||||
for n in "$USER@$(hostname --fqdn)" "$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