1
0
mirror of https://github.com/kmein/niveum synced 2026-03-24 05:31:08 +01:00

4 Commits

11 changed files with 161 additions and 48 deletions

43
.bin/dummy-alert Executable file
View File

@@ -0,0 +1,43 @@
#!/bin/bash
name=$RANDOM
url='http://localhost:9093/api/v1/alerts'
echo "firing up alert $name"
# change url o
curl -XPOST $url -d "[{
\"status\": \"firing\",
\"labels\": {
\"alertname\": \"$name\",
\"service\": \"my-service\",
\"severity\":\"warning\",
\"instance\": \"$name.example.net\"
},
\"annotations\": {
\"summary\": \"High latency is high!\"
},
\"generatorURL\": \"http://prometheus.int.example.net/<generating_expression>\"
}]"
echo ""
echo "press enter to resolve alert"
read
echo "sending resolve"
curl -XPOST $url -d "[{
\"status\": \"resolved\",
\"labels\": {
\"alertname\": \"$name\",
\"service\": \"my-service\",
\"severity\":\"warning\",
\"instance\": \"$name.example.net\"
},
\"annotations\": {
\"summary\": \"High latency is high!\"
},
\"generatorURL\": \"http://prometheus.int.example.net/<generating_expression>\"
}]"
echo ""

View File

@@ -57,7 +57,7 @@ in {
];
environment.etc = {
"themes/dark/alacritty.yml".source = alacritty-cfg (import <niveum/lib/colours/owickstrom-dark.nix>);
"themes/light/alacritty.yml".source = alacritty-cfg (import <niveum/lib/colours/owickstrom-light.nix>);
"themes/dark/alacritty.yml".source = alacritty-cfg (import <niveum/lib/colours/papercolor-dark.nix>);
"themes/light/alacritty.yml".source = alacritty-cfg (import <niveum/lib/colours/papercolor-light.nix>);
};
}

View File

@@ -186,7 +186,17 @@ in {
}
{programs.command-not-found.enable = true;}
{
programs.gnupg.agent.enable = true;
home-manager.users.me = {
services.gpg-agent = rec {
enable = true;
enableSshSupport = true;
enableZshIntegration = true;
defaultCacheTtl = 2 * 60 * 60;
defaultCacheTtlSsh = defaultCacheTtl;
maxCacheTtl = 4 * defaultCacheTtl;
maxCacheTtlSsh = maxCacheTtl;
};
};
environment.systemPackages = [
pkgs.gnupg

View File

@@ -7,19 +7,7 @@
inherit (import <niveum/lib>) sshPort kieran;
externalNetwork = import <niveum/lib/external-network.nix>;
sshIdentity = name: "${config.users.users.me.home}/.ssh/${name}";
ssh-passphrase = lib.strings.fileContents <system-secrets/ssh/passphrase>;
in {
services.xserver.displayManager.sessionCommands = toString (pkgs.writeScript "ssh-add" ''
#!${pkgs.expect}/bin/expect -f
spawn ${pkgs.openssh}/bin/ssh-add
expect "Enter passphrase for *:"
send "${ssh-passphrase}\n";
expect "Identity added: *"
interact
'');
programs.ssh.startAgent = true;
users.users.me.openssh.authorizedKeys.keys = kieran.sshKeys pkgs;
home-manager.users.me.programs.ssh = {

8
flake.lock generated
View File

@@ -211,11 +211,11 @@
"stockholm": {
"flake": false,
"locked": {
"lastModified": 1669968392,
"narHash": "sha256-yXdKNYrOFpueTu6lFpm624rVri4rK6ad4qJqoUkc9vY=",
"lastModified": 1670868652,
"narHash": "sha256-Y5kEs6GsKMvkLe+q+rAQDTIpLwmbt51lB07JLGbi4f8=",
"ref": "refs/heads/master",
"rev": "645c3564f75589531abcf17fd3c3f920d93a394a",
"revCount": 10987,
"rev": "3884243448869bdf09f6434b385e532c7c26ae88",
"revCount": 11077,
"type": "git",
"url": "https://cgit.lassul.us/stockholm"
},

View File

@@ -0,0 +1,37 @@
rec {
black = {
dark = "#1c1c1c";
bright = "#585858";
};
red = {
dark = "#af005f";
bright = "#5faf5f";
};
green = {
bright = "#afd700";
dark = "#5faf00";
};
yellow = {
bright = "#af87d7";
dark = "#d7af5f";
};
blue = {
dark = "#5fafd7";
bright = "#ffaf00";
};
magenta = {
bright = "#ff5faf";
dark = "#808080";
};
cyan = {
dark = "#d7875f";
bright = "#00afaf";
};
white = {
dark = "#d0d0d0";
bright = "#5f8787";
};
background = black.dark;
foreground = white.dark;
cursor = blue.bright;
}

View File

@@ -0,0 +1,37 @@
rec {
black = {
dark = "#eeeeee";
bright = "#bcbcbc";
};
red = {
dark = "#af0000";
bright = "#d70000";
};
green = {
dark = "#008700";
bright = "#d70087";
};
yellow = {
dark = "#5f8700";
bright = "#8700af";
};
blue = {
dark = "#0087af";
bright = "#d75f00";
};
magenta = {
bright = "#878787";
dark = "#d75f00";
};
cyan = {
dark = "#005f87";
bright = "#005faf";
};
white = {
dark = "#444444";
bright = "#005f87";
};
background = black.dark;
foreground = white.dark;
cursor = blue.bright;
}

View File

@@ -40,7 +40,7 @@ rec {
sshPort = 22022;
colours = import ./colours/ibm-3270.nix;
colours = import ./colours/papercolor-dark.nix;
theme = pkgs: {
gtk = {

View File

@@ -23,7 +23,7 @@ in {
warning_fg = colours.yellow.bright;
warning_bg = colours.background;
alternating_tint_bg = colours.background;
alternating_tint_fg = colours.background;
alternating_tint_fg = colours.foreground;
critical_bg = colours.background;
good_bg = colours.background;
idle_bg = colours.background;

View File

@@ -25,7 +25,7 @@ in {
rm -rf "$stockholm"
}
${pkgs.git}/bin/git clone ${remote} "$stockholm"
${pkgs.git}/bin/git --git-dir "$stockholm"/.git log --pretty='"%s" by %an, %ar.' --since "$(${pkgs.coreutils}/bin/date -I -d "yesterday")" \
${pkgs.git}/bin/git --git-dir "$stockholm"/.git log --pretty='"%s" by %an, %ar.' --since "$(${pkgs.coreutils}/bin/date -d '1 hours ago')" \
| ${pkgs.jq}/bin/jq -R '{text: ., from: now | todateiso8601, to: (now + (60 * 60)) | todateiso8601}' \
| ${pkgs.curl}/bin/curl -Ssfd @- http://radio-news.r/
'';

View File

@@ -20,32 +20,30 @@ in {
krebs.htgen.tarot = {
port = tarotPort;
user.name = "radio";
script = ''. ${
pkgs.writers.writeDash "tarot" ''
case "$Method $Request_URI" in
"GET /")
if item=$(${pkgs.findutils}/bin/find ${toString tarotFiles} -type f | ${pkgs.coreutils}/bin/shuf -n1); then
card=$(mktemp --tmpdir tarot.XXX)
trap 'rm $card' EXIT
reverse=$(${pkgs.coreutils}/bin/shuf -i0-1 -n1)
if [ "$reverse" -eq 1 ]; then
${pkgs.imagemagick}/bin/convert -rotate 180 "$item" "$card"
else
${pkgs.coreutils}/bin/cp "$item" "$card"
fi
printf 'HTTP/1.1 200 OK\r\n'
printf 'Content-Type: %s\r\n' "$(${pkgs.file}/bin/file -ib "$card")"
printf 'Server: %s\r\n' "$Server"
printf 'Connection: close\r\n'
printf 'Content-Length: %d\r\n' $(${pkgs.coreutils}/bin/wc -c < "$card")
printf '\r\n'
cat "$card"
exit
fi
;;
esac
''
}'';
scriptFile = pkgs.writers.writeDash "tarot" ''
case "$Method $Request_URI" in
"GET /")
if item=$(${pkgs.findutils}/bin/find ${toString tarotFiles} -type f | ${pkgs.coreutils}/bin/shuf -n1); then
card=$(mktemp --tmpdir tarot.XXX)
trap 'rm $card' EXIT
reverse=$(${pkgs.coreutils}/bin/shuf -i0-1 -n1)
if [ "$reverse" -eq 1 ]; then
${pkgs.imagemagick}/bin/convert -rotate 180 "$item" "$card"
else
${pkgs.coreutils}/bin/cp "$item" "$card"
fi
printf 'HTTP/1.1 200 OK\r\n'
printf 'Content-Type: %s\r\n' "$(${pkgs.file}/bin/file -ib "$card")"
printf 'Server: %s\r\n' "$Server"
printf 'Connection: close\r\n'
printf 'Content-Length: %d\r\n' $(${pkgs.coreutils}/bin/wc -c < "$card")
printf '\r\n'
cat "$card"
exit
fi
;;
esac
'';
};
niveum.passport.services = [