1
0
mirror of https://github.com/kmein/niveum synced 2026-03-28 23:31:07 +01:00

15 Commits

Author SHA1 Message Date
github-actions[bot]
dbdc876375 flake.lock: Update
Flake lock file updates:

• Updated input 'home-manager':
    'github:nix-community/home-manager/0160a0cef076294127f8cc0750019410ab94370d' (2022-08-22)
  → 'github:nix-community/home-manager/d89bdff445eadff03fe414e9c30486bc8166b72b' (2022-08-27)
• Updated input 'nixos-stable':
    'github:NixOS/nixpkgs/52527082ea267fe486f0648582d57c85486b2031' (2022-08-22)
  → 'github:NixOS/nixpkgs/f11e12ac6af528c1ba12426ce83cee26f21ceafd' (2022-08-26)
• Updated input 'nixos-unstable':
    'github:NixOS/nixpkgs/c4a0efdd5a728e20791b8d8d2f26f90ac228ee8d' (2022-08-12)
  → 'github:NixOS/nixpkgs/f3d0897be466aa09a37f6bf59e62c360c3f9a6cc' (2022-08-25)
2022-08-28 01:01:59 +00:00
eb79f88c59 feat(i3status-rust): show number of hot weechat buffers 2022-08-23 21:44:39 +02:00
8384363dcb fix: downgrade nixpkgs unstable
coreutils gets built manually and electrum fails otherwise
2022-08-23 20:27:41 +02:00
797e53db7a feat: nom nom nom 2022-08-23 19:02:34 +02:00
426a82dff9 chore: update 2022-08-23 15:02:55 +02:00
7264fce03c feat(telegram-bots): add smyth 2022-08-23 14:47:24 +02:00
b332784140 fix(ci): add shared secret 2022-08-22 10:36:32 +02:00
ed51858a67 feat(i3status-rust): time interval 1s 2022-08-22 10:30:29 +02:00
ba13cd24a1 feat(fonts): noto sans cjk 2022-08-22 10:30:15 +02:00
8331d11a50 feat(i3status-rust): make email state depend on which account the unseen messages are 2022-08-22 10:30:02 +02:00
79e14bfbc2 feat(i3status-rust): todo empty if none due 2022-08-22 10:29:04 +02:00
eed0d0b2af feat(i3status-rust): add github block 2022-08-22 10:28:48 +02:00
5930340a05 feat(i3status-rust): hide todo and vpn when empty 2022-08-22 10:28:06 +02:00
a5f6a46262 feat(neomutt): set dark/light friendly subject colour 2022-08-22 10:27:33 +02:00
4eea890efc fix(i3-status-rust): newsboat updating icon 2022-08-21 10:09:19 +02:00
13 changed files with 153 additions and 40 deletions

1
ci.nix
View File

@@ -37,6 +37,7 @@
"di.fm/key"
"eduroam/identity"
"eduroam/password"
"github/notification.token"
"hass/token"
"mail/cock"
"mail/fastmail"

View File

@@ -31,6 +31,7 @@
roboto
roboto-mono
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
roboto-slab
scheherazade-new
@@ -46,7 +47,7 @@
fontconfig.defaultFonts = {
monospace = ["Noto Sans Mono"];
serif = ["Noto Serif" "Noto Naskh Arabic" "Noto Serif Devanagari"];
sansSerif = ["Noto Sans Display" "Noto Kufi Arabic" "Noto Sans Devanagari"];
sansSerif = ["Noto Sans Display" "Noto Kufi Arabic" "Noto Sans Devanagari" "Noto Sans CJK JP"];
emoji = ["Noto Color Emoji" "Noto Emoji"];
};
};

View File

@@ -167,7 +167,7 @@ in {
text = colours.foreground;
};
};
statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ${
statusCommand = "env I3RS_GITHUB_TOKEN=${lib.strings.fileContents <secrets/github/notification.token>} ${pkgs.i3status-rust}/bin/i3status-rs ${
(pkgs.formats.toml {}).generate "i3status-rust.toml" (import <niveum/lib/i3status-rust.nix> {
inherit (config.niveum) batteryName wirelessInterface;
inherit colours;

View File

@@ -115,7 +115,7 @@ in {
color index red default '.*'
color index_flags lightcyan default '.*'
color index_author yellow default '.*'
color index_subject white default '.*'
color index_subject default default '.*'
# New mail is boldened:
color index_author lightyellow default "~N"

View File

@@ -75,7 +75,7 @@ in {
pkgs.newsboat
(pkgs.writers.writeDashBin "newsboat-unread-count" ''
if [ -f ${newsboat-home}/cache.db.lock ]; then
${pkgs.jq}/bin/jq -n '{state: "Info", text: "", icon: "update"}'
${pkgs.jq}/bin/jq -n '{state: "Info", text: "", icon: "rss"}'
else
${pkgs.jq}/bin/jq -n \

View File

@@ -19,6 +19,7 @@ in {
./astrology.nix
./autorenkalender.nix
./hesychius.nix
./smyth.nix
./nachtischsatan.nix
./tlg-wotd.nix
<niveum/modules/telegram-bot.nix>

View File

@@ -0,0 +1,35 @@
{
pkgs,
lib,
...
}: {
niveum.telegramBots.smyth = {
enable = true;
time = "08/6:00";
token = lib.strings.fileContents <system-secrets/telegram/kmein.token>;
chatIds = ["@HerbertWeirSmyth"];
command = toString (pkgs.writers.writeDash "random-smyth" ''
set -efu
RANDOM_SECTION=$(
${pkgs.curl}/bin/curl -sSL http://www.perseus.tufts.edu/hopper/xmltoc?doc=Perseus%3Atext%3A1999.04.0007%3Asmythp%3D1 \
| ${pkgs.gnugrep}/bin/grep -o 'ref="[^"]*"' \
| ${pkgs.coreutils}/bin/shuf -n1 \
| ${pkgs.gnused}/bin/sed 's/^ref="//;s/"$//'
)
${pkgs.curl}/bin/curl -sSL http://www.perseus.tufts.edu/hopper/text?doc=$RANDOM_SECTION\
| ${pkgs.htmlq}/bin/htmlq '#text_main' \
| ${pkgs.gnused}/bin/sed 's/<\/\?hr>//g' \
| ${pkgs.pandoc}/bin/pandoc -f html -t plain --wrap=none
'');
};
niveum.passport.services = [
{
title = "Herbert Weir Smyth Bot";
description = "sends a random section from Smyth's Ancient Greek grammar to Telegram.";
link = "https://t.me/HerbertWeirSmyth";
}
];
}

42
flake.lock generated
View File

@@ -23,11 +23,11 @@
"utils": "utils"
},
"locked": {
"lastModified": 1660330190,
"narHash": "sha256-RgQUtZGmdb9fRkdBcI8x1KYuykbQCBaeY6ejFls7hFM=",
"lastModified": 1661573386,
"narHash": "sha256-pBEg8iY00Af/SAtU2dlmOAv+2x7kScaGlFRDjNoVJO8=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "8675cfa549e1240c9d2abb1c878bc427eefcf926",
"rev": "d89bdff445eadff03fe414e9c30486bc8166b72b",
"type": "github"
},
"original": {
@@ -47,15 +47,15 @@
]
},
"locked": {
"lastModified": 1644957911,
"narHash": "sha256-ggie/j7pdBqzDs4W7OiPmhqH9IGbXAbJxGqBdVxA8jA=",
"owner": "Mic92",
"lastModified": 1661273257,
"narHash": "sha256-cywpSH3D291AwdO/ecJxHeN2Vuuz0cIy/NEXMsFT+Og=",
"owner": "kmein",
"repo": "krops",
"rev": "86fb3d2ee94fd8306231853b323ed8804edf26ec",
"rev": "542bc544ec8b0b807933a812d098e601683b0956",
"type": "github"
},
"original": {
"owner": "Mic92",
"owner": "kmein",
"repo": "krops",
"type": "github"
}
@@ -110,11 +110,11 @@
},
"nixos-stable": {
"locked": {
"lastModified": 1660318005,
"narHash": "sha256-g9WCa9lVUmOV6dYRbEPjv/TLOR5hamjeCcKExVGS3OQ=",
"lastModified": 1661520432,
"narHash": "sha256-9z+WDeXiu3hobvSsL0SbHDx4s+kFmm8eussySuX4zCM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5c211b47aeadcc178c5320afd4e74c7eed5c389f",
"rev": "f11e12ac6af528c1ba12426ce83cee26f21ceafd",
"type": "github"
},
"original": {
@@ -126,11 +126,11 @@
},
"nixos-unstable": {
"locked": {
"lastModified": 1660305968,
"narHash": "sha256-r0X1pZCSEA6mzt5OuTA7nHuLmvnbkwgpFAh1iLIx4GU=",
"lastModified": 1661450036,
"narHash": "sha256-0/9UyJLtfWqF4uvOrjFIzk8ue1YYUHa6JIhV0mALkH0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c4a0efdd5a728e20791b8d8d2f26f90ac228ee8d",
"rev": "f3d0897be466aa09a37f6bf59e62c360c3f9a6cc",
"type": "github"
},
"original": {
@@ -195,11 +195,11 @@
"scripts": {
"flake": false,
"locked": {
"lastModified": 1658436738,
"narHash": "sha256-y075C4CE543ZdKPl1Byz8EPn67jbA59Z0bIsixNFsso=",
"lastModified": 1660677220,
"narHash": "sha256-cCmyI4CigWbeQ0wEiE9HSI2Hmd3Wi5P7jhdHX6bJkXU=",
"owner": "kmein",
"repo": "scripts",
"rev": "d5a38cf84e3f528641b1b10d9f33cf8bfcd5a52a",
"rev": "688e141047e831a7e5f58dd24e00de51a3cb2345",
"type": "github"
},
"original": {
@@ -211,11 +211,11 @@
"stockholm": {
"flake": false,
"locked": {
"lastModified": 1660135264,
"narHash": "sha256-F2L0osJCjmqkXddDVSBdBanq06XUBQoKXPf4iRJUKYA=",
"lastModified": 1661246925,
"narHash": "sha256-hGNCF4m3SuVogqoipmJzNIKoh03S/SMnO5oMHgfHWjA=",
"ref": "refs/heads/master",
"rev": "7ce87f5fdb602de7638b2df237e891e6038907ac",
"revCount": 10727,
"rev": "d1fa957ed5bf60767c83c96135f9142f6c96ea50",
"revCount": 10749,
"type": "git",
"url": "https://cgit.lassul.us/stockholm"
},

View File

@@ -11,7 +11,7 @@
inputs.nixpkgs.follows = "nixos-unstable";
};
krops = {
url = "github:Mic92/krops";
url = "github:kmein/krops";
inputs.nixpkgs.follows = "nixos-stable";
inputs.flake-utils.follows = "flake-utils";
};
@@ -152,6 +152,7 @@
toString (krops.packages.${system}.writeDeploy "deploy-${name}" {
source = krops.lib.evalSource [(source {inherit sources unstable name;})];
target = "${user}@${host}:${toString sshPort}";
useNixOutputMonitor = true;
});
in {
apps.${system} = let

View File

@@ -35,6 +35,8 @@ in {
};
icons.name = "awesome6";
icons.overrides.rss = "";
icons.overrides.vpn = "";
icons.overrides.irc = "";
block = [
{
block = "weather";
@@ -70,6 +72,11 @@ in {
print("{} {} {}{}".format(sun["sunrise"].strftime("%R"), sun["sunset"].strftime("%R"), "" if current_phase < 14 else "", round(current_phase, 1)))
'';
}
{
block = "github";
info = ["total"];
warning = ["mention" "review_requested"];
}
{
block = "custom";
interval = 10;
@@ -86,7 +93,7 @@ in {
| (map(select(.due >= now and .due < now + (60 * 60 * 24))) | length) as $dueToday
| {
icon: "tasks",
text: ($overdue + $dueToday) | tostring,
text: (($overdue + $dueToday) as $sum | if $sum > 0 then $sum | tostring else "" end),
state: (
if $overdue > 0 then
"Critical"
@@ -100,27 +107,30 @@ in {
'
'';
json = true;
hide_when_empty = true;
}
{
block = "custom";
interval = 60 * 5;
command = let
query-account = account:
pkgs.writers.writeDash "query-imap" ''
query-account = name: account:
pkgs.writers.writeDash "query-imap-${name}" ''
${pkgs.curl}/bin/curl -sSL -u ${lib.escapeShellArg "${account.user}:${account.password}"} imaps://${account.imap} -X 'STATUS INBOX (UNSEEN)' \
| ${pkgs.gnugrep}/bin/grep -Eo '[0-9]+'
| ${pkgs.gnugrep}/bin/grep -Eo '[0-9]+' \
| sed 's/^/{"${name}":/;s/$/}/'
'';
in
pkgs.writers.writeDash "unread-mail" ''
{
${lib.concatMapStringsSep "\n" query-account (builtins.attrValues accounts)}
${lib.concatStringsSep "\n" (lib.mapAttrsToList query-account accounts)}
} | jq -s '
(. | add) as $sum
add
| (values | add) as $sum
| {
text: $sum | tostring,
text: (if $sum > 0 then $sum | tostring else "" end),
icon: "mail",
state: (
if $sum > 5 then
if .uni > 0 or .["work-uni"] > 0 or .posteo > 0 then
"Warning"
elif $sum > 0 then
"Info"
@@ -131,16 +141,32 @@ in {
}'
'';
json = true;
hide_when_empty = true;
}
{
block = "custom";
interval = 60;
command = pkgs.writers.writeDash "weechat" ''
ssh makanek cat /var/lib/weechat/hotlist.txt | sed 's/,/\n/g' | wc -l | jq '{
text: (if . > 0 then . | tostring else "" end),
state: (if . > 0 then "Info" else "Idle" end),
icon: "irc"
}'
'';
json = true;
hide_when_empty = true;
}
{
block = "custom";
interval = 5;
command = pkgs.writers.writeDash "hu-berlin-vpn" ''
PATH=${lib.makeBinPath [pkgs.systemd]}
(systemctl is-active --quiet openvpn-hu-berlin.service && echo "OVPN") \
|| (systemctl is-active --quiet hu-vpn.service && echo "PPP-VPN") \
|| :
(systemctl is-active --quiet openvpn-hu-berlin.service && echo '{"state": "Good", "text": "OpenVPN", "icon": "vpn"}') \
|| (systemctl is-active --quiet hu-vpn.service && echo '{"state": "Good", "text": "PPP+SSL", "icon": "vpn"}') \
|| echo '{"state": "Idle", "icon": "vpn", "text": ""}'
'';
json = true;
hide_when_empty = true;
}
{
block = "net";
@@ -168,7 +194,7 @@ in {
{block = "load";}
{
block = "custom";
interval = 10;
interval = 1;
json = true;
command = pkgs.writers.writeDash "time" ''
${pkgs.jq}/bin/jq -n \

View File

@@ -0,0 +1,33 @@
{
stdenv,
lib,
fetchurl,
weechat,
}:
stdenv.mkDerivation {
pname = "hotlist2extern";
version = "1.0";
src = fetchurl {
url = "https://raw.githubusercontent.com/weechat/scripts/dd627975cf2e464f206f8006cb3963c8ee82044c/perl/hotlist2extern.pl";
sha256 = "1flpikm1kq6m9rh3hmafni9f2yi1b90w539k3hj55a5c9gddp2lr";
};
dontUnpack = true;
installPhase = ''
mkdir -p $out/share
cp $src $out/share/hotlist2extern.pl
'';
passthru = {
scripts = ["hotlist2extern.pl"];
};
meta = with lib; {
inherit (weechat.meta) platforms;
description = "Give hotlist to an external file/program";
license = licenses.gpl3;
maintainers = with maintainers; [kmein];
};
}

View File

@@ -103,5 +103,11 @@ in {
defaults.email = kieran.email;
};
environment.systemPackages = [pkgs.vim pkgs.git pkgs.tmux pkgs.python3];
environment.systemPackages = [
pkgs.vim
pkgs.git
pkgs.tmux
pkgs.python3
pkgs.nix-output-monitor
];
}

View File

@@ -5,6 +5,7 @@
}: let
inherit (import <niveum/lib>) kieran;
relayPassword = lib.fileContents <system-secrets/weechat/relay>;
weechatHome = "/var/lib/weechat";
in {
systemd.services.weechat = let
tmux = pkgs.writers.writeDash "tmux" ''
@@ -31,6 +32,7 @@ in {
pkgs.weechatScripts.weechat-autosort
pkgs.weechatScripts.colorize_nicks
pkgs.weechatScripts.weechat-matrix
(pkgs.callPackage <niveum/packages/weechatScripts/hotlist2extern.nix> {})
];
settings = let
nick = "kmein";
@@ -106,6 +108,13 @@ in {
};
};
logger.level.irc.news = 0;
plugins.var.perl.hotlist2extern = {
external_command_hotlist = "echo %X > ${weechatHome}/hotlist.txt";
external_command_hotlist_empty = "echo -n %X > ${weechatHome}/hotlist.txt";
lowest_priority = "2";
use_title = "off";
delimiter = ",";
};
matrix.server.nibbana = {
address = "nibbana.jp";
username = nick;
@@ -163,7 +172,7 @@ in {
wantedBy = ["multi-user.target"];
restartIfChanged = true;
path = [pkgs.alacritty.terminfo];
environment.WEECHAT_HOME = "/var/lib/weechat";
environment.WEECHAT_HOME = weechatHome;
preStart = "${pkgs.coreutils}/bin/rm $WEECHAT_HOME/*.conf";
script = "${tmux} -2 new-session -d -s IM ${weechat}/bin/weechat";
preStop = "${tmux} kill-session -t IM";