xdg-mime: add module
This commit is contained in:
parent
fdd65e5fad
commit
571989f564
|
@ -1268,6 +1268,18 @@ in
|
||||||
A new module is available: 'services.unison'.
|
A new module is available: 'services.unison'.
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
time = "2019-12-01T22:10:23+00:00";
|
||||||
|
condition = hostPlatform.isLinux;
|
||||||
|
message = ''
|
||||||
|
A new module is available: 'xdg.mime'.
|
||||||
|
|
||||||
|
If enabled, which it is by default, this module will create
|
||||||
|
the XDG mime database and desktop file database caches from
|
||||||
|
programs installed via Home Manager.
|
||||||
|
'';
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
49
modules/misc/xdg-mime.nix
Normal file
49
modules/misc/xdg-mime.nix
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
cfg = config.xdg.mime;
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
xdg.mime.enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Whether to install programs and files to support the
|
||||||
|
XDG Shared MIME-info specification and XDG MIME Applications
|
||||||
|
specification at
|
||||||
|
<link xlink:href="https://specifications.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html"/>
|
||||||
|
and
|
||||||
|
<link xlink:href="https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-latest.html"/>,
|
||||||
|
respectively.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf config.xdg.mime.enable {
|
||||||
|
home.packages = [
|
||||||
|
# Explicitly install package to provide basic mime types.
|
||||||
|
pkgs.shared-mime-info
|
||||||
|
];
|
||||||
|
|
||||||
|
home.extraProfileCommands = ''
|
||||||
|
if [[ -w $out/share/mime && -d $out/share/mime/packages ]]; then
|
||||||
|
XDG_DATA_DIRS=$out/share \
|
||||||
|
PKGSYSTEM_ENABLE_FSYNC=0 \
|
||||||
|
${pkgs.buildPackages.shared-mime-info}/bin/update-mime-database \
|
||||||
|
-V $out/share/mime > /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -w $out/share/applications ]]; then
|
||||||
|
${pkgs.buildPackages.desktop-file-utils}/bin/update-desktop-database \
|
||||||
|
$out/share/applications
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -33,6 +33,7 @@ let
|
||||||
(loadModule ./misc/qt.nix { })
|
(loadModule ./misc/qt.nix { })
|
||||||
(loadModule ./misc/submodule-support.nix { })
|
(loadModule ./misc/submodule-support.nix { })
|
||||||
(loadModule ./misc/version.nix { })
|
(loadModule ./misc/version.nix { })
|
||||||
|
(loadModule ./misc/xdg-mime.nix { condition = hostPlatform.isLinux; })
|
||||||
(loadModule ./misc/xdg-mime-apps.nix { condition = hostPlatform.isLinux; })
|
(loadModule ./misc/xdg-mime-apps.nix { condition = hostPlatform.isLinux; })
|
||||||
(loadModule ./misc/xdg-user-dirs.nix { condition = hostPlatform.isLinux; })
|
(loadModule ./misc/xdg-user-dirs.nix { condition = hostPlatform.isLinux; })
|
||||||
(loadModule ./misc/xdg.nix { })
|
(loadModule ./misc/xdg.nix { })
|
||||||
|
|
Loading…
Reference in a new issue