fork/home-manager
git clone https://git.julia.blue/fork/home-manager
75790441
master
1{ config , lib , pkgs , ...} : 2with lib ; 3let cfg = config . services . clipman ; 4in { 5meta . maintainers = [ maintainers . jwygoda ]; 6 7options . services . clipman = { 8enable = mkEnableOption "clipman, a simple clipboard manager for Wayland" ; 9 10package = mkPackageOption pkgs "clipman" { }; 11 12systemdTarget = mkOption { 13type = types . str ; 14default = "graphical-session.target" ; 15example = "sway-session.target" ; 16description = '' 17The systemd target that will automatically start the clipman service. 18 19When setting this value to `"sway-session.target"`, 20make sure to also enable {option}`wayland.windowManager.sway.systemd.enable`, 21otherwise the service may never be started. 22'' ; 23}; 24}; 25 26config = mkIf cfg . enable { 27assertions = [ 28( lib . hm . assertions . assertPlatform "services.clipman" pkgs 29lib . platforms . linux ) 30]; 31 32home . packages = [ cfg . package ]; 33 34systemd . user . services . clipman = { 35Unit = { 36Description = "Clipboard management daemon" ; 37PartOf = [ "graphical-session.target" ]; 38After = [ "graphical-session.target" ]; 39}; 40 41Service = { 42ExecStart = 43" ${ pkgs . wl-clipboard } /bin/wl-paste -t text --watch ${ cfg . package } /bin/clipman store" ; 44ExecReload = " ${ pkgs . coreutils } /bin/kill -SIGUSR2 $MAINPID" ; 45Restart = "on-failure" ; 46KillMode = "mixed" ; 47}; 48 49Install = { WantedBy = [ cfg . systemdTarget ]; }; 50}; 51}; 52}