nixos/xdg.mime: remove with lib;

This commit is contained in:
Felix Buehler 2024-08-27 20:42:50 +02:00
parent 56adb6a6b2
commit 62782850ea

View File

@ -1,22 +1,19 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.xdg.mime;
associationOptions = with types; attrsOf (
coercedTo (either (listOf str) str) (x: concatStringsSep ";" (toList x)) str
associationOptions = with lib.types; attrsOf (
coercedTo (either (listOf str) str) (x: lib.concatStringsSep ";" (lib.toList x)) str
);
in
{
meta = {
maintainers = teams.freedesktop.members ++ (with maintainers; [ figsoda ]);
maintainers = lib.teams.freedesktop.members ++ (with lib.maintainers; [ figsoda ]);
};
options = {
xdg.mime.enable = mkOption {
type = types.bool;
xdg.mime.enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Whether to install files to support the
@ -25,7 +22,7 @@ in
'';
};
xdg.mime.addedAssociations = mkOption {
xdg.mime.addedAssociations = lib.mkOption {
type = associationOptions;
default = {};
example = {
@ -39,7 +36,7 @@ in
'';
};
xdg.mime.defaultApplications = mkOption {
xdg.mime.defaultApplications = lib.mkOption {
type = associationOptions;
default = {};
example = {
@ -53,7 +50,7 @@ in
'';
};
xdg.mime.removedAssociations = mkOption {
xdg.mime.removedAssociations = lib.mkOption {
type = associationOptions;
default = {};
example = {
@ -68,13 +65,13 @@ in
};
};
config = mkIf cfg.enable {
environment.etc."xdg/mimeapps.list" = mkIf (
config = lib.mkIf cfg.enable {
environment.etc."xdg/mimeapps.list" = lib.mkIf (
cfg.addedAssociations != {}
|| cfg.defaultApplications != {}
|| cfg.removedAssociations != {}
) {
text = generators.toINI { } {
text = lib.generators.toINI { } {
"Added Associations" = cfg.addedAssociations;
"Default Applications" = cfg.defaultApplications;
"Removed Associations" = cfg.removedAssociations;