From 43ef16c3e169607743ecbfffb3284e375a4df845 Mon Sep 17 00:00:00 2001 From: Damien Cassou Date: Sun, 7 Jun 2020 19:59:50 +0200 Subject: [PATCH] clipmenu: add module PR #1309 --- .github/CODEOWNERS | 2 ++ modules/misc/news.nix | 8 +++++++ modules/modules.nix | 1 + modules/services/clipmenu.nix | 43 +++++++++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+) create mode 100644 modules/services/clipmenu.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d1d423edc..d13da75c0 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -101,6 +101,8 @@ /modules/services/cbatticon.nix @pmiddend +/modules/services/clipmenu.nix @DamienCassou + /modules/services/dunst.nix @rycee /modules/services/emacs.nix @tadfisher diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 5fd0b8b92..819afdd45 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -1552,6 +1552,14 @@ in It can be enabled through the option 'services.emacs.socketActivation.enable'. ''; } + + { + time = "2020-06-12T17:48:01+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.clipmenu' + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 1f4deefee..c89f4d50a 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -120,6 +120,7 @@ let (loadModule ./programs/zsh.nix { }) (loadModule ./services/blueman-applet.nix { }) (loadModule ./services/cbatticon.nix { condition = hostPlatform.isLinux; }) + (loadModule ./services/clipmenu.nix { condition = hostPlatform.isLinux; }) (loadModule ./services/compton.nix { }) (loadModule ./services/dunst.nix { }) (loadModule ./services/dwm-status.nix { condition = hostPlatform.isLinux; }) diff --git a/modules/services/clipmenu.nix b/modules/services/clipmenu.nix new file mode 100644 index 000000000..2e1c10e43 --- /dev/null +++ b/modules/services/clipmenu.nix @@ -0,0 +1,43 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.clipmenu; + +in { + meta.maintainers = [ maintainers.DamienCassou ]; + + options.services.clipmenu = { + enable = mkEnableOption "clipmenu, the clipboard management daemon"; + + package = mkOption { + type = types.package; + default = pkgs.clipmenu; + defaultText = "pkgs.clipmenu"; + description = "clipmenu derivation to use."; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + systemd.user.services.clipmenu = { + Unit = { + Description = "Clipboard management daemon"; + After = [ "graphical-session.target" ]; + }; + + Service = { + ExecStart = "${cfg.package}/bin/clipmenud"; + Environment = "PATH=${ + makeBinPath + (with pkgs; [ coreutils findutils gnugrep gnused systemd ]) + }"; + }; + + Install = { WantedBy = [ "graphical-session.target" ]; }; + }; + }; +}