From 494cfe614f5f2e02ac2c77957697c168fd0d76e1 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Fri, 28 Feb 2025 14:54:05 +0800 Subject: [PATCH] lib/builders: add settings attribute for XDG MIME list builder --- lib/builders/xdg/make-association-list.nix | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/builders/xdg/make-association-list.nix b/lib/builders/xdg/make-association-list.nix index eca1df6a..9ca9637b 100644 --- a/lib/builders/xdg/make-association-list.nix +++ b/lib/builders/xdg/make-association-list.nix @@ -10,6 +10,11 @@ # with. desktopName ? "", +# Optional Nix-representable settings in INI format. Mutually exclusive with +# `addedAssociations`, `removedAssociations`, and `defaultApplications` and +# basically ignores proper checking if set. +settings ? { }, + # Applications to be put in `Added Associations`. This is not set when the # database is desktop-specific (when the `desktopName` is non-empty.) addedAssociations ? { }, @@ -28,12 +33,14 @@ writeTextFile { text = # Non-desktop-specific mimeapps.list are only allowed to specify # default applications. - lib.generators.toINI { } ({ - "Default Applications" = defaultApplications; - } // (lib.optionalAttrs (desktopName == "") { - "Added Associations" = addedAssociations; - "Removed Associations" = removedAssociations; - })); + lib.generators.toINI { } ( + if (settings != { }) then settings + else { + "Default Applications" = defaultApplications; + } // (lib.optionalAttrs (desktopName == "") { + "Added Associations" = addedAssociations; + "Removed Associations" = removedAssociations; + })); destination = "/share/applications/${ lib.optionalString (desktopName != "") "${desktopName}-" }mimeapps.list";