nixpkgs-suyu/nixos/modules/services/desktops/gnome/tracker.nix
Jan Tojnar 3c1b474e44 nixos/tracker: Define env var so it can find miners’ subcommands
tracker looks in its directory tree for executable files
to make available as subcommands. Users expect to find subcommands
from tracker-miners package but that fails as they are in different
tree. We also cannot change the lookup path since tracker-miners
also depends on a library from tracker package.

Until we can break the dependency cycle on package level:

   tracker -> tracker-miners -> tracker-sparql (tracker)

we need to work around it. I chose to set an environment
variable that overrides the subcommands lookup to a tree
symlinking files from both packages in GNOME NixOS module.

https://gitlab.gnome.org/GNOME/tracker/-/issues/341
Fixes: https://github.com/NixOS/nixpkgs/issues/153378
2022-01-03 22:25:03 +01:00

76 lines
1.4 KiB
Nix

# Tracker daemon.
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.services.gnome.tracker;
in
{
meta = {
maintainers = teams.gnome.members;
};
imports = [
# Added 2021-05-07
(mkRenamedOptionModule
[ "services" "gnome3" "tracker" "enable" ]
[ "services" "gnome" "tracker" "enable" ]
)
];
###### interface
options = {
services.gnome.tracker = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Whether to enable Tracker services, a search engine,
search tool and metadata storage system.
'';
};
subcommandPackages = mkOption {
type = types.listOf types.package;
default = [ ];
internal = true;
description = ''
List of packages containing tracker3 subcommands.
'';
};
};
};
###### implementation
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.tracker ];
services.dbus.packages = [ pkgs.tracker ];
systemd.packages = [ pkgs.tracker ];
environment.variables = {
TRACKER_CLI_SUBCOMMANDS_DIR =
let
subcommandPackagesTree = pkgs.symlinkJoin {
name = "tracker-with-subcommands-${pkgs.tracker.version}";
paths = [ pkgs.tracker ] ++ cfg.subcommandPackages;
};
in
"${subcommandPackagesTree}/libexec/tracker3";
};
};
}