From 486ba3de4ecca3ef8371c20b0c53866d61e97dbd Mon Sep 17 00:00:00 2001 From: Damien Cassou Date: Mon, 27 Feb 2023 12:10:00 +0100 Subject: [PATCH] copyq: add module --- .github/CODEOWNERS | 2 ++ modules/misc/news.nix | 8 ++++++ modules/modules.nix | 1 + modules/services/copyq.nix | 54 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 modules/services/copyq.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 0f1b4a66e..d548a07be 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -390,6 +390,8 @@ Makefile @thiagokokada /modules/services/clipmenu.nix @DamienCassou +/modules/services/copyq.nix @DamienCassou + /modules/services/devilspie2.nix @dawidsowa /tests/modules/services/devilspie2 @dawidsowa diff --git a/modules/misc/news.nix b/modules/misc/news.nix index c7d536e95..0c8496a9b 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -956,6 +956,14 @@ in A new module is available: 'services.listenbrainz-mpd'. ''; } + + { + time = "2023-03-22T07:31:38+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.copyq'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 74cf7c9dc..08b15699e 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -215,6 +215,7 @@ let ./services/cbatticon.nix ./services/clipman.nix ./services/clipmenu.nix + ./services/copyq.nix ./services/devilspie2.nix ./services/dropbox.nix ./services/dunst.nix diff --git a/modules/services/copyq.nix b/modules/services/copyq.nix new file mode 100644 index 000000000..3ce4adec2 --- /dev/null +++ b/modules/services/copyq.nix @@ -0,0 +1,54 @@ +{ config, lib, pkgs, ... }: + +let + + cfg = config.services.copyq; + +in { + meta.maintainers = [ lib.maintainers.DamienCassou ]; + + options.services.copyq = { + enable = + lib.mkEnableOption "CopyQ, a clipboard manager with advanced features"; + + package = lib.mkPackageOption pkgs "copyq" { }; + + systemdTarget = lib.mkOption { + type = lib.types.str; + default = "graphical-session.target"; + example = "sway-session.target"; + description = '' + The systemd target that will automatically start the Waybar service. + + + When setting this value to "sway-session.target", + make sure to also enable , + otherwise the service may never be started. + ''; + }; + }; + + config = lib.mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "services.copyq" pkgs + lib.platforms.linux) + ]; + + home.packages = [ cfg.package ]; + + systemd.user.services.copyq = { + Unit = { + Description = "CopyQ clipboard management daemon"; + PartOf = [ "graphical-session.target" ]; + After = [ "graphical-session.target" ]; + }; + + Service = { + ExecStart = "${cfg.package}/bin/copyq"; + Restart = "on-failure"; + }; + + Install = { WantedBy = [ cfg.systemdTarget ]; }; + }; + }; +}