Skip to content

hostname-debian: set main program and use in more places#422282

Merged
mweinelt merged 6 commits intoNixOS:masterfrom
mweinelt:hostname
Jul 6, 2025
Merged

hostname-debian: set main program and use in more places#422282
mweinelt merged 6 commits intoNixOS:masterfrom
mweinelt:hostname

Conversation

@mweinelt
Copy link
Member

@mweinelt mweinelt commented Jul 4, 2025

The debian hostname utility is a small replacement for the version from net-tools. The net-tools suite has been badly maintained since at least a decade, so we should phase out its use.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • Nixpkgs 25.11 Release Notes (or backporting 25.05 Nixpkgs Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
  • NixOS 25.11 Release Notes (or backporting 25.05 NixOS Release notes)
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other contributing documentation in corresponding paths.

Add a 👍 reaction to pull requests you find important.

mweinelt added 3 commits July 4, 2025 06:51
This is the simpler, more lightweight and better maintained version of
the hostname utility.
This is the simpler, more lightweight and better maintained version of
the hostname utility.
@nixpkgs-ci nixpkgs-ci bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. labels Jul 4, 2025
@nixpkgs-ci nixpkgs-ci bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Jul 4, 2025
@SuperSandro2000
Copy link
Member

We probably want to add

This is the simpler, more lightweight and better maintained version of
the hostname utility.
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. and removed 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Jul 4, 2025
@nix-owners nix-owners bot requested a review from posch July 5, 2025 00:05
@adamcstephens
Copy link
Contributor

Is this failure from the tests relevant?

error: 1 dependencies of derivation '/nix/store/zix6dvl49a8bn6blxjicknq47kikk1iv-xdg-mime-test.drv' failed to build

@ofborg test zfs_2_3

@mweinelt
Copy link
Member Author

mweinelt commented Jul 5, 2025

xdg-utils-test.drv

❯ nom-build -A xdg-utils.tests
these 3 derivations will be built:
  /nix/store/p3r5dzi9ap4sxsd4mqmjsgfyi6z6q0gb-xdg-utils-1.2.1.drv
  /nix/store/vb7y3wwzvcjby9sngfdy4pngnpxx7byq-kernelkisser.png.drv
  /nix/store/qp3zz4n2vdap99ydxfmsqfwcggg50jmy-xdg-mime-test.drv
kernelkisser.png> building '/nix/store/vb7y3wwzvcjby9sngfdy4pngnpxx7byq-kernelkisser.png.drv'
xdg-utils> building '/nix/store/p3r5dzi9ap4sxsd4mqmjsgfyi6z6q0gb-xdg-utils-1.2.1.drv' on 'ssh://hexa@build1.darmstadt.ccc.de'
kernelkisser.png> 
kernelkisser.png> trying https://staging.cohostcdn.org/attachment/0f5d9832-0cda-4d07-b35f-832b287feb6c/kernelkisser.png
kernelkisser.png>   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
kernelkisser.png>                                  Dload  Upload   Total   Spent    Left  Speed
kernelkisser.png>   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
kernelkisser.png> 100  150k    0  150k    0     0   151k      0 --:--:-- --:--:-- --:--:--  302k
error: hash mismatch in fixed-output derivation '/nix/store/vb7y3wwzvcjby9sngfdy4pngnpxx7byq-kernelkisser.png.drv':
           likely URL: https://staging.cohostcdn.org/attachment/0f5d9832-0cda-4d07-b35f-832b287feb6c/kernelkisser.png https://static1.e621.net/data/0e/76/0e7672980d48e48c2d1373eb2505db5a.png
            specified: sha256-SL95tM1AjOi7vDnCyT10s0tvQvc+ZSZBbkNOYXfbOy0=
                  got: sha256-UrZclZZqAizqZgZxqya3tG8vApWoqQs29xhuz7brJG8=
        expected path: /nix/store/b1id7i4xs4lfln5xjni08p0n2p1nphsp-kernelkisser.png
             got path: /nix/store/ch7j8b8yp7i50pwc0ax2v6cjna67myff-kernelkisser.png

@ofborg test zfs_2_3

/nix/store/xns6v2607r1na3a0nksmifx2c71sp4wx-vm-test-run-installer-zfs-root
/nix/store/vpn1qcqfwzqpq380d0dd5wxsqnm8gra8-vm-test-run-zfs_2_3

This leads to a different hash, thereby breaking the test.
@mweinelt mweinelt merged commit 20a1869 into NixOS:master Jul 6, 2025
27 of 29 checks passed
@mweinelt mweinelt deleted the hostname branch July 6, 2025 22:32
echo "setting host name..."
if [ -s /etc/ec2-metadata/hostname ]; then
${pkgs.nettools}/bin/hostname $(cat /etc/ec2-metadata/hostname)
${lib.getExe hostname-debian} -F /etc/ec2-metadata/hostname
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've got undefined variable 'hostname-debian'. Shouldn't it be pkgs.hostname-debian?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GaetanLepage
Copy link
Contributor

Interestingly, this "broke" (now refuses to evaluate) wl-copy on darwin:

 error: Package ‘hostname-debian-3.25’ in /home/gaetan/nix/nixpkgs/pkgs/by-name/ho/hostname-debian/package.nix:30 is not available on the requested hostPlatform

Obviously, it was probably not expected for wl-copy to build at all on darwin.

@mweinelt
Copy link
Member Author

mweinelt commented Jul 8, 2025

Yes, please limit it to whatever platforms wlroots supports.

@02strich
Copy link

02strich commented Jul 8, 2025

This broke xdg-utils which beforehand worked on darwin, but no longer does (as hostname-debian isn't available for darwin). I believe that xdg-utils should be able to run on darwin - is that a case where the package should use nettools then?

@mweinelt
Copy link
Member Author

mweinelt commented Jul 8, 2025

I would instead try to make hostname-debian to work on darwin.

@adamcstephens
Copy link
Contributor

Or alternatively: https://cgit.freebsd.org/src/tree/bin/hostname

@MattSturgeon
Copy link
Contributor

Obviously, it was probably not expected for wl-copy to build at all on darwin.

Yes, please limit it to whatever platforms wlroots supports.

It seems like darwin support was intentionally added in 11fc036 (#224878).

Maybe @wegank has some insight for when/why wl-clipboard would be needed on darwin?

@wegank
Copy link
Member

wegank commented Jul 10, 2025

I've updated the platform list for wl-clipboard because upstream expects this, but it indeed has no real use...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.