mirror of
https://github.com/nix-community/home-manager
synced 2024-12-19 17:44:05 +00:00
8e8210b441
This change stops update-mime-database from running unless the `share/mime/packages` directory is writable. For some reason it appears to be read-only on WSL1. Fixes #1192
47 lines
1.3 KiB
Nix
47 lines
1.3 KiB
Nix
{ 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 && -w $out/share/mime/packages && -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
|
|
'';
|
|
};
|
|
|
|
}
|