parcellite: make package configurable

This commit is contained in:
Nick Hu 2020-10-13 17:08:08 +01:00 committed by Robert Helgesson
parent 5125fc0a47
commit 61e63c10dc
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -5,17 +5,24 @@ with lib;
let
cfg = config.services.parcellite;
package = pkgs.parcellite;
in {
meta.maintainers = [ maintainers.gleber ];
options = {
services.parcellite = { enable = mkEnableOption "Parcellite"; };
options.services.parcellite = {
enable = mkEnableOption "Parcellite";
package = mkOption {
type = types.package;
default = pkgs.parcellite;
defaultText = literalExample "pkgs.parcellite";
example = literalExample "pkgs.clipit";
description = "Parcellite derivation to use.";
};
};
config = mkIf cfg.enable {
home.packages = [ package ];
home.packages = [ cfg.package ];
systemd.user.services.parcellite = {
Unit = {
@ -27,7 +34,7 @@ in {
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart = "${package}/bin/parcellite";
ExecStart = "${cfg.package}/bin/${cfg.package.pname}";
Restart = "on-abort";
};
};