Skip to content

Commit 8b2946a

Browse files
Merge pull request #8 from xinyangli/main
nix: add assertions to make sure dbus can provide pidfd
2 parents 63684c2 + 9a67505 commit 8b2946a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

flake.nix

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,27 @@
151151
};
152152
})
153153
(lib.mkIf config.security.polkit.persistentAuthentication {
154+
assertions =
155+
let
156+
mkMessage = (
157+
package: minVer: ''
158+
To provide persistent authentication, Polkit requires `pidfd` support when fetching process details from D-Bus, which is only available in `${package}` version ${minVer} or later.
159+
160+
Please update the package or switch `services.dbus.implementation` in the configuration.
161+
''
162+
);
163+
in
164+
[
165+
(lib.mkIf (config.services.dbus.implementation == "dbus") {
166+
assertion = lib.versionAtLeast config.services.dbus.dbusPackage.version "1.15.7";
167+
message = mkMessage "dbus" "1.15.7";
168+
})
169+
(lib.mkIf (config.services.dbus.implementation == "broker") {
170+
assertion = lib.versionAtLeast config.services.dbus.brokerPackage.version "34";
171+
message = mkMessage "dbus-broker" "34";
172+
})
173+
];
174+
154175
security.polkit.extraConfig = ''
155176
polkit.addRule(function(action, subject) {
156177
if (action.id == "org.freedesktop.policykit.exec") {

0 commit comments

Comments
 (0)