Skip to content

Comments

polkit: fix building with useSystemd = false#393045

Merged
alyssais merged 1 commit intoNixOS:stagingfrom
alyssais:polkit-elogind
Mar 28, 2025
Merged

polkit: fix building with useSystemd = false#393045
alyssais merged 1 commit intoNixOS:stagingfrom
alyssais:polkit-elogind

Conversation

@alyssais
Copy link
Member

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/)
  • 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.

@github-actions github-actions bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. labels Mar 25, 2025
@nix-owners nix-owners bot requested a review from jtojnar March 25, 2025 10:51
@alyssais alyssais changed the base branch from master to staging March 25, 2025 10:52
@alyssais alyssais marked this pull request as draft March 25, 2025 13:52
@alyssais alyssais marked this pull request as ready for review March 25, 2025 14:33
Copy link
Member

Choose a reason for hiding this comment

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

With people merging stuff from r-ryantm without proper review of upstream changes, I am a bit paranoid. I think I would prefer more explicit

Suggested change
mv "$DESTDIR/usr/lib"/* "$out/lib"
mkdir "$out/lib"
mv "$DESTDIR/usr/lib/"{sysusers,tmpfiles}".d" "$out/lib"

to reduce the chance of new hardcoded artifact slipping through our fingers. The third one can be set by -Dsystemdsystemunitdir.

Or maybe we could convince upstream to add options for the .d as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

How's that?

Or maybe we could convince upstream to add options for the .d as well.

It was hard enough to stop there being a hard dependency on systemd.pc. Given that we need to have this moving mechanism for other stuff anyway, I don't think it's worth it.

The PKG_CONFIG_* environment variables are only read from when
systemd.pc is found.  This meant that the ! test -e "$DESTDIR" check
would fail when built without systemd.  Avoid that by handling the
systemd files unconditionally installed in lib the same way we do
for etc.
Copy link
Member

@jtojnar jtojnar left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

@wegank wegank added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Mar 28, 2025
@alyssais alyssais merged commit 12f68bf into NixOS:staging Mar 28, 2025
27 of 29 checks passed
@alyssais alyssais deleted the polkit-elogind branch March 28, 2025 09:40
@trofi
Copy link
Contributor

trofi commented Mar 30, 2025

Bisect says 12f68bf polkit: fix building with useSystemd = false broke polkit build on x86_64-linux as:

$ nix build --no-link -f. polkit -L
...
polkit> Running custom install script '/nix/store/ygsy9bxnz02122csd8bydvjnmmxc09d8-python3-3.12.9/bin/python3.12 /build/source/meson_post_install.py /nix/store/p2lf4xiyrjiifm492b7pzd6hpjzkbxs8-polkit-126-bin/bin lib/polkit-1 /etc/polkit-1 polkituser'
polkit> Owner and mode of /build/source/build/dest/nix/store/p2lf4xiyrjiifm492b7pzd6hpjzkbxs8-polkit-126-bin/bin/pkexec need to be setuid root (04755) after installation
polkit> Owner of /build/source/build/dest/etc/polkit-1/rules.d needs to be set to root and group to polkituser after installation
polkit> Owner and mode of /build/source/build/dest/nix/store/m2wdi9mfxl8icia674gh49qbma53qz34-polkit-126/lib/polkit-1/polkit-agent-helper-1 need to be setuid root (04755) after installation
polkit> mv: cannot stat 'dest/usr/lib/sysusers.d': No such file or directory
polkit> mv: cannot stat 'dest/usr/lib/tmpfiles.d': No such file or directory
error: builder for '/nix/store/nb6655bps51fqxq2rgd9cic3hsvc15mz-polkit-126.drv' failed with exit code 1;

@alyssais
Copy link
Member Author

#394675

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

Labels

10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 12.approvals: 1 This PR was reviewed and approved by one person. 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.

4 participants