nixpkgs/pkgs/development/libraries/kde-frameworks/baloo.nix
Klemens Nanni eaf4ec2634 plasma5Package.baloo: Unbreak kde-baloo.service startup
https://invent.kde.org/frameworks/baloo/-/blob/048edc5d/src/file/kde-baloo.service.in#L9
expects the `kde-systemd-start-condition` executable to be in "baloo"s
installation directory, but unique nixpkgs derivations break this
assumption:

```
$ journalctl --user -u kde-baloo -o cat
Starting Baloo File Indexer Daemon...
kde-baloo.service: Failed to locate executable /nix/store/74g3ahh0k0x6d5rj5rxs1lxhzx81vgdd-baloo-5.95.0/bin/kde-systemd-start-condition: No such file or directory
kde-baloo.service: Failed at step EXEC spawning /nix/store/74g3ahh0k0x6d5rj5rxs1lxhzx81vgdd-baloo-5.95.0/bin/kde-systemd-start-condition: No such file or directory
kde-baloo.service: Skipped due to 'exec-condition'.
Condition check resulted in Baloo File Indexer Daemon being skipped.
```
```
$ systemctl --user cat kde-baloo | grep kde-systemd-start-condition
ExecCondition=/nix/store/74g3ahh0k0x6d5rj5rxs1lxhzx81vgdd-baloo-5.95.0/bin/kde-systemd-start-condition --condition "baloofilerc:Basic Settings:Indexing-Enabled:true"
```

`kde-systemd-start-condition` is provided by the "plasma-workspace"
derivation which depends on "baloo".

Replace the CMake macro with the generic current system's path to fix
service startup and to avoid a recursive dependency.
2022-06-25 23:23:48 +04:00

26 lines
899 B
Nix

{
mkDerivation,
extra-cmake-modules,
kauth, kconfig, kcoreaddons, kcrash, kdbusaddons, kfilemetadata, ki18n,
kidletime, kio, lmdb, qtbase, qtdeclarative, solid,
}:
mkDerivation {
pname = "baloo";
nativeBuildInputs = [ extra-cmake-modules ];
buildInputs = [
kauth kconfig kcrash kdbusaddons ki18n kio kidletime lmdb qtdeclarative
solid
];
outputs = [ "out" "dev" ];
propagatedBuildInputs = [ kcoreaddons kfilemetadata qtbase ];
# kde-baloo.service uses `ExecCondition=@KDE_INSTALL_FULL_BINDIR@/kde-systemd-start-condition ...`
# which comes from the "plasma-workspace" derivation, but KDE_INSTALL_* all point at the "baloo" one
# (`${lib.getBin pkgs.plasma-workspace}` would cause infinite recursion)
postUnpack = ''
substituteInPlace "$sourceRoot"/src/file/kde-baloo.service.in \
--replace @KDE_INSTALL_FULL_BINDIR@ /run/current-system/sw/bin
'';
}