Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a3a40ac7cce0
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 12834b3e8735
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Jul 10, 2020

  1. systemd: Allow setting the transient hostname via DHCP

    This permits using method_set_hostname but still denies
    method_set_static_hostname. As a result DHCP clients can now always set
    the transient hostname via the SetHostname method of the D-Bus interface
    of systemd-hostnamed (org.freedesktop.hostname1.set-hostname).
    If the NixOS option networking.hostName is set to an empty string (or
    "localhost") the static hostname (kernel.hostname but NOT /etc/hostname)
    will additionally be updated (this is intended).
    
    From "man hostnamectl": The transient hostname is a fallback value
    received from network configuration. If a static hostname is set, and is
    valid (something other than localhost), then the transient hostname is
    not used.
    
    Fix #74847.
    
    Note: It's possible to restrict access to the org.freedesktop.hostname1
    interface using Polkit rules.
    primeos authored and flokli committed Jul 10, 2020

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    pierreis Pierre
    Copy the full SHA
    483dbe9 View commit details

Commits on Jul 11, 2020

  1. Merge pull request #91232 from primeos/systemd-allow-transient-hostname

    systemd: Allow setting the transient hostname via DHCP
    flokli authored Jul 11, 2020
    Copy the full SHA
    12834b3 View commit details
Showing with 5 additions and 10 deletions.
  1. +5 −0 nixos/tests/systemd.nix
  2. +0 −10 pkgs/os-specific/linux/systemd/0007-hostnamed-localed-timedated-disable-methods-that-cha.patch
5 changes: 5 additions & 0 deletions nixos/tests/systemd.nix
Original file line number Diff line number Diff line change
@@ -97,6 +97,11 @@ import ./make-test-python.nix ({ pkgs, ... }: {
re.search(r"^Filesystem state: *clean$", extinfo, re.MULTILINE) is not None
), ("File system was not cleanly unmounted: " + extinfo)
# Regression test for https://github.com/NixOS/nixpkgs/pull/91232
with subtest("setting transient hostnames works"):
machine.succeed("hostnamectl set-hostname --transient machine-transient")
machine.fail("hostnamectl set-hostname machine-all")
with subtest("systemd-shutdown works"):
machine.shutdown()
machine.wait_for_unit("multi-user.target")
Original file line number Diff line number Diff line change
@@ -14,16 +14,6 @@ diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index 21f6471495..8c5af7619f 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -422,6 +422,9 @@ static int method_set_hostname(sd_bus_message *m, void *userdata, sd_bus_error *
if (r < 0)
return r;

+ return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED,
+ "Changing system settings via systemd is not supported on NixOS.");
+
if (isempty(name))
name = c->data[PROP_STATIC_HOSTNAME];

@@ -478,6 +481,9 @@ static int method_set_static_hostname(sd_bus_message *m, void *userdata, sd_bus_
if (r < 0)
return r;