1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 18:21:07 +01:00

chore: format with alejandra

This commit is contained in:
2022-03-10 21:52:12 +01:00
parent 13727abfd6
commit d37e90cb97
159 changed files with 4239 additions and 3405 deletions

View File

@@ -1,5 +1,13 @@
rec {
tmpfilesConfig = {type, path, mode ? "-", user ? "-", group ? "-", age ? "-", argument ? "-"}: "${type} '${path}' ${mode} ${user} ${group} ${age} ${argument}";
tmpfilesConfig = {
type,
path,
mode ? "-",
user ? "-",
group ? "-",
age ? "-",
argument ? "-",
}: "${type} '${path}' ${mode} ${user} ${group} ${age} ${argument}";
restic = rec {
port = 3571;
@@ -8,14 +16,25 @@ rec {
};
firewall = lib: {
accept = { source, protocol, dport }: "nixos-fw -s ${lib.escapeShellArg source} -p ${lib.escapeShellArg protocol} --dport ${lib.escapeShellArg (toString dport)} -j nixos-fw-accept";
accept = {
source,
protocol,
dport,
}: "nixos-fw -s ${lib.escapeShellArg source} -p ${lib.escapeShellArg protocol} --dport ${lib.escapeShellArg (toString dport)} -j nixos-fw-accept";
addRules = lib.concatMapStringsSep "\n" (rule: "iptables -A ${rule}");
removeRules = lib.concatMapStringsSep "\n" (rule: "iptables -D ${rule} || true");
};
serveHtml = file: pkgs: ''
default_type "text/html";
root ${pkgs.linkFarm "fahrplan" [{ name = "index.html"; path = file; }]};
root ${
pkgs.linkFarm "fahrplan" [
{
name = "index.html";
path = file;
}
]
};
index index.html;
'';
@@ -50,10 +69,11 @@ rec {
github = "kmein";
email = "kmein@posteo.de";
name = "Kierán Meinhardt";
sshKeys = pkgs: pkgs.lib.strings.splitString "\n" (pkgs.lib.strings.fileContents (pkgs.fetchurl {
url = "https://github.com/kmein.keys";
sha256 = "09c6ny0rmpid1m0pc1wsmb3wyy9g721lf4kv55i4lrp42b3i2d5b";
}));
sshKeys = pkgs:
pkgs.lib.strings.splitString "\n" (pkgs.lib.strings.fileContents (pkgs.fetchurl {
url = "https://github.com/kmein.keys";
sha256 = "09c6ny0rmpid1m0pc1wsmb3wyy9g721lf4kv55i4lrp42b3i2d5b";
}));
};
syncthing.devices = {

View File

@@ -1,4 +1,7 @@
{pkgs, path}: ''
{
pkgs,
path,
}: ''
<config>
<paths>
<path recursive="1">${path}</path>

View File

@@ -1,5 +1,9 @@
{ pkgs, wirelessInterface, colours, batteryName }:
let
{
pkgs,
wirelessInterface,
colours,
batteryName,
}: let
inherit (pkgs) lib;
setsid = script:
@@ -95,37 +99,43 @@ in {
{
block = "custom";
interval = 60 * 5;
command = let spacetime = import <niveum/configs/spacetime.nix>; in pkgs.writers.writePython3 "sun.py" { libraries = [ pkgs.python3Packages.astral ]; flakeIgnore = [ "E121" "E501" ]; }
''
import astral
import astral.moon
import astral.sun
moon_phases = {
0: "🌑",
3.5: "🌒",
7: "🌓",
10.5: "🌔",
14: "🌕",
17.5: "🌖",
21: "🌗",
24.5: "🌘",
28: "🌑",
command = let
spacetime = import <niveum/configs/spacetime.nix>;
in
pkgs.writers.writePython3 "sun.py" {
libraries = [pkgs.python3Packages.astral];
flakeIgnore = ["E121" "E501"];
}
current_phase = astral.moon.phase()
closest_phase = min(moon_phases.keys(), key=lambda x: abs(current_phase - x))
''
import astral
import astral.moon
import astral.sun
city = astral.LocationInfo("Berlin", "Germany", "${spacetime.time.timeZone}", ${toString spacetime.location.latitude}, ${toString spacetime.location.longitude})
sun = astral.sun.sun(city.observer, date=astral.today(), tzinfo=city.timezone)
moon_phases = {
0: "🌑",
3.5: "🌒",
7: "🌓",
10.5: "🌔",
14: "🌕",
17.5: "🌖",
21: "🌗",
24.5: "🌘",
28: "🌑",
}
current_phase = astral.moon.phase()
closest_phase = min(moon_phases.keys(), key=lambda x: abs(current_phase - x))
print("🌅 {} 🌇 {} {} {}".format(sun["sunrise"].strftime("%R"), sun["sunset"].strftime("%R"), moon_phases[closest_phase], round(current_phase, 1)))
'';
city = astral.LocationInfo("Berlin", "Germany", "${spacetime.time.timeZone}", ${toString spacetime.location.latitude}, ${toString spacetime.location.longitude})
sun = astral.sun.sun(city.observer, date=astral.today(), tzinfo=city.timezone)
print("🌅 {} 🌇 {} {} {}".format(sun["sunrise"].strftime("%R"), sun["sunset"].strftime("%R"), moon_phases[closest_phase], round(current_phase, 1)))
'';
}
{
block = "custom";
interval = 5;
command = pkgs.writers.writeDash "hu-berlin-vpn" ''
PATH=${lib.makeBinPath [ pkgs.systemd ]}
PATH=${lib.makeBinPath [pkgs.systemd]}
(systemctl is-active --quiet openvpn-hu-berlin.service && echo "🎓👍 (OpenVPN)") \
|| (systemctl is-active --quiet hu-vpn.service && echo "🎓👍 (PPP+SSL)") \
|| echo "🎓👎"
@@ -154,7 +164,7 @@ in {
format_mem = "{mem_used;G}";
clickable = false;
}
{ block = "load"; }
{block = "load";}
{
block = "time";
interval = 1;

File diff suppressed because it is too large Load Diff