mirror of
https://github.com/nix-community/home-manager.git
synced 2024-12-14 11:57:55 +00:00
clipse: add module
This commit is contained in:
parent
c2cd2a52e0
commit
c086351fc0
6 changed files with 135 additions and 0 deletions
|
@ -101,6 +101,12 @@
|
||||||
github = "diniamo";
|
github = "diniamo";
|
||||||
githubId = 55629891;
|
githubId = 55629891;
|
||||||
};
|
};
|
||||||
|
dsoverlord = {
|
||||||
|
name = "Kirill Zakharov";
|
||||||
|
email = "dsoverlord@vk.com";
|
||||||
|
github = "dsoverlord";
|
||||||
|
githubId = 78819443;
|
||||||
|
};
|
||||||
dwagenk = {
|
dwagenk = {
|
||||||
email = "dwagenk@mailbox.org";
|
email = "dwagenk@mailbox.org";
|
||||||
github = "dwagenk";
|
github = "dwagenk";
|
||||||
|
|
|
@ -283,6 +283,7 @@ let
|
||||||
./services/cliphist.nix
|
./services/cliphist.nix
|
||||||
./services/clipman.nix
|
./services/clipman.nix
|
||||||
./services/clipmenu.nix
|
./services/clipmenu.nix
|
||||||
|
./services/clipse.nix
|
||||||
./services/comodoro.nix
|
./services/comodoro.nix
|
||||||
./services/conky.nix
|
./services/conky.nix
|
||||||
./services/copyq.nix
|
./services/copyq.nix
|
||||||
|
|
109
modules/services/clipse.nix
Normal file
109
modules/services/clipse.nix
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
{ pkgs, config, lib, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.services.clipse;
|
||||||
|
jsonFormat = pkgs.formats.json { };
|
||||||
|
|
||||||
|
in with lib;
|
||||||
|
|
||||||
|
{
|
||||||
|
meta.maintainers = [ lib.maintainers.dsoverlord ];
|
||||||
|
|
||||||
|
options.services.clipse = {
|
||||||
|
enable = mkEnableOption "Enable clipse clipboard manager";
|
||||||
|
|
||||||
|
package = mkPackageOption pkgs "clipse" { };
|
||||||
|
|
||||||
|
systemdTarget = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "graphical-session.target";
|
||||||
|
example = "sway-session.target";
|
||||||
|
description = ''
|
||||||
|
The systemd target that will automatically start the clipse service.
|
||||||
|
|
||||||
|
When setting this value to `"sway-session.target"`,
|
||||||
|
make sure to also enable {option}`wayland.windowManager.sway.systemd.enable`,
|
||||||
|
otherwise the service may never be started.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
allowDuplicates = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Allow duplicates";
|
||||||
|
};
|
||||||
|
|
||||||
|
historySize = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 100;
|
||||||
|
description = "Number of history lines to keep.";
|
||||||
|
};
|
||||||
|
|
||||||
|
theme = mkOption {
|
||||||
|
type = jsonFormat.type;
|
||||||
|
|
||||||
|
default = { useCustomTheme = false; };
|
||||||
|
|
||||||
|
example = literalExpression ''
|
||||||
|
{
|
||||||
|
useCustomTheme = true;
|
||||||
|
DimmedDesc = "#ffffff";
|
||||||
|
DimmedTitle = "#ffffff";
|
||||||
|
FilteredMatch = "#ffffff";
|
||||||
|
NormalDesc = "#ffffff";
|
||||||
|
NormalTitle = "#ffffff";
|
||||||
|
SelectedDesc = "#ffffff";
|
||||||
|
SelectedTitle = "#ffffff";
|
||||||
|
SelectedBorder = "#ffffff";
|
||||||
|
SelectedDescBorder = "#ffffff";
|
||||||
|
TitleFore = "#ffffff";
|
||||||
|
Titleback = "#434C5E";
|
||||||
|
StatusMsg = "#ffffff";
|
||||||
|
PinIndicatorColor = "#ff0000";
|
||||||
|
};
|
||||||
|
'';
|
||||||
|
|
||||||
|
description = ''
|
||||||
|
Configuration written to
|
||||||
|
{file}`$XDG_CONFIG_HOME/clipse/custom_theme.json`.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
assertions = [
|
||||||
|
(lib.hm.assertions.assertPlatform "services.clipse" pkgs
|
||||||
|
lib.platforms.linux)
|
||||||
|
];
|
||||||
|
|
||||||
|
home.packages = [ cfg.package ];
|
||||||
|
|
||||||
|
xdg.configFile."clipse/config.json".source =
|
||||||
|
jsonFormat.generate "settings" {
|
||||||
|
allowDuplicates = cfg.allowDuplicates;
|
||||||
|
historyFile = "clipboard_history.json";
|
||||||
|
maxHistory = cfg.historySize;
|
||||||
|
logFile = "clipse.log";
|
||||||
|
themeFile = "custom_theme.json";
|
||||||
|
tempDir = "tmp_files";
|
||||||
|
};
|
||||||
|
|
||||||
|
xdg.configFile."clipse/custom_theme.json".source =
|
||||||
|
jsonFormat.generate "theme" cfg.theme;
|
||||||
|
|
||||||
|
systemd.user.services.clipse = {
|
||||||
|
Unit = {
|
||||||
|
Description = "Clipse listener";
|
||||||
|
PartOf = [ "graphical-session.target" ];
|
||||||
|
After = [ "graphical-session.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
Service = {
|
||||||
|
Type = "oneshot";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
ExecStart = "${cfg.package}/bin/clipse -listen";
|
||||||
|
};
|
||||||
|
|
||||||
|
Install = { WantedBy = [ cfg.systemdTarget ]; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -229,6 +229,7 @@ in import nmtSrc {
|
||||||
./modules/services/cachix-agent
|
./modules/services/cachix-agent
|
||||||
./modules/services/cliphist
|
./modules/services/cliphist
|
||||||
./modules/services/clipman
|
./modules/services/clipman
|
||||||
|
./modules/services/clipse
|
||||||
./modules/services/comodoro
|
./modules/services/comodoro
|
||||||
./modules/services/conky
|
./modules/services/conky
|
||||||
./modules/services/darkman
|
./modules/services/darkman
|
||||||
|
|
17
tests/modules/services/clipse/clipse-sway-session-target.nix
Normal file
17
tests/modules/services/clipse/clipse-sway-session-target.nix
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
services.clipse = {
|
||||||
|
enable = true;
|
||||||
|
systemdTarget = "sway-session.target";
|
||||||
|
};
|
||||||
|
|
||||||
|
test.stubs = {
|
||||||
|
clipse = { };
|
||||||
|
wl-clipboard = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists home-files/.config/systemd/user/clipse.service
|
||||||
|
'';
|
||||||
|
}
|
1
tests/modules/services/clipse/default.nix
Normal file
1
tests/modules/services/clipse/default.nix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{ clipse-sway-session-target = ./clipse-sway-session-target.nix; }
|
Loading…
Reference in a new issue