fork/home-manager
git clone https://git.julia.blue/fork/home-manager
3b67ae3f
master
1{ config , lib , pkgs , ...} : 2let cfg = config . services . cliphist ; 3in { 4meta . maintainers = [ lib . maintainers . janik ]; 5 6options . services . cliphist = { 7enable = 8lib . mkEnableOption "cliphist, a clipboard history “manager” for wayland" ; 9 10package = lib . mkPackageOption pkgs "cliphist" { }; 11 12systemdTarget = lib . mkOption { 13type = lib . types . str ; 14default = "graphical-session.target" ; 15example = "sway-session.target" ; 16description = '' 17The systemd target that will automatically start the cliphist 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 = lib . mkIf cfg . enable { 27assertions = [ 28( lib . hm . assertions . assertPlatform "services.cliphist" pkgs 29lib . platforms . linux ) 30]; 31 32home . packages = [ cfg . package ]; 33 34systemd . user . services . cliphist = { 35Unit = { 36Description = "Clipboard management daemon" ; 37PartOf = [ "graphical-session.target" ]; 38}; 39 40Service = { 41Type = "simple" ; 42ExecStart = 43" ${ pkgs . wl-clipboard } /bin/wl-paste --watch ${ cfg . package } /bin/cliphist store" ; 44Restart = "on-failure" ; 45}; 46 47Install = { WantedBy = [ cfg . systemdTarget ]; }; 48}; 49}; 50}