mirror of
https://github.com/nix-community/home-manager
synced 2024-11-18 00:59:44 +01:00
conky: add module
This commit is contained in:
parent
28ef93bb8e
commit
6d3b6dc922
7 changed files with 105 additions and 0 deletions
|
@ -1572,6 +1572,18 @@ in {
|
|||
your habits being tracked. See https://freetubeapp.io/ for more.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2024-04-30T21:57:23+00:00";
|
||||
condition = hostPlatform.isLinux;
|
||||
message = ''
|
||||
A new module is available: 'services.conky'.
|
||||
|
||||
Conky is a system monitor for X. Conky can display just about
|
||||
anything, either on your root desktop or in its own window. See
|
||||
https://conky.cc/ for more.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -279,6 +279,7 @@ let
|
|||
./services/clipman.nix
|
||||
./services/clipmenu.nix
|
||||
./services/comodoro.nix
|
||||
./services/conky.nix
|
||||
./services/copyq.nix
|
||||
./services/darkman.nix
|
||||
./services/devilspie2.nix
|
||||
|
|
53
modules/services/conky.nix
Normal file
53
modules/services/conky.nix
Normal file
|
@ -0,0 +1,53 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
cfg = config.services.conky;
|
||||
|
||||
in with lib; {
|
||||
meta.maintainers = [ hm.maintainers.kaleo ];
|
||||
|
||||
options = {
|
||||
services.conky = {
|
||||
enable = mkEnableOption "Conky, a light-weight system monitor";
|
||||
|
||||
package = mkPackageOption pkgs "conky" { };
|
||||
|
||||
extraConfig = lib.mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Configuration used by the Conky daemon. Check
|
||||
<https://github.com/brndnmtthws/conky/wiki/Configurations> for
|
||||
options. If not set, the default configuration, as described by
|
||||
{command}`conky --print-config`, will be used.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions =
|
||||
[ (hm.assertions.assertPlatform "services.conky" pkgs platforms.linux) ];
|
||||
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
systemd.user.services.conky = {
|
||||
Unit = {
|
||||
Description = "Conky - Lightweight system monitor";
|
||||
After = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
Restart = "always";
|
||||
RestartSec = "3";
|
||||
ExecStart = toString ([ "${pkgs.conky}/bin/conky" ]
|
||||
++ optional (cfg.extraConfig != "")
|
||||
"--config ${pkgs.writeText "conky.conf" cfg.extraConfig}");
|
||||
};
|
||||
|
||||
Install.WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -225,6 +225,7 @@ in import nmtSrc {
|
|||
./modules/services/cliphist
|
||||
./modules/services/clipman
|
||||
./modules/services/comodoro
|
||||
./modules/services/conky
|
||||
./modules/services/darkman
|
||||
./modules/services/devilspie2
|
||||
./modules/services/dropbox
|
||||
|
|
7
tests/modules/services/conky/basic-configuration.conf
Normal file
7
tests/modules/services/conky/basic-configuration.conf
Normal file
|
@ -0,0 +1,7 @@
|
|||
conky.text = [[
|
||||
S Y S T E M I N F O
|
||||
$hr
|
||||
Host:$alignr $nodename
|
||||
Uptime:$alignr $uptime
|
||||
RAM:$alignr $mem/$memmax
|
||||
]]
|
30
tests/modules/services/conky/basic-configuration.nix
Normal file
30
tests/modules/services/conky/basic-configuration.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
services.conky = {
|
||||
enable = true;
|
||||
extraConfig = ''
|
||||
conky.text = [[
|
||||
S Y S T E M I N F O
|
||||
$hr
|
||||
Host:$alignr $nodename
|
||||
Uptime:$alignr $uptime
|
||||
RAM:$alignr $mem/$memmax
|
||||
]]
|
||||
'';
|
||||
};
|
||||
|
||||
test.stubs.conky = { };
|
||||
|
||||
nmt.script = ''
|
||||
serviceFile="$TESTED/home-files/.config/systemd/user/conky.service"
|
||||
|
||||
assertFileExists $serviceFile
|
||||
assertFileRegex "$serviceFile" \
|
||||
'ExecStart=@conky@/bin/conky --config .*conky.conf'
|
||||
|
||||
configFile="$(grep -o '/nix.*conky.conf' "$serviceFile")"
|
||||
assertFileContent "$configFile" \
|
||||
${./basic-configuration.conf}
|
||||
'';
|
||||
}
|
1
tests/modules/services/conky/default.nix
Normal file
1
tests/modules/services/conky/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{ conky-basic-configuration = ./basic-configuration.nix; }
|
Loading…
Reference in a new issue