1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-15 17:50:53 +00:00

conky: add module

This commit is contained in:
Kaleo 2023-12-27 20:00:49 +08:00 committed by Robert Helgesson
parent 28ef93bb8e
commit 6d3b6dc922
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
7 changed files with 105 additions and 0 deletions

View file

@ -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.
'';
}
];
};
}

View file

@ -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

View 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" ];
};
};
}

View file

@ -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

View 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
]]

View 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}
'';
}

View file

@ -0,0 +1 @@
{ conky-basic-configuration = ./basic-configuration.nix; }