dbus: Create with pacakges options (#7064)

This adds a module for dbus with only one option, `packages`.
The `dbus.packages` options allows users to specify packages to have
their dbus service files (from `/share/dbus-1/services`) linked to the
users dbus services directory (`$XDG_DATA_HOME/dbus-1/services/`),
effectively enabling the services.
This commit is contained in:
Rosario Pulella 2025-05-15 13:59:12 -04:00 committed by GitHub
parent 954615c510
commit ad1e8bb782
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 62 additions and 0 deletions

View file

@ -0,0 +1,3 @@
{
dbus-packages = ./packages.nix;
}

View file

@ -0,0 +1,21 @@
{ pkgs, config, ... }:
let
inherit (config.lib.test) mkStubPackage;
in
{
dbus.packages = [
(mkStubPackage {
name = "test";
buildScript = ''
mkdir -p $out/share/dbus-1/services
printf '%s' test > $out/share/dbus-1/services/test.service
'';
})
];
nmt.script = ''
serviceFile=home-files/.local/share/dbus-1/services/test.service
assertFileExists $serviceFile
assertFileContent $serviceFile "${pkgs.writeText "expected" "test"}"
'';
}