aboutsummaryrefslogtreecommitdiffhomepage
path: root/nixos.nix
diff options
context:
space:
mode:
authorOphestra Umiker <cat@ophivana.moe>2024-09-09 04:37:42 +0900
committerOphestra Umiker <cat@ophivana.moe>2024-09-09 04:58:25 +0900
commit0e5b85fd423fef438bbdfe43bd5183c70d9132c2 (patch)
tree6dbce873af4f4af524b860eb87211edb79ff1e5e /nixos.nix
parentcdc08817a7ec0d9cbe0b473708064d7a48120dbb (diff)
nix: implement new dbus options in nixos module
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'nixos.nix')
-rw-r--r--nixos.nix39
1 files changed, 38 insertions, 1 deletions
diff --git a/nixos.nix b/nixos.nix
index fb480117..e0c305fb 100644
--- a/nixos.nix
+++ b/nixos.nix
@@ -63,6 +63,35 @@ in
'';
};
+ dbus = {
+ config = mkOption {
+ type = nullOr anything;
+ default = null;
+ description = ''
+ D-Bus custom configuration.
+ Setting this to null will enable built-in defaults.
+ '';
+ };
+
+ id = mkOption {
+ type = nullOr str;
+ default = null;
+ description = ''
+ D-Bus application id.
+ Setting this to null will disable own path in defaults.
+ Has no effect if custom configuration is set.
+ '';
+ };
+
+ mpris = mkOption {
+ type = bool;
+ default = false;
+ description = ''
+ Whether to enable MPRIS in D-Bus defaults.
+ '';
+ };
+ };
+
capability = {
wayland = mkOption {
type = bool;
@@ -82,7 +111,7 @@ in
dbus = mkOption {
type = bool;
- default = false;
+ default = true;
description = ''
Whether to proxy D-Bus.
'';
@@ -193,11 +222,19 @@ in
with launcher.capability;
let
command = if launcher.command == null then name else launcher.command;
+ dbusConfig =
+ if launcher.dbus.config != null then
+ pkgs.writeText "${name}-dbus.json" (builtins.toJSON launcher.dbus.config)
+ else
+ null;
capArgs =
(if wayland then " -wayland" else "")
+ (if x11 then " -X" else "")
+ (if dbus then " -dbus" else "")
+ (if pulse then " -pulse" else "")
+ + (if launcher.dbus.mpris then " -mpris" else "")
+ + (if launcher.dbus.id != null then " -dbus-id ${dbus.id}" else "")
+ + (if dbusConfig != null then " -dbus-config ${dbusConfig}" else "")
+ (if launcher.method == "fortify-sudo" then " -sudo" else "");
in
pkgs.writeShellScriptBin name (