Skip to content

xen: finish moving to by-name; refactor#406638

Merged
philiptaron merged 5 commits intoNixOS:masterfrom
SigmaSquadron:push-upkkwyrutmwn
Jul 6, 2025
Merged

xen: finish moving to by-name; refactor#406638
philiptaron merged 5 commits intoNixOS:masterfrom
SigmaSquadron:push-upkkwyrutmwn

Conversation

@SigmaSquadron
Copy link
Contributor

@SigmaSquadron SigmaSquadron commented May 13, 2025

Follow-up to the second Xen refactor:

This finally moves the builder to by-name, as we can now easily override Xen for a custom build thanks to finalAttrs.
Also does some minor refactoring, like enabling strictDeps and using getExe.

Things done

  • Built on platform(s)
    • x86_64-linux
  • 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/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (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.

Add a 👍 reaction to pull requests you find important.

@SigmaSquadron SigmaSquadron added the 2.status: wait for branch‐off Waiting for the next Nixpkgs branch‐off label May 13, 2025
@github-actions github-actions bot added the 6.topic: xen-project Issues and PRs related to the Xen Project Hypervisor. label May 13, 2025
@nix-owners nix-owners bot requested a review from philiptaron May 13, 2025 02:09
@github-actions github-actions bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. labels May 13, 2025
@hehongbo hehongbo added the 12.approvals: 1 This PR was reviewed and approved by one person. label May 13, 2025
Copy link
Contributor

@drupol drupol left a comment

Choose a reason for hiding this comment

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

Added a minor opinonated feedback to switch from optional to the more explicit optionals (singular to plural form) to reduce the cognitive load for newcomers.

IMO, it also makes sense to me to use it when dealing with lists (plural form), like buildInputs or knownVulnerabilities.

Copy link
Contributor

@philiptaron philiptaron left a comment

Choose a reason for hiding this comment

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

It's a pretty steep deprecation, but I trust the Xen project to judge whether that's too fast.

@SigmaSquadron
Copy link
Contributor Author

I should clarify that as a breaking change, this will need to wait for the branch-off.

@wegank wegank added 12.approvals: 3+ This PR was reviewed and approved by three or more persons. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. and removed 12.approvals: 1 This PR was reviewed and approved by one person. labels May 13, 2025
@SigmaSquadron SigmaSquadron removed the 2.status: wait for branch‐off Waiting for the next Nixpkgs branch‐off label May 16, 2025
@nixpkgs-ci nixpkgs-ci bot added the 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. label Jun 25, 2025
@SigmaSquadron SigmaSquadron force-pushed the push-upkkwyrutmwn branch 2 times, most recently from 85e0b92 to fcf0f22 Compare July 3, 2025 12:53
Copy link
Contributor

@philiptaron philiptaron left a comment

Choose a reason for hiding this comment

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

Lots of agreement with the TODOs in the derivation.

Deprecation schedule now looks quite sane.

@SigmaSquadron
Copy link
Contributor Author

SigmaSquadron commented Jul 5, 2025

behold the unholy patch

(doing this was quite nice. I managed to find several dependencies that weren't in the PATH wrapper)

@SigmaSquadron SigmaSquadron force-pushed the push-upkkwyrutmwn branch 2 times, most recently from 59f5d55 to 09636ee Compare July 5, 2025 03:52
This causes the removal of buildXenPackage, as the recommended way to
build a custom Xen is to override the package.

Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
The old `buildXenPackage` builder was a curried function that had to be
completed with a second call with attributes like `pname` and `version`.
As it is no longer necessary to call a generic builder to build custom
variants of Xen, the package must comply with the `by-name` checks, which
include the requirement that all `package.nix` files in this directory
hierarchy resolve to a derivation. (and not a function)

Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
Shuffles the input lists to ensure Xen works with `strictDeps` enabled.
There are more derivations in `nativeBuildInputs` than strictly
necessary for a successful build, but Xen calls for the OCaml and dev86
binaries during certain situations when building certain components.

Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
Changes some (long overdue) TODO comments and uses `lib.getExe` instead
of hardcoding /bin paths.

Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
@SigmaSquadron SigmaSquadron force-pushed the push-upkkwyrutmwn branch 2 times, most recently from 308cd14 to fe2444a Compare July 5, 2025 03:59
Copy link
Contributor

@philiptaron philiptaron left a comment

Choose a reason for hiding this comment

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

My quick rg math says that dropping the three IMO erroneous substitutions of echo, kill, and test (which are already dependency injected through patching the bash shebang at the top) drops 203 mutations in the patch file.

This looks like the right direction to me, though, megapatch though it may be.

This replaces the brittle PATH wrapper and substituteInPlace calls that
ensured the systemd services and the Xen scripts had all the necessary
dependencies. The new patch can replace the calls to external
executables much more effectively.

Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
"WGET=${getExe' coreutils "false"}"
"EFI_VENDOR=${finalAttrs.vendor}"
"INSTALL_EFI_STRIP=1"
"LD=${getExe' binutils-unwrapped-all-targets "ld"}"
Copy link
Contributor

Choose a reason for hiding this comment

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

I suspect we'll need to replace this with something like the following

preBuild = ''
  appendToVar makeFlags "LD=$(LD)"
'';

due to building with cross-compilation.

@philiptaron
Copy link
Contributor

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 406638
Commit: 5c3b43ab65a72f49893817d88edc82a3d53713b9


x86_64-linux

✅ 61 packages built:
  • appvm
  • collectd
  • diffoscope
  • diffoscope.dist
  • diffoscope.man
  • docker-machine-kvm2
  • fdroidserver
  • fdroidserver.dist
  • gnome-boxes
  • libguestfs (python313Packages.guestfs)
  • libguestfs.guestfsd (python313Packages.guestfs.guestfsd)
  • librenms
  • libvirt
  • libvirt-glib
  • libvirt-glib.dev
  • libvirt-glib.devdoc
  • libvmi
  • libvmi.dev
  • libvmi.lib
  • mgmt
  • minikube
  • multipass
  • perl538Packages.SysVirt
  • perl538Packages.SysVirt.devdoc
  • perl540Packages.SysVirt
  • perl540Packages.SysVirt.devdoc
  • podman-bootc
  • prometheus-libvirt-exporter
  • python312Packages.guestfs
  • python312Packages.guestfs.guestfsd
  • python312Packages.libvirt
  • python312Packages.libvirt.dist
  • python312Packages.xen
  • python312Packages.xen.boot
  • python312Packages.xen.dev
  • python312Packages.xen.doc
  • python312Packages.xen.man
  • python313Packages.libvirt
  • python313Packages.libvirt.dist
  • xen (python313Packages.xen)
  • xen.boot (python313Packages.xen.boot)
  • xen.dev (python313Packages.xen.dev)
  • xen.doc (python313Packages.xen.doc)
  • xen.man (python313Packages.xen.man)
  • qemu_xen
  • qemu_xen.debug
  • qemu_xen.doc
  • qemu_xen.ga
  • rubyPackages.ruby-libvirt (rubyPackages_3_3.ruby-libvirt)
  • rubyPackages_3_1.ruby-libvirt
  • rubyPackages_3_2.ruby-libvirt
  • rubyPackages_3_4.ruby-libvirt
  • vagrant
  • virt-manager
  • virt-manager-qt
  • virt-top
  • virt-v2v
  • virt-viewer
  • virtnbdbackup
  • virtnbdbackup.dist
  • xen-guest-agent

@philiptaron philiptaron merged commit 8ac41f3 into NixOS:master Jul 6, 2025
25 of 27 checks passed
@SigmaSquadron SigmaSquadron deleted the push-upkkwyrutmwn branch July 6, 2025 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: xen-project Issues and PRs related to the Xen Project Hypervisor. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 12.approvals: 3+ This PR was reviewed and approved by three or more persons. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants