Espanso app -> option not working for me

Hello Nix Wizards

I installed the Espanso app in NixOS 22.05 and the option to start “espanso daemon”.
Somehow the daemon will not start and I have to do it manually each reboot.

Here’s the concerning part of my /etc/nixos/configuration.nix:

 users.users.me = {
    isNormalUser = true;
    extraGroups = [ "networkmanager" "wheel" "libvirtd" "kvm" "scanner" "lp" ];
    packages = with pkgs; [
      vimHugeX
      firefox
      thunderbird-102
      espanso
      copyq
      keepassxc
      joplin-desktop
      virt-manager
    ];
 };

services.espanso.enable = true;

the app is to find here: https://search.nixos.org/packages?channel=22.05&from=0&size=50&sort=relevance&type=packages&query=espanso

the option here: https://search.nixos.org/options?channel=22.05&show=services.espanso.enable&from=0&size=50&sort=relevance&type=packages&query=espanso

the option is declared as such:

{ config, lib, pkgs, ... }:

with lib;
let cfg = config.services.espanso;
in {
  meta = { maintainers = with lib.maintainers; [ numkem ]; };

  options = {
    services.espanso = { enable = options.mkEnableOption "Espanso"; };
  };

  config = mkIf cfg.enable {
    systemd.user.services.espanso = {
      description = "Espanso daemon";
      serviceConfig = {
        ExecStart = "${pkgs.espanso}/bin/espanso daemon";
        Restart = "on-failure";
      };
      wantedBy = [ "default.target" ];
    };

    environment.systemPackages = [ pkgs.espanso ];
  };
}

Would be lovely to get a hint! As I wouldn’t want to live without this great application!

Thank you

While I don’t have the answer to your issue, I just wanted to point out that the module itself sets environment.systemPackages = [ pkgs.espanso ];, as modules generally do, so doing that in your own config is redundant.

thank you tejing, that is some good information already!

It should start with default.target according to the systemd unit, so what does the output of systemctl --user status default.target show?

Seems to be active:

● default.target - Main User Target
     Loaded: loaded (/etc/systemd/user/default.target; static)
     Active: active since Mon 2022-09-19 21:05:02 CEST; 2min 39s ago
      Until: Mon 2022-09-19 21:05:02 CEST; 2min 39s ago
       Docs: man:systemd.special(7)

Starting Espanso in the terminal with “espanso daemon” does work!