nixos-config/lib/builders/xdg/make-portal-config.nix

20 lines
635 B
Nix
Raw Normal View History

{ lib, writeTextFile }:
/* Create an XDG Portals configuration with the given desktop name and its
2025-01-12 09:57:14 +00:00
configuration. Similarly, the given desktop name is assumed to be already
in its suitable form of a lowercase ASCII.
*/
2025-01-12 09:57:14 +00:00
{ desktopName ? "common",
2025-01-12 09:57:14 +00:00
# Nix-representable data to be exported as the portal configuration.
config, }:
writeTextFile {
2025-01-12 09:57:14 +00:00
name = "xdg-portal-config${
lib.optionalString (desktopName != "common") "-${desktopName}"
}";
text = lib.generators.toINI { } config;
2025-01-12 09:57:14 +00:00
destination = "/share/xdg-desktop-portal/${
lib.optionalString (desktopName != "common") "${desktopName}-"
}portals.conf";
}