nixos-config/lib/builders/xdg/make-portal-config.nix
Gabriel Arazas 0750c10a0d
lib/builders: update folder structure
This is to organize for future builders that may be more comprehensive.
2024-08-29 13:21:10 +08:00

18 lines
613 B
Nix

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