nixos-config/system/desktop/wtf.nix

209 lines
4.9 KiB
Nix
Raw Normal View History

2020-01-06 14:36:38 +01:00
{ pkgs, lib, config, ... }:
let
unstable = import <nixpkgs-unstable> { };
activeTasks = pkgs.writers.writeBash "active-tasks" ''
${pkgs.taskwarrior}/bin/task export +checklist status:pending +READY | \
${pkgs.jq}/bin/jq \
--raw-output '
sort_by(.description) | reverse |
.[] |
"[ \( .id ) ] \( .description )"
'
echo
${pkgs.taskwarrior}/bin/task export \
+ACTIVE status:pending \
| ${pkgs.jq}/bin/jq --raw-output '.[] | " \(.id) \(.description)"'
'';
userHighlight = map ({ user, ... }: user)
(builtins.attrValues config.programs.custom.browser.configList);
activeUsers = pkgs.writers.writeBash "active-users" ''
${pkgs.procps}/bin/ps -eo user \
| ${pkgs.gnused}/bin/sed '1 d' \
| ${pkgs.coreutils}/bin/sort \
| ${pkgs.coreutils}/bin/uniq \
| ${pkgs.gnugrep}/bin/egrep --color=always '(${
pkgs.lib.concatStringsSep "|" userHighlight
})|$'
'';
qJson = {
wtf = {
term = "rxvt-unicode-256color";
colors.border = {
focusable = "darkslateblue";
focused = "orange";
normal = "green";
};
grid = {
columns = [ 33 40 36 0 ];
rows = [ 9 3 7 6 0 ];
};
refreshInterval = 1;
mods = {
digitalclock = {
title = "";
type = "digitalclock";
enabled = true;
color = "white";
font = "bigfont";
hourFormat = 24;
refreshInterval = 1;
position.top = 0;
position.left = 0;
position.height = 1;
position.width = 1;
};
clocks = {
title = "";
type = "clocks";
enabled = true;
border = false;
colors.rows = {
even = "white";
odd = "white";
};
locations = {
Berlin = "Europe/Berlin";
Wellington = "Pacific/Auckland";
};
sort = "alphabetical";
position.top = 1;
position.left = 0;
position.height = 1;
position.width = 1;
refreshInterval = 60;
};
resourceusage = {
title = "";
cpuCombined = false;
enabled = true;
position.top = 0;
position.left = 1;
position.height = 1;
position.width = 1;
refreshInterval = 5;
};
power = {
enabled = true;
position.top = 2;
position.left = 0;
position.height = 1;
position.width = 1;
refreshInterval = 100;
title = "Power";
};
rates = {
type = "exchangerates";
title = "rates";
enabled = true;
focusable = false;
position.top = 3;
position.left = 0;
position.height = 1;
position.width = 1;
rates.NZD = [ "EUR" ];
rates.EUR = [ "NZD" ];
};
prettyweather = {
enabled = true;
title = "";
city = "Wellington";
position.top = 0;
position.left = 2;
position.height = 1;
position.width = 1;
unit = "m";
view = 0;
language = "en";
refreshInterval = 3600;
};
calendar = {
type = "cmdrunner";
title = "";
focusable = false;
args = [ "-3" "--monday" "--color=never" "-w" ];
cmd = "cal";
enabled = true;
position.top = 1;
position.left = 1;
position.height = 2;
position.width = 2;
refreshInterval = 3600;
};
uptime = {
type = "cmdrunner";
title = "uptime";
focusable = false;
cmd = "uptime";
enabled = true;
position.top = 3;
position.left = 1;
position.height = 1;
position.width = 2;
2020-01-06 14:51:12 +01:00
refreshInterval = 300;
2020-01-06 14:36:38 +01:00
};
active-users = {
type = "cmdrunner";
title = "users";
focusable = false;
cmd = activeUsers;
enabled = true;
position.top = 0;
position.left = 3;
position.height = 4;
position.width = 1;
2020-01-06 14:51:12 +01:00
refreshInterval = 30;
2020-01-06 14:36:38 +01:00
};
active-tasks = {
type = "cmdrunner";
title = "active tasks";
focusable = false;
cmd = activeTasks;
enabled = true;
position.top = 4;
position.left = 0;
position.height = 1;
position.width = 4;
2020-01-06 14:51:12 +01:00
refreshInterval = 60;
2020-01-06 14:36:38 +01:00
};
};
};
};
qConfig = pkgs.writeText "config.yml" (builtins.toJSON qJson);
q = pkgs.writers.writeBashBin "q" ''
${unstable.wtf}/bin/wtfutil --config=${toString qConfig}
'';
in {
services.upower.enable = true;
environment.systemPackages = [
unstable.wtf
q
#activeUsers
#activeTasks
pkgs.upower
];
}