mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
chore: organize battery, steam and praesenzlehre into imports
This commit is contained in:
17
configs/battery.nix
Normal file
17
configs/battery.nix
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{ config, pkgs, ... }:
|
||||||
|
{
|
||||||
|
boot.extraModulePackages = with config.boot.kernelPackages; [
|
||||||
|
tp_smapi
|
||||||
|
acpi_call
|
||||||
|
];
|
||||||
|
boot.kernelModules = [ "tp_smapi" "acpi_call" ];
|
||||||
|
environment.systemPackages = [ pkgs.tpacpi-bat ];
|
||||||
|
|
||||||
|
services.tlp = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
START_CHARGE_THRESH_BAT0 = 80;
|
||||||
|
STOP_CHARGE_THRESH_BAT0 = 95;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -4,6 +4,48 @@ let
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
{
|
||||||
|
systemd.services.praesenzlehre = {
|
||||||
|
description = "Live Ticker zu praesenzlehre-berlin.org";
|
||||||
|
wants = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
startAt = "daily";
|
||||||
|
path = [ pkgs.curl pkgs.pup pkgs.bc ];
|
||||||
|
environment.BOT_TOKEN = lib.strings.fileContents <system-secrets/telegram/kmein.token>;
|
||||||
|
script = ''
|
||||||
|
set -efu
|
||||||
|
|
||||||
|
count_file=/tmp/praesenzlehre-berlin.org
|
||||||
|
|
||||||
|
set_count() {
|
||||||
|
echo $* > "$count_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
get_count() {
|
||||||
|
cat "$count_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
notify() {
|
||||||
|
curl -sSL -X POST -H 'Content-Type: application/json' \
|
||||||
|
-d "{\"chat_id\": \"@praesenzlehre_berlin\", \"text\": \"$*\"}" \
|
||||||
|
"https://api.telegram.org/bot$BOT_TOKEN/sendMessage"
|
||||||
|
}
|
||||||
|
|
||||||
|
test -f "$count_file" || set_count 0
|
||||||
|
|
||||||
|
count="$(get_count)"
|
||||||
|
|
||||||
|
new_count="$(curl -sSL https://praesenzlehre-berlin.org/ | pup '.dk-speakout-signature-count span text{}')"
|
||||||
|
|
||||||
|
if [ "$new_count" -gt "$count" ]; then
|
||||||
|
diff="$(echo "$new_count - $count" | bc)"
|
||||||
|
echo "$new_count (+ $diff)"
|
||||||
|
notify "$new_count Unterzeichner:innen! (+ $diff)"
|
||||||
|
set_count "$new_count"
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
<niveum/configs/hedgedoc.nix>
|
<niveum/configs/hedgedoc.nix>
|
||||||
<niveum/configs/spacetime.nix>
|
<niveum/configs/spacetime.nix>
|
||||||
@@ -64,45 +106,4 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = [ pkgs.vim pkgs.git pkgs.tmux ];
|
environment.systemPackages = [ pkgs.vim pkgs.git pkgs.tmux ];
|
||||||
|
|
||||||
systemd.services.praesenzlehre = {
|
|
||||||
description = "Live Ticker zu praesenzlehre-berlin.org";
|
|
||||||
wants = [ "network.target" ];
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
|
||||||
startAt = "daily";
|
|
||||||
path = [ pkgs.curl pkgs.pup pkgs.bc ];
|
|
||||||
environment.BOT_TOKEN = lib.strings.fileContents <system-secrets/telegram/kmein.token>;
|
|
||||||
script = ''
|
|
||||||
set -efu
|
|
||||||
|
|
||||||
count_file=/tmp/praesenzlehre-berlin.org
|
|
||||||
|
|
||||||
set_count() {
|
|
||||||
echo $* > "$count_file"
|
|
||||||
}
|
|
||||||
|
|
||||||
get_count() {
|
|
||||||
cat "$count_file"
|
|
||||||
}
|
|
||||||
|
|
||||||
notify() {
|
|
||||||
curl -sSL -X POST -H 'Content-Type: application/json' \
|
|
||||||
-d "{\"chat_id\": \"@praesenzlehre_berlin\", \"text\": \"$*\"}" \
|
|
||||||
"https://api.telegram.org/bot$BOT_TOKEN/sendMessage"
|
|
||||||
}
|
|
||||||
|
|
||||||
test -f "$count_file" || set_count 0
|
|
||||||
|
|
||||||
count="$(get_count)"
|
|
||||||
|
|
||||||
new_count="$(curl -sSL https://praesenzlehre-berlin.org/ | pup '.dk-speakout-signature-count span text{}')"
|
|
||||||
|
|
||||||
if [ "$new_count" -gt "$count" ]; then
|
|
||||||
diff="$(echo "$new_count - $count" | bc)"
|
|
||||||
echo "$new_count (+ $diff)"
|
|
||||||
notify "$new_count Unterzeichner:innen! (+ $diff)"
|
|
||||||
set_count "$new_count"
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,21 +7,10 @@
|
|||||||
imports = [ # Include the results of the hardware scan.
|
imports = [ # Include the results of the hardware scan.
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
<niveum/configs/default.nix>
|
<niveum/configs/default.nix>
|
||||||
|
<niveum/configs/battery.nix>
|
||||||
{
|
{
|
||||||
boot.extraModulePackages = with config.boot.kernelPackages; [
|
programs.steam.enable = true;
|
||||||
tp_smapi
|
nixpkgs.config.steam.java = true;
|
||||||
acpi_call
|
|
||||||
];
|
|
||||||
boot.kernelModules = [ "tp_smapi" "acpi_call" ];
|
|
||||||
environment.systemPackages = [ pkgs.tpacpi-bat ];
|
|
||||||
|
|
||||||
services.tlp = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
START_CHARGE_THRESH_BAT0 = 80;
|
|
||||||
STOP_CHARGE_THRESH_BAT0 = 95;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -48,9 +37,6 @@
|
|||||||
ipv6 = "42:0:3c46:ac99:ae36:cb8:c551:ba27";
|
ipv6 = "42:0:3c46:ac99:ae36:cb8:c551:ba27";
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.steam.enable = true;
|
|
||||||
nixpkgs.config.steam.java = true;
|
|
||||||
|
|
||||||
networking.hostName = "manakish";
|
networking.hostName = "manakish";
|
||||||
|
|
||||||
system.stateVersion = "20.09"; # Did you read the comment?
|
system.stateVersion = "20.09"; # Did you read the comment?
|
||||||
|
|||||||
@@ -5,24 +5,9 @@ in
|
|||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
<niveum/configs/default.nix>
|
<niveum/configs/default.nix>
|
||||||
|
<niveum/configs/battery.nix>
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
<stockholm/krebs/2configs/hw/x220.nix>
|
<stockholm/krebs/2configs/hw/x220.nix>
|
||||||
{
|
|
||||||
boot.extraModulePackages = with config.boot.kernelPackages; [
|
|
||||||
tp_smapi
|
|
||||||
acpi_call
|
|
||||||
];
|
|
||||||
boot.kernelModules = [ "tp_smapi" "acpi_call" ];
|
|
||||||
environment.systemPackages = [ pkgs.tpacpi-bat ];
|
|
||||||
|
|
||||||
services.tlp = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
START_CHARGE_THRESH_BAT0 = 80;
|
|
||||||
STOP_CHARGE_THRESH_BAT0 = 95;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
|
||||||
niveum = {
|
niveum = {
|
||||||
|
|||||||
Reference in New Issue
Block a user