lol

nixos/ringboard: add user service module

+81
+2
nixos/doc/manual/release-notes/rl-2511.section.md
··· 142 142 143 143 - [nvme-rs](https://github.com/liberodark/nvme-rs), NVMe monitoring [services.nvme-rs](#opt-services.nvme-rs.enable). 144 144 145 + - [ringboard](https://github.com/SUPERCILEX/clipboard-history), a fast, efficient, and composable clipboard manager for Linux. Available for x11 as [services.ringboard](#opt-services.ringboard.x11.enable) and for wayland as [services.ringboard](#opt-services.ringboard.wayland.enable). 146 + 145 147 ## Backward Incompatibilities {#sec-release-25.11-incompatibilities} 146 148 147 149 <!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
+1
nixos/modules/module-list.nix
··· 915 915 ./services/misc/redlib.nix 916 916 ./services/misc/redmine.nix 917 917 ./services/misc/renovate.nix 918 + ./services/misc/ringboard.nix 918 919 ./services/misc/rkvm.nix 919 920 ./services/misc/rmfakecloud.nix 920 921 ./services/misc/rshim.nix
+78
nixos/modules/services/misc/ringboard.nix
··· 1 + { 2 + config, 3 + lib, 4 + pkgs, 5 + ... 6 + }: 7 + let 8 + cfg = config.services.ringboard; 9 + in 10 + { 11 + options.services.ringboard = { 12 + x11.enable = lib.mkEnableOption "X11 support for Ringboard"; 13 + wayland.enable = lib.mkEnableOption "Wayland support for Ringboard"; 14 + x11.package = lib.mkPackageOption pkgs "ringboard" { }; 15 + wayland.package = lib.mkPackageOption pkgs "ringboard-wayland" { }; 16 + }; 17 + 18 + config = lib.mkIf (cfg.x11.enable || cfg.wayland.enable) { 19 + systemd.user.services.ringboard-server = { 20 + description = "Ringboard server"; 21 + documentation = [ "https://github.com/SUPERCILEX/clipboard-history" ]; 22 + after = [ "multi-user.target" ]; 23 + wantedBy = [ "multi-user.target" ]; 24 + serviceConfig = { 25 + Type = "notify"; 26 + Environment = "RUST_LOG=trace"; 27 + ExecStart = "${ 28 + if cfg.x11.enable then cfg.x11.package else cfg.wayland.package 29 + }/bin/ringboard-server"; 30 + Restart = "on-failure"; 31 + Slice = "session-ringboard.slice"; 32 + }; 33 + }; 34 + 35 + systemd.user.services.ringboard-listener = { 36 + description = "Ringboard clipboard listener"; 37 + documentation = [ "https://github.com/SUPERCILEX/clipboard-history" ]; 38 + requires = [ "ringboard-server.service" ]; 39 + after = [ 40 + "ringboard-server.service" 41 + "graphical-session.target" 42 + ]; 43 + bindsTo = [ "graphical-session.target" ]; 44 + wantedBy = [ "graphical-session.target" ]; 45 + script = 46 + if cfg.x11.enable && cfg.wayland.enable then 47 + '' 48 + if [ "$XDG_SESSION_TYPE" = "wayland" ]; then 49 + exec '${cfg.wayland.package}'/bin/ringboard-wayland 50 + else 51 + exec '${cfg.x11.package}'/bin/ringboard-x11 52 + fi 53 + '' 54 + else if cfg.wayland.enable then 55 + '' 56 + exec '${cfg.wayland.package}'/bin/ringboard-wayland 57 + '' 58 + else 59 + '' 60 + exec '${cfg.x11.package}'/bin/ringboard-x11 61 + ''; 62 + serviceConfig = { 63 + Type = "exec"; 64 + Restart = "on-failure"; 65 + Slice = "session-ringboard.slice"; 66 + }; 67 + environment.RUST_LOG = "trace"; 68 + }; 69 + 70 + systemd.user.slices.session-ringboard = { 71 + description = "Ringboard clipboard services"; 72 + }; 73 + 74 + environment.systemPackages = 75 + lib.optionals cfg.x11.enable [ cfg.x11.package ] 76 + ++ lib.optionals cfg.wayland.enable [ cfg.wayland.package ]; 77 + }; 78 + }