From aa1bf31bcbf44ae4722c4514210bdfa8273e4497 Mon Sep 17 00:00:00 2001 From: Gleb Peregud Date: Tue, 5 Dec 2017 23:23:31 +0100 Subject: [PATCH] parcellite: add module This adds a Parcellite service. It has no configuration options, since the app has its own mutable preferences dialog, which unconditionally replaces `~/.config/parcellite/parcelliterc` when preferences are saved. --- modules/misc/news.nix | 7 +++++ modules/modules.nix | 1 + modules/services/parcellite.nix | 47 +++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 modules/services/parcellite.nix diff --git a/modules/misc/news.nix b/modules/misc/news.nix index c44918bd3..95c94578f 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -503,6 +503,13 @@ in 'services.kbfs' and 'services.keybase' ''; } + + { + time = "2017-12-07T22:23:11+00:00"; + message = '' + A new module is available: 'services.parcellite' + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index d9b05f54e..074966cb9 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -51,6 +51,7 @@ let ./services/keybase.nix ./services/network-manager-applet.nix ./services/owncloud-client.nix + ./services/parcellite.nix ./services/polybar.nix ./services/random-background.nix ./services/redshift.nix diff --git a/modules/services/parcellite.nix b/modules/services/parcellite.nix new file mode 100644 index 000000000..455989ffe --- /dev/null +++ b/modules/services/parcellite.nix @@ -0,0 +1,47 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.parcellite; + package = pkgs.parcellite; + +in + +{ + meta.maintainers = [ maintainers.gleber ]; + + options = { + services.parcellite = { + enable = mkEnableOption "Parcellite"; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ package ]; + + systemd.user.services.parcellite = { + Unit = { + Description = "Lightweight GTK+ clipboard manager"; + After = [ "graphical-session-pre.target" ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + + Service = { + # PATH have been added in nixpkgs.parcellite, keeping it here for + # backward compatibility. XDG_DATA_DIRS is necessary to make it pick up + # icons correctly. + Environment = '' + PATH=${package}/bin:${pkgs.which}/bin:${pkgs.xdotool}/bin XDG_DATA_DIRS=${pkgs.hicolor_icon_theme}/share + ''; + ExecStart = "${package}/bin/parcellite"; + Restart = "on-abort"; + }; + }; + }; +}