-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
home-manager: Try short hostname in flake config lookup #3458
Conversation
096bc1d
to
b662285
Compare
On the unchecked items:
I have not included a news item for this as I wasn't sure if it was news-worthy or not. Let me know either way. |
I think this is a bug. It seems the call to |
I suspect that Perhaps there is some other command that could be used on macos to get the configured host name? |
Using
but at home:
Re "configured host name", there are at least a couple of things that could mean on macos, and they can all be set / retrieved with
Aside: from what I can see, Testing this at the cafe that is one of the places that causes me hostname headaches:
For comparison,
I'm not sure which would cause the least confusion: calling Let me know what you think the right next step should be :-) |
@kamalmarhubi Thank you very much for the thorough investigation! It is very much appreciated. I started reading https://apple.stackexchange.com/a/303411 and it seems to me that both $ hostname
baz.local
$ hostname -s
baz In other words, @hauleth, I see you did the |
Depending on DHCP settings you might end up with different output from running `hostname`. Eg, your local hostname is `mylaptop`, and your home router is configured with a local domain of `.hoome.arpa`. In this case: $ hostname mylaptop.home.arpa $ hostname -s mylaptop If you then go to cafe which has its router configured with `.lan` as its local domain. Then, if your DHCP settings accept the local domain from the router, $ hostname myalaptop.lan $ hostname -s mylaptop With the pre-existing behaviour, if you had a `"me@mylaptop.home.arpa"` entry in `outputs.homeConfigurations`, running `home-manager switch` would fail: $ home-manager switch error: flake 'git+file:///home/me/.config/nixpkgs' does not provide attribute 'packages.aarch64-darwin.homeConfigurations."me".activationPackage', 'legacyPackages.aarch64-darwin.homeConfigurations."me".activationPackage' or 'homeConfigurations."me".activationPackage' After this commit, you can put configuration in a `"me@mylaptop"` entry in `outputs.homeConfigurations`, and everything will work on either network.
b662285
to
e7eba9c
Compare
I've merged it as-is to master. If there is any problem we can handle that in a separate issue. Thanks for the contribution! |
Description
Depending on DHCP settings you might end up with different output from running
hostname
. Eg, your local hostname ismylaptop
, and your home router is configured with a local domain of.home.arpa
. In this case:If you then go to cafe which has its router configured with
.lan
as its local domain. Then, if your DHCP settings accept the local domain from the router,With the pre-existing behaviour, if you had a
"me@mylaptop.home.arpa"
entry inoutputs.homeConfigurations
, runninghome-manager switch
would fail:After this commit, you can put configuration in a
"me@mylaptop"
entry inoutputs.homeConfigurations
, and everything will work on either network.Checklist
Change is backwards compatible.
Code formatted with
./format
.Code tested through
nix-shell --pure tests -A run.all
.Test cases updated/added. See example.
Commit messages are formatted like
See CONTRIBUTING for more information and recent commit messages for examples.
If this PR adds a new module
Added myself as module maintainer. See example.
Added myself and the module files to
.github/CODEOWNERS
.