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

1 Commits

Author SHA1 Message Date
Kierán Meinhardt
3a31717c27 WIP: develop mail config 2019-08-18 19:16:56 +02:00
391 changed files with 3411 additions and 20967 deletions

View File

@@ -1,38 +0,0 @@
#! /bin/sh
set -euf
pl() {
for i in $(seq $1 $(expr $2 - 1)); do
printf '\e[38;5;%sm%03i\e[m ' $i $i
done
printf '\e[38;5;%sm%03i\e[m\n' $2 $2
}
p() {
printf '\e[38;5;%sm%03i\e[m ' $1 $1
}
pn() {
printf '\e[38;5;%sm%03i\e[m\n' $1 $1
}
p6x6() {
for i in $(seq 0 5); do
for j in $(seq 0 5); do
p $(expr $1 + $i + $j \* 6)
done
echo
done
}
pl 0 7
pl 8 15
p6x6 16
p6x6 52
p6x6 88
p6x6 124
p6x6 160
p6x6 196
pl 232 243
pl 244 255

View File

@@ -1,29 +0,0 @@
#!/bin/sh
file="${1?please supply a poetry file}"
[ -f "$file" ] || {
echo "'$file' is no file"
exit 1
}
poem="$(mktemp)"
clean () {
rm "$poem"
}
trap clean EXIT
sed '/^$/d' "$file" > "$poem"
htmlize() {
awk 'ORS="<br/>"' \
| head -c -5 # remove final <br/> characters
}
for line_number in $(seq 1 "$(wc -l "$poem" | cut -d' ' -f1)"); do
if [ "$line_number" -gt 3 ] && [ "$line_number" -gt 1 ]; then
sed -n "$((line_number - 3)),$((line_number - 1))p" "$poem"
else
sed -n "1,$((line_number - 1))p" "$poem"
fi | htmlize
printf '\t'
sed -n "${line_number},+1p" "$poem" | htmlize
printf '\n'
done

View File

@@ -1,54 +0,0 @@
#!/usr/bin/env -S sed -f
s/ā̊/𐬃/g
s//𐬝/g
s/ṣ̌/𐬴/g
s/š́/𐬳/g
s/ą̄/𐬅/g
s/ŋᵛ/𐬤/g
s/ə̄/𐬇/g
s/ŋ́/𐬣/g
s//𐬒/g
s/xᵛ/𐬓/g
s/a/𐬀/g
s/ā/𐬁/g
s/å/𐬂/g
s/ą/𐬄/g
s/ə/𐬆/g
s/e/𐬈/g
s/ē/𐬉/g
s/o/𐬊/g
s/ō/𐬋/g
s/i/𐬌/g
s/ī/𐬍/g
s/u/𐬎/g
s/ū/𐬏/g
s/k/𐬐/g
s/x/𐬑/g
s/g/𐬔/g
s/ġ/𐬕/g
s/γ/𐬖/g
s/c/𐬗/g
s/j/𐬘/g
s/t/𐬙/g
s/θ/𐬚/g
s/d/𐬛/g
s/δ/𐬜/g
s/p/𐬞/g
s/f/𐬟/g
s/b/𐬠/g
s/β/𐬡/g
s/ŋ/𐬢/g
s/n/𐬥/g
s/ń/𐬦/g
s//𐬧/g
s/m/𐬨/g
s//𐬩/g
s//𐬫/g
s/y/𐬪/g
s/v/𐬬/g
s/r/𐬭/g
s/s/𐬯/g
s/z/𐬰/g
s/š/𐬱/g
s/ž/𐬲/g
s/h/𐬵/g

View File

@@ -1,24 +0,0 @@
#!/bin/sh -e
#
# Usage: browser
# pipe html to a browser
# e.g.
# $ echo '<h1>hi mom!</h1>' | browser
# $ ron -5 man/rip.5.ron | browser
if [ -t 0 ]; then
if [ -n "$1" ]; then
open $1
else
cat <<usage
Usage: browser
pipe html to a browser
$ echo '<h1>hi mom!</h1>' | browser
$ ron -5 man/rip.5.ron | browser
usage
fi
else
f="/tmp/browser.$RANDOM.html"
cat /dev/stdin > $f
xdg-open $f
fi

View File

@@ -1,46 +0,0 @@
#!/bin/sh
interesting="U6 N6 140 M46 184 N84"
curl -sSL 'https://www.bvg.de/disruption-reports/q' \
--data-raw '{"variables":{},"query":"{
allDisruptions {
disruptions {
meldungsId
linie
verkehrsmittel
__typename
... on Traffic {
datum
gueltigVonDatum
gueltigVonZeit
gueltigBisDatum
gueltigBisZeit
richtungName
richtungHafasId
beginnAbschnittName
beginnAbschnittHafasId
endeAbschnittName
endeAbschnittHafasId
textIntUrsache
sev
textIntAuswirkung
umfahrung
textWAPSMSUrsache
textWAPSMSAuswirkung
prioritaet
__typename
}
}
__typename
}
}"}' \
| jq --arg interesting "$interesting" '
.data.allDisruptions.disruptions
| map(select(
(.linie as $linie
| $interesting
| split(" ")
| index($linie))
and (.["__typename"] == "Traffic")
))
'

View File

@@ -1,19 +0,0 @@
#!/bin/sh
directory="$(mktemp -d)"
trap clean EXIT
clean() {
rm -rf "$directory"
}
year=$(date +%Y)
output=/tmp/$year.pdf
for month in $(seq 1 12); do
printf "\r%d" "$month" 1>&2
astrolog -zN Berlin -qm "$month" "$year" -X -K -XA -Xr -Xm -Xb -Xo "$(printf "%s/%02d.bmp" "$directory" "$month")" -Xw 1080 720 2>/dev/null
done
printf "\r"
convert "$directory/*.bmp" "$output"
echo "$output"

View File

@@ -1,25 +0,0 @@
#!/bin/sh
set -efu
usage() {
echo >&2 "$0 add-{reddit,telegram,youtube,twitch,twitter} NAME"
exit 1
}
candyman() {
curl -fsSv http://news.r/api -H content-type:application/json -d "$(jq -n "
{
command: \"PRIVMSG\",
params: [\"#all\", \"candyman: $1 $2\"]
}
")"
}
[ $# -ge 2 ] || usage
case "$1" in
add-reddit|add-telegram|add-youtube|add-twitter|add-twitch)
candyman "$@"
;;
*) usage;;
esac

View File

@@ -1,23 +0,0 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p pdftk gnugrep
set -efu
INPUT_FILE="${2:?Pass the PDF path as second argument.}"
PAGES_PER_REPORT="${1:?Pass the chunk size as first argument.}"
if [ ! -f "$INPUT_FILE" ]; then
echo >&2 "File $INPUT_FILE does not exist."
exit 1
fi
TOTAL_PAGES="$(pdftk "$INPUT_FILE" dump_data | grep NumberOfPages | cut -f2 -d' ')"
RUNS=$((TOTAL_PAGES/PAGES_PER_REPORT))
for run in $(seq 0 "$((RUNS-1))"); do
start_page=$((run*PAGES_PER_REPORT+1))
end_page=$(((run+1)*PAGES_PER_REPORT))
output_file="chunk_$((run+1)).pdf"
echo "splitting $INPUT_FILE from $start_page to $end_page into $output_file"
pdftk "$INPUT_FILE" cat "$start_page-$end_page" output "$output_file"
done

View File

@@ -1,13 +0,0 @@
#!/usr/bin/env -S awk -f
function z() {
getline < "/proc/uptime"
close("/proc/uptime")
return $0
}
BEGIN {
x = z()
while (1) {
y = z()
printf "%02d:%05.2f\r", (y - x) / 60, (y - x) % 60
}
}

View File

@@ -1,14 +0,0 @@
#!/usr/bin/env python3
import csv
import json
import sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--delimiter", "-d", default=",", help="CSV field separator")
args = parser.parse_args()
if __name__ == "__main__":
json.dump(list(csv.DictReader(sys.stdin, delimiter=args.delimiter)), sys.stdout)

View File

@@ -1,43 +0,0 @@
#!/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

@@ -1,7 +0,0 @@
#! /usr/bin/env nix-shell
#! nix-shell -p "(import <nixpkgs> { overlays = [ (import ~/work/fysiweb/engiadina-pwa/devops/pkgs) ]; }).elm-publish-private"
#! nix-shell -i bash
set -efux
exec elm-publish-private "$@"

View File

@@ -1,21 +0,0 @@
#!/bin/sh
set -xfu
drive="$1"
mountpoint="/media/sd-card-$(date +%s)"
backup_directory="$(pwd)"
trap clean EXIT
clean() {
umount "$mountpoint"
rmdir "$mountpoint"
fsck.exfat "$drive"
}
filenames="$(fsck.exfat "$drive" 2>&1 | sed -nE "s/.* file '(.*?)' is not allocated.*/\1/p")"
mkdir "$mountpoint"
mount "$drive" "$mountpoint"
echo "$filenames" | while read -r filename; do
find "$mountpoint" -type f -name "$filename" -exec mv {} "$backup_directory" \;
done

View File

@@ -1,34 +0,0 @@
#!/bin/sh
set -efu
# Berlin: -d lodeg=13 -d lomin=22 -d losec=41 -d lodir=E -d ladeg=52 -d lamin=27 -d lasec=42 -d ladir=N -d usecoords=1 \
# Kassel: -d lodeg=9 -d lomin=32 -d losec=5 -d lodir=E -d ladeg=51 -d lamin=18 -d lasec=17 -d ladir=N -d usecoords=1 \
[ $# -eq 1 ] || {
echo >&2 Usage: "$0" TIMESTAMP
exit 1
}
export TZ=UTC
chart_path="$(mktemp /tmp/chart_XXX.pdf)"
timestamp="$1"
year="$(date -d "@$timestamp" +%Y)"
month="$(date -d "@$timestamp" +%m)"
day="$(date -d "@$timestamp" +%d)"
hour="$(date -d "@$timestamp" +%H)"
minute="$(date -d "@$timestamp" +%M)"
curl -sSL 'https://edifyingfellowship.org/astro/' \
-d lodeg=9 -d lomin=32 -d losec=5 -d lodir=E -d ladeg=51 -d lamin=18 -d lasec=17 -d ladir=N -d usecoords=1 \
-d ybyr="$year" -d ybmo="$month" -d ybdy="$day" -d ybhr="$hour" -d ybmi="$minute" -d ybsc=0 -d ybtz="$TZ" \
-d currenttime=0 \
-d title="$timestamp" \
-d options[]=VancouverWheel -d options[]=Arrow -d options[]=XBold -d options[]=HouseLabels -d options[]=Placidus \
-d options[]=Sun -d options[]=Moon -d options[]=Mercury -d options[]=Venus -d options[]=Mars -d options[]=Jupiter -d options[]=Saturn -d options[]=Uranus -d options[]=Neptune -d options[]=Pluto -d options[]=Ascendant -d options[]=MC -d options[]=Lilith -d options[]=MeanNode -d options[]=TrueNode \
-d aspectpct=100 -d format=PDF -d Submit= -o "$chart_path"
zathura "$chart_path"

View File

@@ -1,24 +0,0 @@
#!/usr/bin/env python3
import csv
import json
import sys
if __name__ == "__main__":
json_list = json.load(sys.stdin)
if not isinstance(json_list, list):
print("JSON object is not a list.", file=sys.stderr)
sys.exit(1)
if len(json_list) == 0:
print("JSON list is empty.", file=sys.stderr)
sys.exit(1)
keys = set()
for element in json_list:
if isinstance(element, dict):
keys |= element.keys()
else:
print("Non-dict element:", element, file=sys.stderr)
sys.exit(1)
writer = csv.DictWriter(sys.stdout, fieldnames=list(keys))
writer.writeheader()
for element in json_list:
writer.writerow(element)

View File

@@ -1,5 +0,0 @@
#!/usr/bin/env -S jq -r -f
(map(keys) | add | unique) as $cols
| map(. as $row | $cols | map($row[.])) as $rows
| $cols, $rows[]
| @csv

View File

@@ -1,15 +0,0 @@
#!/usr/bin/env bash
session_id=7b638c194d9bda74f80043045018cc9e
declare -A libraries
libraries["Literatur"]=344428
libraries["Sprache"]=344160
libraries["Miscellanea"]=344427
libraries["Wissenschaft"]=344429
libraries["Relicta"]=565920
for library in ${!libraries[@]}
do
curl -sSL 'https://www.libib.com/library/functions/csv-export.php' -H "Cookie: PHPSESSID=$session_id" -d export="${libraries[$library]}" > "$library.csv"
done

View File

@@ -1,81 +0,0 @@
#!/bin/sh
set -efu
if echo "$1" | grep -Eq '[[:digit:]]{5}'; then
PLZ="$1"
else
echo >&2 "Usage: $0 PLZ"
exit 1
fi
lieferando_dir=/tmp/lieferando
mkdir -p "$lieferando_dir/$PLZ"
fetch_restaurants() {
cache_path="$lieferando_dir/$PLZ.json"
if [ -r "$cache_path" ]; then
cat "$cache_path"
else
w3m -dump_source "http://www.lieferando.de/$PLZ" \
| gunzip \
| sed -n '/var restaurants/,/];$/p' \
| sed 's/var restaurants =//;$s/;$//' \
| prettier --parser=json \
| jq '
map({
name: .[30] | .name,
category: .[30] |.categories | split(", "),
url: "http://lieferando.de\(.[30] | .url)",
minutes: .[19],
minimum: .[10],
delivery: .[14]
})' \
| tee "$cache_path"
fi
}
fetch_menu() {
[ $# -eq 1 ] || exit 1
slug="$(echo "$1" | sed 's!.*/!!')"
cache_path="$lieferando_dir/$PLZ/$slug.json"
if [ -r "$cache_path" ]; then
cat "$cache_path"
else
w3m -dump_source "$1" \
| gunzip \
| sed -n '/var MenucardProducts/,/\];/p' \
| sed 's/var MenucardProducts =//;s/;$//' \
| jq -r '
unique_by(.productId)
| group_by(.categoryId)
| flatten
' \
| tee "$cache_path"
fi
}
data="$(fetch_restaurants)"
# echo "$data" | jq -c '.[]' | while read -r restaurant; do
# fetch_menu "$(echo "$restaurant" | jq -r .url)"
# done
selected_categories="$(echo "$data" | jq -r 'map(.category) | flatten | unique | .[]' | fzf -m)"
selected_restaurant_url="$(echo "$selected_categories" | jq --argjson restaurants "$data" -sRr '
split("\n")[:-1] as $categories
| $restaurants[]
| select(.category - $categories != .category)
| "\(.name) [🚴\(.minutes)min 💰\(.minimum)€ + \(.delivery)€] (\(.url))"
' \
| fzf \
| sed 's/.*(//;s/)$//'
)"
fetch_menu "$selected_restaurant_url" \
| jq -r '.[] | "\(.price)\t\(.name)"' \
| fzf -m \
| awk '{print $0; sum += $1} END {print "-----"; print sum}'

View File

@@ -1,17 +0,0 @@
BEGIN {
if (!comment) comment = "--";
if (!begin) begin = "\\begin{code}";
if (!end) end = "\\end{code}";
}
{
if ($0 == begin) {
code = 1;
print comment, $0;
} else if ($0 == end) {
code = 0;
print comment, $0;
} else {
if (code) print $0;
else print comment, $0;
}
}

View File

@@ -1,3 +0,0 @@
#! /bin/sh
set -efu
exec curl -fSs --unix-socket /tmp/much.api.sock http://localhost/current/part

View File

@@ -1,27 +0,0 @@
#! /bin/sh
# usage: mail-current-query-find-part-by-name NAME
set -efu
name=$1
query=$(mail-current-query)
result=$(notmuch show --entire-thread=false --format=json "$query")
part_id=$(printf %s "$result" | jq --arg name "$name" '
[
recurse |
select(type == "object") |
{ id, name: .filename } |
select(.id != null and .name != null)
] |
map(select(.name == $name))[0].id
')
if test "$part_id" = null; then
printf 'error: could not find part with name %s\n' \
"$name" \
>&2
exit 1
fi
exec notmuch show --part="$part_id" "$query"

View File

@@ -1,39 +0,0 @@
#! /bin/sh
# usage: mail-current-query-find-part-by-type TYPE
set -efu
type=$1
query=$(mail-current-query)
result=$(notmuch show --entire-thread=false --format=json "$query")
part_id=$(printf %s "$result" | jq --arg type "$type" '
#flatten|map(select(.!=null))[0].body[0] |
#
#if .["content-type"] == $type then
# .id
#elif .["content-type"] | test("^multipart/") then
# .content|map(select(.["content-type"]==$type))[0].id
#else
# null
#end
[
recurse |
select(type == "object") |
{ id, type: .["content-type"] } |
select(.id != null and .type != null)
] |
map(select(.type == $type))[0].id
')
if test "$part_id" = null; then
printf 'error: could not find part with type %s\n' \
"$type" \
>&2
exit 1
fi
exec notmuch show --part="$part_id" "$query"

View File

@@ -1,114 +0,0 @@
#!/usr/bin/env bash
# Usage:
# ./mp3_transfer.sh -s 1.3 /mnt/mp3player file1.m4a file2.m4a ...
set -e
# Default speed
SPEED=1.0
# Parse options
while getopts ":s:" opt; do
case $opt in
s)
SPEED=$OPTARG
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires a value." >&2
exit 1
;;
esac
done
# Shift past the options
shift $((OPTIND -1))
# Check arguments
if [ "$#" -lt 2 ]; then
echo "Usage: $0 [-s speed] MOUNT_POINT FILE1 [FILE2 ...]"
exit 1
fi
MOUNT_POINT=$1
shift
FILES=("$@")
# Check mount point exists
if [ ! -d "$MOUNT_POINT" ]; then
echo "Error: Mount point '$MOUNT_POINT' does not exist."
exit 1
fi
# Estimate required space
TOTAL_SIZE=0
for f in "${FILES[@]}"; do
if [ ! -f "$f" ]; then
echo "Warning: File '$f' does not exist, skipping."
continue
fi
# Get file size in bytes
FILE_SIZE=$(stat --printf="%s" "$f")
# Estimate mp3 output size: roughly 1/2 of original m4a (adjust if needed)
TOTAL_SIZE=$((TOTAL_SIZE + FILE_SIZE / 2))
done
# Get available space in bytes
AVAILABLE=$(df --output=avail "$MOUNT_POINT" | tail -n 1)
AVAILABLE=$((AVAILABLE * 1024)) # df reports in KB
if [ "$TOTAL_SIZE" -gt "$AVAILABLE" ]; then
echo "Error: Not enough space on device. Required: $TOTAL_SIZE bytes, Available: $AVAILABLE bytes"
exit 1
fi
echo "Enough space available. Starting conversion..."
sanitize_filename() {
local name="$1"
# Remove path, keep only base name
name=$(basename "$name" .m4a)
# Replace spaces and special chars with underscore
name=$(echo "$name" | tr ' ' '_' | tr -cd '[:alnum:]_-')
# Truncate to max 50 chars
echo "${name:0:50}"
}
# Convert and copy files
for f in "${FILES[@]}"; do
if [ ! -f "$f" ]; then
continue
fi
# Determine the next prefix
existing_prefixes=$(ls "$MOUNT_POINT" | grep -E '^[0-9].*\.mp3$' | sed -E 's/^([0-9]).*/\1/' | sort -n | uniq)
for i in {0..9}; do
if ! echo "$existing_prefixes" | grep -q "^$i$"; then
PREFIX=$i
break
fi
done
echo "Using prefix: $PREFIX"
BASENAME=$(sanitize_filename "$f")
OUT_PATTERN="$MOUNT_POINT/${PREFIX}%02d_${BASENAME}.mp3"
echo "Converting '$f' to '$OUT_PATTERN' at speed $SPEED..."
ffmpeg -i "$f" \
-filter:a "atempo=$SPEED" -ar 44100 -ac 2 -c:a libmp3lame -b:a 128k \
-f segment -segment_time 300 \
"$OUT_PATTERN"
# Update prefix for next file
# Count how many segments were created
SEG_COUNT=$(ls "$MOUNT_POINT" | grep -E "^${PREFIX}[0-9]{2}_" | wc -l)
PREFIX=$((PREFIX + SEG_COUNT))
done
echo "All files processed successfully."

View File

@@ -1 +0,0 @@
ssh mud@hotdog.r -t "MUD_NICKNAME=$LOGNAME mud"

View File

@@ -1,6 +0,0 @@
#!/bin/sh
curl -sSL 'https://diac.alsharekh.org/Diac/DiacText' \
-H "Content-Type: application/json" \
--data-raw "$(jq --raw-input '{word: ., type: 1}')" \
--compressed \
| jq -r .diacWord

View File

@@ -1,93 +0,0 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p coreutils gnugrep gnused graphviz
#
# usage: nix-haddock-index
#
# Run this script in an environment where either NIX_GHC is set, or the ghc
# executable exists, to generate an HTML index file pointing to all Haddock
# files accessible to the respective ghc version.
#
# Additionally, an SVG dependency graph of all packages is linked at the
# bottom of the index file.
#
# Note: all files will be generated in /tmp, and won't be deleted automatically
#
set -efux
if test -z "${NIX_GHC-}"; then
NIX_GHC=$(readlink -f "$(type -P ghc)")
fi
if ! echo $NIX_GHC | grep -q '^/nix/store/'; then
printf '%s: error: unsupported GHC executable path (not in Nix store): %q\n' \
"$0" \
"$NIX_GHC" \
>&2
exit -1
fi
NIX_GHC_PREFIX=$(dirname "$(dirname "$NIX_GHC")")
NIX_GHC_DOCDIR=$NIX_GHC_PREFIX/share/doc/ghc/html
main() {
hash=$(echo $NIX_GHC_PREFIX | sed -n 's|^/nix/store/\([a-z0-9]\+\).*|\1|p')
title="Haddock index for $NIX_GHC_PREFIX"
header=$(
printf 'Haddock index for <a href="%s">%s</a>\n' \
$NIX_GHC_PREFIX \
$NIX_GHC_PREFIX \
)
suffix=${hash:+-$hash}
index_file=/tmp/haddock$suffix-index.html
svg_file=/tmp/haddock$suffix.svg
#if ! test -e $index_file; then
eval "$(
echo 'gen_index() {'
echo ' html_head'
"$NIX_GHC_PREFIX"/bin/ghc-pkg dump | sed -n '
s/^---$/ reset/p
s/^\(name\|version\):\s*\([-A-Za-z0-9_.]\+\)$/ \1=\2/p
s/^haddock-html:\s*\([-A-Za-z0-9_./]\+\)$/ haddock_html \1/p
'
echo ' html_foot'
echo '}'
)"
gen_index > $index_file
#fi
#if ! test -e $svg_file; then
"$NIX_GHC_PREFIX"/bin/ghc-pkg dot | tred | dot -Tsvg | sed '
s/<svg width="[0-9]\+pt" height="[0-9]\+pt"/<svg width="3600px" height="100%"/
' > $svg_file
#fi
echo $index_file
}
reset() {
unset name version
}
haddock_html() {
printf '<li>'
printf '<a href="%s/index.html">%s</a>' "$1" "$name-$version"
printf '</li>\n'
}
html_head() {
printf '<!doctype html>\n'
printf '<title>%s</title>\n' "$title"
printf '<link href="%s" rel="stylesheet" type="text/css">\n' \
"$NIX_GHC_DOCDIR/libraries/ocean.css"
printf '<h1>%s</h1>\n' "$header"
printf '<ul>\n'
}
html_foot() {
printf '</ul>\n'
printf '<a href="%s">graph</a>\n' "$svg_file"
}
main "$@"

View File

@@ -1,15 +0,0 @@
#!/bin/sh
# inspired by https://github.com/connermcd/bin/blob/1d38cb98812906d8b95dc6e51e1149e29261617d/notetags
cd "$HOME/notes/" || exit
[ -f tags ] && rm tags
grep -r 'tags:' ./* | while read -r line; do
file=$(echo "$line" | cut -d: -f1)
unparsed_tags=$(echo "$line" | cut -d: -f3) #
tags=$(echo "$unparsed_tags" | sed -e 's/tags: *//g' -e 's/[][,]//g')
for tag in $tags; do
echo "$tag $file /^$unparsed_tags$/;" >> tags
done
done

View File

@@ -1,23 +0,0 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p poppler_utils tesseract4
set -eu
pdf_path="$(realpath "$1")"
[ -f "$pdf_path" ] || {
echo "Usage: $0 FILE.pdf" >&2
exit 1
}
tmpdir="$(mktemp -d)"
trap 'rm -rf $tmpdir' EXIT
cd "$tmpdir"
pdftoppm -png "$pdf_path" pdf-ocr
for png in pdf-ocr*.png; do
tesseract "$png" "$png.txt" 2>/dev/null
done
cat pdf-ocr-*.txt

View File

@@ -1,2 +0,0 @@
#!/bin/sh
youtube-dl -ij "$*" | jq -sr '.[] | .webpage_url'

View File

@@ -1,65 +0,0 @@
#!/bin/sh
lidl() {
echo LIDL
curl -sSL 'https://endpoints.lidl-flyer.com/v3/region-overview/lidl/de-DE/0.json' \
| jq -r '
.categories
| map(select(.name == "Filial-Angebote") | .subcategories | map(.flyers))
| flatten
| flatten
| .[]
| .pdfUrl
'
}
aldi_nord() {
echo ALDI nord
echo 'https://magazine.aldi-nord.de/aldi-nord/aldi-aktuell/GetPDF.ashx'
echo 'https://magazine.aldi-nord.de/aldi-nord/aldi-vorschau/GetPDF.ashx'
}
rewe_berlin() {(
store_id=662366923
publisher_id=1062
echo REWE
curl -sSL 'https://www.bonialserviceswidget.de/de/stores/'$store_id'/brochures?storeId='$store_id'&publisherId='$publisher_id | while read -r brochure_id; do
curl -sSL 'https://www.bonialserviceswidget.de/de/v5/brochureDetails/'"$brochure_id"'?publisherId='$publisher_id | jq -r .pdfUrl
done
)}
kaufland() {(
region_code=8920
echo KAUFLAND
curl -sSL https://filiale.kaufland.de/prospekte.html | htmlq --attribute href '.flyer a' | grep -Eo 'DE_de_KDZ[^/]*' | sed "s/_3000_/_${region_code}_/" | while read -r flyer_id; do
curl -sSL "https://endpoints.leaflets.kaufland.com/v3/$flyer_id/flyer.json?regionCode=$region_code" | jq -r .flyer.pdfUrl
done
)}
netto_schwarz() {
echo 'NETTO (schwarz)'
curl -sSL 'https://squid-api.tjek.com/v2/catalogs?dealer_ids=90f2VL&order_by=created' \
| jq -r '.[] | .id' \
| while read -r flyer_id; do
curl -sSL "https://squid-api.tjek.com/v2/catalogs/$flyer_id/download" \
| jq -r .pdf_url
done
}
dir="$(mktemp -d)"
trap clean EXIT
clean() {
rm -rf "$dir"
}
prospekt_url="$( (
lidl
aldi_nord
rewe_berlin
kaufland
netto_schwarz
) | fzf)"
curl -sSL "$prospekt_url" -o "$dir/prospekt.pdf"
zathura "$dir/prospekt.pdf"

View File

@@ -1,17 +0,0 @@
#!/bin/sh
curl -sSL https://www.netzwelt.de/proxy/index.html \
| pup ".tblc" \
| xml-to-json /dev/stdin \
| jq '
.div.table.tbody.tr
| map(
.td
| {
ip: .[0].a.value,
port: .[1],
country: .[2] | (if type == "string" then . else .a.value end),
security: .[3],
protocol: .[4]
}
)
'

View File

@@ -1,4 +0,0 @@
#!/bin/sh
curl -sSL "https://raw.githubusercontent.com/$*/master/README.md" \
| pandoc -f gfm -t man -s \
| man -l -

View File

@@ -1,6 +0,0 @@
#!/bin/sh
filepath="$(shuf --head-count=1)"
pages="$(pdfinfo "$filepath" | awk '/^Pages:/{print $2}')"
random_page="$(shuf --input-range="1-$pages" --head-count=1)"
zathura --page="$random_page" "$filepath"

View File

@@ -1,16 +0,0 @@
#! /usr/bin/env nix-shell
#! nix-shell -i sh -p coreutils byzanz xorg.xwininfo gnused
# shellcheck shell=sh
# ref https://gist.github.com/aforemny/0994cb7f06ea30d56c8b9681ff5d2054
set -eux
eval "$(xwininfo | \
sed -n -e 's/^ \+Absolute upper-left X: \+\([0-9]\+\).*/x=\1/p' \
-e 's/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/y=\1/p' \
-e 's/^ \+Width: \+\([0-9]\+\).*/w=\1/p' \
-e 's/^ \+Height: \+\([0-9]\+\).*/h=\1/p')"
trap "pkill -f 'sleep 360d'" INT
byzanz-record -e "sleep 360d" -c -x $x -y $y -w $w -h $h "$@"

View File

@@ -1,49 +0,0 @@
import ephem
from datetime import datetime, date, timedelta
now = datetime.now()
limit = now + timedelta(days=365)
def events_until(limit):
initial_date = ephem.Date(datetime.now())
events = {}
now = initial_date
while ephem.localtime(now) <= limit:
now = ephem.next_full_moon(now)
events[now] = "🌕"
now = initial_date
while ephem.localtime(now) <= limit:
now = ephem.next_new_moon(now)
events[now] = "🌑"
now = initial_date
while ephem.localtime(now) <= limit:
now = ephem.next_vernal_equinox(now)
events[now] = "spring equinox"
now = initial_date
while ephem.localtime(now) <= limit:
now = ephem.next_autumnal_equinox(now)
events[now] = "fall equinox"
now = initial_date
while ephem.localtime(now) <= limit:
now = ephem.next_winter_solstice(now)
events[now] = "winter solstice"
now = initial_date
while ephem.localtime(now) <= limit:
now = ephem.next_summer_solstice(now)
events[now] = "summer solstice"
return events
events = events_until(limit)
for date, event in sorted(events.items(), key=lambda x: x[0]):
if ephem.localtime(date) < limit:
print(ephem.localtime(date), event)

View File

@@ -1,81 +0,0 @@
let
lib = import <nixpkgs/lib>;
in
rec {
inherit lib;
input = [
{
x = [
"pool"
"zfs"
];
y = [
"mdadm"
"raid1"
];
}
{
x = [
"pool"
"zfs"
];
y = [
"disk"
"sda"
];
}
{
x = [
"mdadm"
"raid1"
];
y = [
"disk"
"sdb"
];
}
{
x = [
"mdadm"
"raid1"
];
y = [
"disk"
"sdc"
];
}
];
outNodes = node: graph: lib.unique (builtins.map (e: e.y) (builtins.filter (v: v.x == node) graph));
vertices = graph: lib.unique (builtins.map (x: x.y) graph ++ builtins.map (x: x.x) graph);
deleteVertex = node: graph: (builtins.filter (v: v.x != node && v.y != node) graph);
findSink =
graph:
lib.findFirst (v: outNodes v graph == [ ]) (lib.trace graph (builtins.abort "No sink found")) (
vertices graph
);
topSort =
graph:
if graph == [ ] then
[ ]
else if builtins.length graph == 1 then
let
only = builtins.head graph;
in
[
only.y
only.x
]
else
let
sink = findSink graph;
in
[ sink ] ++ topSort (deleteVertex sink graph);
output = topSort input;
}

View File

@@ -1,18 +0,0 @@
#/usr/bin/env -S deno run -A:q
set -x
session_cache="$HOME/.cache/tt-rss.session"
ttrss_endpoint=https://feed.kmein.de/api/
ttrss_user=k
ttrss_password=$(pass shared/tt-rss/password)
login() {
if [ -f "$session_cache" ]; then
session_id="$(cat "$session_cache")"
else
session_id="$(curl -d '{"op":"login","user":"'"$ttrss_user"'","password":"'"$ttrss_password"'"}' "$ttrss_endpoint" | jq -r .content.session_id)"
echo "$session_id" > "$session_cache"
fi
}
login
curl -d '{"sid":"'"$session_id"'","op":"getUnread"}' "$ttrss_endpoint" | jq .content

View File

@@ -1,16 +0,0 @@
#!/bin/sh
set -efux
expected_max_results=1024 # the upper bound on the number of restaurants
radius=250
echo '[out:json];node(id:260050809)->.cbase;
(
node(around.cbase:'$radius')[amenity=fast_food];
node(around.cbase:'$radius')[amenity=restaurant];
);out;' \
| curl -sSL -d @- -X POST http://overpass-api.de/api/interpreter \
| jq --argjson random "$(shuf -i 0-$expected_max_results -n 1)" '
.elements
| length as $length
| .[$random % $length]
'

View File

@@ -1,8 +0,0 @@
import sys
import unicodedata
for index, character in enumerate(sys.stdin.read().strip()):
try:
print(index, character, hex(ord(character)), unicodedata.category(character), unicodedata.name(character))
except:
print(index, character, hex(ord(character)))

View File

@@ -1,26 +0,0 @@
project=Filli
year=2022
for month in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec; do
from="$(date +%F -d "$month 1, $year")"
to="$(date +%F -d "$month 1, $year + 1 month")"
watson report --json --from "$from" --to "$to" --project "$project"
done | jq --slurp '
def in_array($arr):
. as $value | any($arr[]; . == $value);
map(
["engadin-app","fysiweb","val-muestair","mia-engiadina","ol"] as $official_projects
| (.timespan.from | .[0:7]) as $timespan
| .projects | .[0]
| .time as $total_time
| .tags
| select(. != null)
| map(select(.name | in_array($official_projects)))
| (map(.time)|add) as $official_time
| map({key:.name, value:.time}) | from_entries
| .other |= ($total_time - $official_time)
| map_values(. / (60*60) | ceil)
| .month |= $timespan
)
'

View File

@@ -1,19 +0,0 @@
name: Update flake.lock
on:
workflow_dispatch: # allows manual triggering
schedule:
- cron: "0 0 * * 0" # runs weekly on Sunday at 00:00
jobs:
lockfile:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Nix
uses: cachix/install-nix-action@v16
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Update flake.lock
uses: DeterminateSystems/update-flake-lock@v3

View File

@@ -1,39 +0,0 @@
name: CI
on:
push:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
system: [makanek, manakish, kabsa, zaatar, ful, fatteh]
steps:
- uses: actions/checkout@v3
- name: Install QEMU (ARM)
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
if: ${{ matrix.system == 'ful' }}
- name: Install Nix (ARM)
uses: cachix/install-nix-action@v16
if: ${{ matrix.system == 'ful' }}
with:
extra_nix_config: |
system = aarch64-linux
- name: Install Nix (x86_64)
uses: cachix/install-nix-action@v16
if: ${{ matrix.system != 'ful' }}
- name: nixos-rebuild dry-build
run: |
# remove secrets: ref https://stackoverflow.com/questions/1260748/how-do-i-remove-a-submodule/36593218
git submodule deinit -f secrets
rm -rf .git/modules/secrets
git rm -f secrets
# recreate secrets
mkdir secrets
cat secrets.txt | while read -r path; do touch $path; done
git add secrets
nix run nixpkgs#nixos-rebuild -- dry-build --flake $GITHUB_WORKSPACE#${{matrix.system}}

6
.gitignore vendored
View File

@@ -1,6 +1,2 @@
secrets.nix
result
.direnv
.envrc
.history
.todo
node_modules

3
.gitmodules vendored
View File

@@ -1,3 +0,0 @@
[submodule "secrets"]
path = secrets
url = ssh://gitea@code.kmein.de:22022/kfm/niveum-secrets.git

View File

@@ -1,18 +0,0 @@
# niveum
> I must Create a System, or be enslav'd by another Man's. —William Blake
> [nĭvĕus](https://logeion.uchicago.edu/niveus), a, um, adj. [nix], _of_ or _from snow, snowy, snow-_ (poet.)
>
> 1. Lit.: aggeribus niveis informis, Verg. G. 3, 354: aqua, _cooled with snow_, Mart. 12, 17, 6; cf. id. 14, 104 and 117: mons, _covered with snow_, Cat. 64, 240.—
> 2. Transf., _snow-white, snowy_ (mostly poet.): a similitudine sic: Corpore niveum candorem, aspectu igneum ardorem assequebatur, Auct. Her. 4, 33, 44: lacerti, Verg. A. 8, 387: lac, id. E. 2, 20: hanc si capite niveae agnae exorari judicas, Sen. Q. N. 2, 36: Briseis niveo colore, Hor. C. 2, 4, 3: vestis, Ov. M. 10, 432: candidior nivei folio, Galatea, ligustri, id. ib. 13, 789: dens, id. H. 18, 18: quā notam duxit niveus videri, Hor. C. 4, 2, 59: panis, Juv. 5, 70: flumen, _clear, pellucid_, Sen. Hippol. 504: undae, Mart. 7, 32, 11: tribuni, _clothed in white togas_, Calp. Ecl. 7, 29; so, Quirites, Juv. 10, 45.
## Pressestimmen
> das ist ja pure poesie —[riotbib](https://github.com/riotbib/)
> Deine Configs sind wunderschön <3 —[flxai](https://github.com/flxai/)
## To do
🦗

BIN
art/.haskell-grey.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 KiB

BIN
art/file (1).jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
art/file.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

View File

@@ -1,127 +0,0 @@
{
pkgs,
lib,
...
}:
let
darwin = lib.strings.hasSuffix "-darwin" pkgs.stdenv.hostPlatform.system;
in
{
environment.systemPackages = [
pkgs.htop
pkgs.w3m
pkgs.wget
# ARCHIVE TOOLS
pkgs.unzip
pkgs.unrar
pkgs.p7zip
pkgs.sshuttle
pkgs.zip
# MONITORS
pkgs.iftop # interface bandwidth monitor
pkgs.lsof # list open files
# SHELL
pkgs.sqlite
pkgs.fd # better find
pkgs.tree
pkgs.parallel # for parallel, since moreutils shadows task spooler
pkgs.ripgrep # better grep
pkgs.rlwrap
pkgs.progress # display progress bars for pipes
pkgs.file # determine file type
pkgs.gdu # ncurses disk usage (ncdu is broken)
pkgs.rmlint # remove duplicate files
pkgs.jq # json toolkit
pkgs.jless # less(1) for json
pkgs.fq # toolkit for yaml, xml and binaries
pkgs.bc # calculator
pkgs.pari # gp -- better calculator
pkgs.ts
pkgs.vimv
pkgs.vg
pkgs.fkill
pkgs.cyberlocker-tools
pkgs.untilport
pkgs.kpaste
# HARDWARE
pkgs.pciutils # for lspci
]
++ lib.optionals (!darwin) [
pkgs.usbutils # for lsusb
pkgs.lshw # for lshw
pkgs.iotop # I/O load monitor
pkgs.psmisc # for killall, pstree
];
security.wrappers = {
pmount = {
setuid = true;
owner = "root";
group = "root";
source = "${pkgs.pmount}/bin/pmount";
};
pumount = {
setuid = true;
owner = "root";
group = "root";
source = "${pkgs.pmount}/bin/pumount";
};
};
environment.interactiveShellInit = ''
# Use XDG_RUNTIME_DIR for temporary files if available
if [ -d "$XDG_RUNTIME_DIR" ]; then
export TMPDIR="$XDG_RUNTIME_DIR"
fi
'';
environment.shellAliases =
let
take = pkgs.writers.writeDash "take" ''
mkdir "$1" && cd "$1"
'';
cdt = pkgs.writers.writeDash "cdt" ''
cd $(mktemp -p "$XDG_RUNTIME_DIR" -d "cdt-XXXXXX")
pwd
'';
wcd = pkgs.writers.writeDash "wcd" ''
cd "$(readlink "$(${pkgs.which}/bin/which --skip-alias "$1")" | xargs dirname)/.."
'';
where = pkgs.writers.writeDash "where" ''
readlink "$(${pkgs.which}/bin/which --skip-alias "$1")" | xargs dirname
'';
in
{
nixi = "nix repl nixpkgs";
take = "source ${take}";
wcd = "source ${wcd}";
where = "source ${where}";
# temporary files and directories
cdt = "source ${cdt}";
vit = "$EDITOR $(mktemp)";
# file safety
mv = "${pkgs.coreutils}/bin/mv --interactive";
rm = "${pkgs.coreutils}/bin/rm --interactive";
cp = "${pkgs.coreutils}/bin/cp --interactive";
# colours
cat = "${pkgs.bat}/bin/bat --theme=ansi --style=plain";
l = "${pkgs.coreutils}/bin/ls --color=auto --time-style=long-iso --almost-all";
ls = "${pkgs.coreutils}/bin/ls --color=auto --time-style=long-iso";
ll = "${pkgs.coreutils}/bin/ls --color=auto --time-style=long-iso -l";
la = "${pkgs.coreutils}/bin/ls --color=auto --time-style=long-iso --almost-all -l";
}
// (
if darwin then
{ }
else
{
"ß" = "${pkgs.util-linux}/bin/setsid";
ip = "${pkgs.iproute2}/bin/ip -c";
# systemd
s = "${pkgs.systemd}/bin/systemctl";
us = "${pkgs.systemd}/bin/systemctl --user";
j = "${pkgs.systemd}/bin/journalctl";
uj = "${pkgs.systemd}/bin/journalctl --user";
}
);
}

View File

@@ -1,333 +0,0 @@
{
pkgs,
config,
lib,
...
}:
{
age.secrets = {
email-password-ical-ephemeris = {
file = ../secrets/email-password-ical-ephemeris.age;
owner = config.users.users.me.name;
group = config.users.users.me.group;
mode = "400";
};
email-password-cock = {
file = ../secrets/email-password-cock.age;
owner = config.users.users.me.name;
group = config.users.users.me.group;
mode = "400";
};
email-password-posteo = {
file = ../secrets/email-password-posteo.age;
owner = config.users.users.me.name;
group = config.users.users.me.group;
mode = "400";
};
};
home-manager.users.me = {
accounts.email.maildirBasePath = "${config.users.users.me.home}/state/Maildir";
services.mbsync = {
enable = true;
frequency = "daily";
preExec = "${pkgs.coreutils}/bin/mkdir -p ${config.home-manager.users.me.accounts.email.maildirBasePath}";
postExec = "${pkgs.notmuch}/bin/notmuch new";
};
programs.notmuch = {
enable = true;
extraConfig = {
database.path = config.home-manager.users.me.accounts.email.maildirBasePath;
new.tags = "";
user.name = pkgs.lib.niveum.email.defaults.realName;
user.primary_email = config.home-manager.users.me.accounts.email.accounts.posteo.address;
};
};
programs.mbsync = {
enable = true;
extraConfig = lib.concatStringsSep "\n\n" (
lib.mapAttrsToList (name: account: ''
IMAPAccount ${name}
CertificateFile /etc/ssl/certs/ca-certificates.crt
Host ${account.imap.host}
PassCmd "${toString account.passwordCommand}"
User ${account.userName}
SSLType IMAPS
${lib.optionalString (lib.isInt account.imap.port) "Port ${toString account.imap.port}"}
IMAPStore ${name}-remote
Account ${name}
MaildirStore ${name}-local
Path ${config.home-manager.users.me.accounts.email.maildirBasePath}/${name}/
SubFolders Verbatim
Channel ${name}
Create Near
Expunge None
Far :${name}-remote:
Near :${name}-local:
Patterns *
Remove None
SyncState *
'') config.home-manager.users.me.accounts.email.accounts
);
};
accounts.email.accounts = {
cock =
let
mailhost = "mail.cock.li";
address = "2210@cock.li";
in
lib.recursiveUpdate pkgs.lib.niveum.email.defaults {
address = address;
userName = address;
passwordCommand = "${pkgs.coreutils}/bin/cat ${config.age.secrets.email-password-cock.path}";
realName = "2210";
imap.host = mailhost;
imap.port = 993;
smtp.host = mailhost;
smtp.port = 25;
smtp.tls.useStartTls = true;
};
ical-ephemeris =
let
address = "ical.ephemeris@web.de";
in
lib.recursiveUpdate pkgs.lib.niveum.email.defaults {
userName = address;
realName = "Kieran from iCal Ephemeris";
address = address;
passwordCommand = "${pkgs.coreutils}/bin/cat ${config.age.secrets.email-password-ical-ephemeris.path}";
imap.host = "imap.web.de";
imap.port = 993;
smtp.host = "smtp.web.de";
smtp.port = 587;
smtp.tls.useStartTls = true;
};
posteo =
let
mailhost = "posteo.de";
address = "kieran.meinhardt@posteo.net";
in
lib.recursiveUpdate pkgs.lib.niveum.email.defaults {
address = address;
aliases = [ "kmein@posteo.de" ];
userName = address;
imap.host = mailhost;
imap.port = 993;
imap.tls.enable = true;
smtp.host = mailhost;
smtp.port = 465;
smtp.tls.enable = true;
primary = true;
passwordCommand = "${pkgs.coreutils}/bin/cat ${config.age.secrets.email-password-posteo.path}";
himalaya = {
enable = true;
settings.backend = "imap";
};
aerc.extraAccounts.pgp-key-id = "9EDE82CC72A343A95266D0F444857074A3ACC8B7";
};
};
programs.himalaya.enable = true;
programs.thunderbird = {
enable = true;
settings = {
};
profiles.${pkgs.lib.niveum.email.thunderbirdProfile} = {
isDefault = true;
settings = {
"mail.default_send_format" = 1;
"msgcompose.default_colors" = false;
"msgcompose.text_color" = config.lib.stylix.colors.withHashtag.base00;
"msgcompose.background_color" = config.lib.stylix.colors.withHashtag.base05;
};
userChrome = '''';
userContent = '''';
withExternalGnupg = false;
};
};
programs.aerc = {
enable = true;
extraBinds = {
# Binds are of the form <key sequence> = <command to run>
# To use '=' in a key sequence, substitute it with "Eq": "<Ctrl+Eq>"
# If you wish to bind #, you can wrap the key sequence in quotes: "#" = quit
global = {
"<C-p>" = ":prev-tab<Enter>";
"<C-n>" = ":next-tab <Enter>";
"<C-t>" = ":term<Enter>";
"?" = ":help keys<Enter>";
};
messages = {
q = ":quit<Enter>";
j = ":next <Enter>";
"<Down>" = ":next<Enter>";
"<C-d>" = ":next 50%<Enter>";
"<C-f>" = ":next 100%<Enter>";
"<PgDn>" = ":next 100%<Enter>";
k = ":prev <Enter>";
"<Up>" = ":prev<Enter>";
"<C-u>" = ":prev 50%<Enter>";
"<C-b>" = ":prev 100%<Enter>";
"<PgUp>" = ":prev 100%<Enter>";
g = ":select 0 <Enter>";
G = ":select -1<Enter>";
J = ":next-folder <Enter>";
K = ":prev-folder<Enter>";
H = ":collapse-folder<Enter>";
L = ":expand-folder<Enter>";
"<space>" = ":read -t<Enter>:next<Enter>";
v = ":mark -t<Enter>";
V = ":mark -v<Enter>";
F = ":flag -t<Enter>";
T = ":toggle-threads<Enter>";
"<Enter>" = ":view<Enter>";
d = ":prompt 'Delete? ' 'delete-message'<Enter>";
D = ":move Trash<Enter>";
A = ":archive flat<Enter>";
C = ":compose<Enter>";
rr = ":reply -a<Enter>";
rq = ":reply -aq<Enter>";
Rr = ":reply<Enter>";
Rq = ":reply -q<Enter>";
c = ":cf<space>";
"$" = ":term<space>";
"!" = ":term<space>";
"|" = ":pipe<space>";
"/" = ":search<space>";
"\\" = ":filter <space>";
n = ":next-result<Enter>";
N = ":prev-result<Enter>";
"<Esc>" = ":clear<Enter>";
"*" = ":filter -x Flagged<Enter>";
};
view = {
tr = ":pipe ${pkgs.trans}/bin/trans -show-original n -b -no-autocorrect<Enter>"; # https://man.sr.ht/~rjarry/aerc/integrations/translator.md
"/" = ":toggle-key-passthrough <Enter> /";
q = ":close<Enter>";
O = ":open<Enter>";
S = ":save<space>";
"|" = ":pipe<space>";
D = ":move Trash<Enter>";
A = ":archive flat<Enter>";
"<C-l>" = ":open-link <space>";
f = ":forward <Enter>";
rr = ":reply -a<Enter>";
rq = ":reply -aq<Enter>";
Rr = ":reply<Enter>";
Rq = ":reply -q<Enter>";
H = ":toggle-headers<Enter>";
"<C-k>" = ":prev-part<Enter>";
"<C-j>" = ":next-part<Enter>";
J = ":next <Enter>";
K = ":prev<Enter>";
};
"view::passthrough" = {
"$noinherit" = "true";
"$ex" = "<C-x>";
"<Esc>" = ":toggle-key-passthrough<Enter>";
};
compose = {
# Keybindings used when the embedded terminal is not selected in the compose
# view
"$noinherit" = "true";
"$ex" = "<C-x>";
"<C-k>" = ":prev-field<Enter>";
"<C-j>" = ":next-field<Enter>";
"<tab>" = ":next-field<Enter>";
"<C-p>" = ":prev-tab<Enter>";
"<C-n>" = ":next-tab<Enter>";
};
"compose::editor" = {
# Keybindings used when the embedded terminal is selected in the compose view
"$noinherit" = "true";
"$ex" = "<C-x>";
"<C-k>" = ":prev-field<Enter>";
"<C-j>" = ":next-field<Enter>";
"<C-p>" = ":prev-tab<Enter>";
"<C-n>" = ":next-tab<Enter>";
};
"compose::review" = {
# Keybindings used when reviewing a message to be sent
y = ":send <Enter>";
n = ":abort<Enter>";
p = ":postpone<Enter>";
q = ":choose -o d discard abort -o p postpone postpone<Enter>";
e = ":edit<Enter>";
a = ":attach<space>";
d = ":detach<space>";
};
terminal = {
"$noinherit" = "true";
"$ex" = "<C-x>";
"<C-p>" = ":prev-tab<Enter>";
"<C-n>" = ":next-tab<Enter>";
};
};
extraConfig = {
ui.sort = "-r date";
ui.timestamp-format = "2006-01-02 15:04";
ui.mouse-enabled = true;
ui.spinner = ". , .";
general.unsafe-accounts-conf = true;
general.pgp-provider = "gpg";
viewer = {
pager = "${pkgs.less}/bin/less -R";
};
compose = {
# address-book-cmd = "khard email --remove-first-line --parsable '%s'";
no-attachment-warning = "(attach|attached|attachments?|anbei|Anhang|angehängt|beigefügt)";
};
filters = {
"text/plain" = "${pkgs.aerc}/libexec/aerc/filters/colorize";
"text/calendar" = "${pkgs.aerc}/libexec/aerc/filters/calendar";
"text/html" = "${pkgs.aerc}/libexec/aerc/filters/html"; # Requires w3m, dante
# "text/html" =
# "${pkgs.aerc}/share/aerc/filters/html | ${pkgs.aerc}/share/aerc/filters/colorize";
# "text/*" =
# ''${pkgs.bat}/bin/bat -fP --theme=ansi --file-name="$AERC_FILENAME "'';
"message/delivery-status" = "${pkgs.aerc}/libexec/aerc/filters/colorize";
"message/rfc822" = "${pkgs.aerc}/libexec/aerc/filters/colorize";
"application/x-sh" = "${pkgs.bat}/bin/bat -fP -l sh";
};
openers =
let
as-pdf = pkgs.writers.writeDash "as-pdf" ''
d=$(mktemp -p "$XDG_RUNTIME_DIR" -d)
trap clean EXIT
clean() {
rm -rf "$d"
}
${pkgs.libreoffice}/bin/libreoffice --headless --convert-to pdf "$1" --outdir "$d"
${pkgs.zathura}/bin/zathura "$d"/*.pdf
'';
in
{
"image/*" = "${pkgs.nsxiv}/bin/nsxiv";
"application/pdf" = "${pkgs.zathura}/bin/zathura";
"application/vnd.openxmlformats-officedocument.wordprocessingml.document" = toString as-pdf;
"application/vnd.oasis.opendocument.text" = toString as-pdf;
"video/*" = "${pkgs.mpv}/bin/mpv";
"audio/*" = "${pkgs.mpv}/bin/mpv";
};
};
templates = {
# new_message = "hello!";
};
};
};
}

View File

@@ -1,35 +0,0 @@
{
pkgs,
lib,
...
}:
let
in
{
environment.variables.TERMINAL = "alacritty";
home-manager.users.me = {
programs.alacritty = {
enable = true;
settings = {
keyboard.bindings = [
{
key = "Plus";
mods = "Control";
action = "IncreaseFontSize";
}
{
key = "Minus";
mods = "Control";
action = "DecreaseFontSize";
}
{
key = "Key0";
mods = "Control";
action = "ResetFontSize";
}
];
};
};
};
}

View File

@@ -1,5 +0,0 @@
{
programs.adb.enable = true;
users.users.me.extraGroups = [ "adbusers" ];
}

View File

@@ -1,52 +0,0 @@
{
pkgs,
config,
lib,
...
}:
{
services.restic.backups.niveum = {
initialize = true;
repository = pkgs.lib.niveum.restic.repository;
timerConfig = {
OnCalendar = "8:00";
RandomizedDelaySec = "1h";
};
passwordFile = config.age.secrets.restic.path;
extraBackupArgs = [
"--exclude=/home/kfm/sync/src/nixpkgs/.git"
"--exclude=node_modules"
"--exclude=.parcel-cache"
];
paths = [
"/home/kfm/sync"
"/home/kfm/state"
"/home/kfm/cloud"
"/home/kfm/mobile"
"/home/kfm/.gnupg"
"/home/kfm/.electrum"
"/home/kfm/.ssh"
];
};
systemd.services.restic-backups-niveum.serviceConfig = {
Restart = "on-failure";
RestartSec = "15s";
StartLimitIntervalSec = "1m"; # don't try more than 4 times
StartLimitBurst = 4;
};
environment.systemPackages = [
(pkgs.writers.writeDashBin "restic-niveum" ''
${pkgs.restic}/bin/restic -r ${pkgs.lib.niveum.restic.repository} -p ${config.age.secrets.restic.path} "$@"
'')
(pkgs.writers.writeDashBin "restic-mount" ''
mountdir=$(mktemp -p "$XDG_RUNTIME_DIR" -d "restic-mount-XXXXXXX")
trap clean EXIT
clean() {
rm -r "$mountdir"
}
${pkgs.restic}/bin/restic -r ${pkgs.lib.niveum.restic.repository} -p ${config.age.secrets.restic.path} mount "$mountdir"
'')
];
}

View File

@@ -1,10 +1,9 @@
{ pkgs, ... }:
{
programs.bash = {
promptInit = ''PS1="$(${pkgs.ncurses}/bin/tput bold)\w \$([[ \$? == 0 ]] && echo \"\[\033[1;32m\]\" || echo \"\[\033[1;31m\]\")\$$(${pkgs.ncurses}/bin/tput sgr0) "'';
promptInit = ''PS1="$(tput bold)\w \$([[ \$? == 0 ]] && echo \"\[\033[1;32m\]\" || echo \"\[\033[1;31m\]\")\$$(tput sgr0) "'';
interactiveShellInit = ''
set -o vi
'';
completion.enable = true;
enableCompletion = true;
};
}

View File

@@ -2,10 +2,15 @@
{
hardware.bluetooth = {
enable = true;
settings.general = {
enable = "Source,Sink,Media,Socket";
};
extraConfig = ''
[General]
Enable=Source,Sink,Media,Socket
'';
};
environment.systemPackages = [ pkgs.bluetuith ];
environment.systemPackages = [ pkgs.blueman ];
home-manager.users.me = {
services.blueman-applet.enable = true;
};
}

View File

@@ -1,26 +0,0 @@
{
config,
pkgs,
...
}:
{
niveum.bots.autorenkalender = {
enable = true;
time = "07:00";
telegram = {
enable = true;
tokenFile = config.age.secrets.telegram-token-kmein.path;
chatIds = [ "@autorenkalender" ];
parseMode = "Markdown";
};
command = "${pkgs.autorenkalender}/bin/autorenkalender";
};
niveum.passport.services = [
{
title = "Autorenkalender";
description = "sends <a href=\"https://www.projekt-gutenberg.org/\">Projekt Gutenberg</a>'s anniversary information to Telegram.";
link = "https://t.me/Autorenkalender";
}
];
}

View File

@@ -1,84 +0,0 @@
{
pkgs,
lib,
config,
...
}:
{
niveum.bots.celan = {
enable = true;
time = "08:00";
telegram = {
enable = true;
tokenFile = config.age.secrets.telegram-token-kmein.path;
chatIds = [ "@PaulCelan" ];
};
mastodon = {
enable = true;
tokenFile = config.age.secrets.mastodon-token-celan.path;
language = "de";
};
command = toString (
pkgs.writers.writePython3 "random-celan.py" { libraries = [ pkgs.python3Packages.lxml ]; } ''
from lxml import etree
import random
def xml_text(elements):
return "".join("".join(t.itertext()) for t in elements).strip()
tree = etree.parse('${
pkgs.fetchurl {
url = "http://c.krebsco.de/celan.tei.xml";
hash = "sha256-HgNmJYfhuwyfm+FcNtnnYWpJpIIU1ElHLeLiIFjF9mE=";
}
}')
root = tree.getroot()
tei = {"tei": "http://www.tei-c.org/ns/1.0"}
poems = root.xpath(".//tei:lg[@type='poem']", namespaces=tei)
poem = random.choice(poems)
for stanza in poem.xpath("./tei:lg[@type='stanza']", namespaces=tei):
for line in stanza.xpath('./tei:l', namespaces=tei):
if line.text:
print(line.text.strip())
print()
current_element = poem
while current_element is not None:
if current_element.tag == "{http://www.tei-c.org/ns/1.0}text":
text_element = current_element
title = xml_text(text_element.xpath("./tei:front/tei:docTitle",
namespaces=tei))
print(f"Aus: #{title.replace(" ", "_")}", end=" ")
if date := xml_text(text_element.xpath("./tei:front/tei:docDate",
namespaces=tei)):
print(f"({date})")
break
current_element = current_element.getparent()
print("\n\n#PaulCelan #Celan #Lyrik #poetry")
''
);
};
age.secrets = {
mastodon-token-celan.file = ../../secrets/mastodon-token-celan.age;
};
systemd.timers.bot-celan.timerConfig.RandomizedDelaySec = "10h";
niveum.passport.services = [
{
title = "Paul Celan Bot";
description = "sends a random poem by Paul Celan to Telegram.";
link = "https://t.me/PaulCelan";
}
];
}

View File

@@ -1,114 +0,0 @@
{
config,
pkgs,
...
}:
let
reverseDirectory = "/run/telegram-reverse";
proverbDirectory = "/run/telegram-proverb";
in
{
imports = [
./logotheca.nix
./transits.nix
./autorenkalender.nix
./hesychius.nix
./smyth.nix
./nachtischsatan.nix
# ./tlg-wotd.nix TODO reenable
./celan.nix
./nietzsche.nix
];
age.secrets = {
telegram-token-kmein.file = ../../secrets/telegram-token-kmein.age;
};
systemd.tmpfiles.rules =
map
(
path:
pkgs.lib.niveum.tmpfilesConfig {
type = "d";
mode = "0750";
age = "1h";
inherit path;
}
)
[
reverseDirectory
proverbDirectory
];
niveum.passport.services = [
{
title = "Rückwarts-Bot";
link = "https://t.me/RueckwaertsBot";
description = "reverses things on Telegram.";
}
{
title = "BetaCode-Bot";
link = "https://t.me/BetaCodeBot";
description = "converts <a href=\"https://en.wikipedia.org/wiki/Beta_Code\">beta code</a> to polytonic Greek on Telegram.";
}
{
title = "Sprichwortgenerator-Bot";
link = "https://t.me/SprichwortGeneratorBot";
description = "generates useless German proverbs with optional stock photo background on Telegram.";
}
];
age.secrets = {
telegram-token-reverse.file = ../../secrets/telegram-token-reverse.age;
telegram-token-betacode.file = ../../secrets/telegram-token-betacode.age;
telegram-token-proverb.file = ../../secrets/telegram-token-proverb.age;
telegram-token-streaming-link.file = ../../secrets/telegram-token-streaming-link.age;
};
systemd.services.telegram-reverse = {
wantedBy = [ "multi-user.target" ];
description = "Telegram reverse bot";
path = [ pkgs.ffmpeg ];
enable = true;
script = ''
TELEGRAM_BOT_TOKEN="$(cat "$CREDENTIALS_DIRECTORY/token")" ${pkgs.telebots}/bin/telegram-reverse
'';
serviceConfig.Restart = "always";
serviceConfig.WorkingDirectory = reverseDirectory;
serviceConfig.LoadCredential = "token:${config.age.secrets.telegram-token-reverse.path}";
};
systemd.services.telegram-streaming-link = {
wantedBy = [ "multi-user.target" ];
description = "Telegram bot converting YouTube Music <-> Spotify";
enable = true;
script = ''
TELEGRAM_BOT_TOKEN="$(cat "$CREDENTIALS_DIRECTORY/token")" ${pkgs.telebots}/bin/telegram-streaming-link
'';
serviceConfig.Restart = "always";
serviceConfig.LoadCredential = "token:${config.age.secrets.telegram-token-streaming-link.path}";
};
systemd.services.telegram-betacode = {
wantedBy = [ "multi-user.target" ];
description = "Telegram beta code bot";
enable = true;
script = ''
TELEGRAM_BOT_TOKEN="$(cat "$CREDENTIALS_DIRECTORY/token")" ${pkgs.telebots}/bin/telegram-betacode
'';
serviceConfig.Restart = "always";
serviceConfig.LoadCredential = "token:${config.age.secrets.telegram-token-betacode.path}";
};
systemd.services.telegram-proverb = {
wantedBy = [ "multi-user.target" ];
description = "Telegram proverb bot";
enable = true;
script = ''
TELEGRAM_BOT_TOKEN="$(cat "$CREDENTIALS_DIRECTORY/token")" ${pkgs.telebots}/bin/telegram-proverb
'';
serviceConfig.Restart = "always";
serviceConfig.WorkingDirectory = proverbDirectory;
serviceConfig.LoadCredential = "token:${config.age.secrets.telegram-token-proverb.path}";
};
}

View File

@@ -1,36 +0,0 @@
{
pkgs,
config,
...
}:
{
niveum.bots.hesychius = {
enable = true;
time = "08:00";
mastodon = {
enable = true;
language = "el";
tokenFile = config.age.secrets.mastodon-token-hesychius.path;
};
telegram = {
enable = true;
tokenFile = config.age.secrets.telegram-token-kmein.path;
chatIds = [ "@HesychiosAlexandreus" ];
};
command = "${pkgs.coreutils}/bin/shuf -n1 ${pkgs.hesychius}";
};
systemd.timers.bot-hesychius.timerConfig.RandomizedDelaySec = "10h";
age.secrets = {
mastodon-token-hesychius.file = ../../secrets/mastodon-token-hesychius.age;
};
niveum.passport.services = [
{
title = "Hesychius of Alexandria Bot";
description = "sends a random word from Hesychius of Alexandria's lexicon to Telegram.";
link = "https://t.me/HesychiosAlexandreus";
}
];
}

View File

@@ -1,37 +0,0 @@
{
pkgs,
config,
...
}:
{
niveum.bots.logotheca = {
enable = true;
time = "08/6:00";
telegram = {
enable = true;
tokenFile = config.age.secrets.telegram-token-kmein.path;
chatIds = [ "-1001760262519" ];
parseMode = "Markdown";
};
matrix = {
enable = true;
homeserver = "matrix.4d2.org";
tokenFile = config.age.secrets.matrix-token-lakai.path;
chatIds = [
"!zlwCuPiCNMSxDviFzA:4d2.org"
];
};
command = "${pkgs.literature-quote}/bin/literature-quote";
};
age.secrets = {
matrix-token-lakai.file = ../../secrets/matrix-token-lakai.age;
};
niveum.passport.services = [
{
title = "Literature quote bot";
description = "sends me and my friends three <a href=\"https://logotheca.xn--kiern-0qa.de/\">logotheca</a> quotes a day.";
}
];
}

View File

@@ -1,53 +0,0 @@
{
pkgs,
config,
lib,
...
}:
let
nachtischsatan-bot =
{ tokenFile }:
pkgs.writers.writePython3 "nachtischsatan-bot"
{
libraries = [ pkgs.python3Packages.python-telegram-bot ];
}
''
from telegram.ext import Application, ContextTypes, MessageHandler, filters
from telegram import Update
import random
import time
async def flubber(update: Update, context: ContextTypes.DEFAULT_TYPE):
time.sleep(random.randrange(4000) / 1000)
await update.message.reply_text("*flubberflubber*")
with open('${tokenFile}', 'r') as tokenFile:
token = tokenFile.read().strip()
application = Application.builder().token(token).build()
application.add_handler(MessageHandler(filters.ALL, flubber))
application.run_polling()
'';
in
{
systemd.services.telegram-nachtischsatan = {
wantedBy = [ "multi-user.target" ];
description = "*flubberflubber*";
enable = true;
script = toString (nachtischsatan-bot {
tokenFile = config.age.secrets.telegram-token-nachtischsatan.path;
});
serviceConfig.Restart = "always";
};
age.secrets.telegram-token-nachtischsatan.file = ../../secrets/telegram-token-nachtischsatan.age;
niveum.passport.services = [
{
title = "Nachtischsatan-Bot";
link = "https://t.me/NachtischsatanBot";
description = "*flubberflubber*";
}
];
}

View File

@@ -1,33 +0,0 @@
{
config,
pkgs,
...
}:
{
niveum.bots.nietzsche = {
enable = true;
time = "08:00";
mastodon = {
enable = true;
tokenFile = config.age.secrets.mastodon-token-nietzsche.path;
language = "de";
};
command = toString (
pkgs.writers.writeBash "random-nietzsche" ''
set -efu
random_number=$(( ($RANDOM % 10) + 1 ))
if [ "$random_number" -eq 1 ]; then
${pkgs.random-zeno}/bin/random-zeno "/Literatur/M/Nietzsche,+Friedrich"
else
${pkgs.random-zeno}/bin/random-zeno "/Philosophie/M/Nietzsche,+Friedrich"
fi
''
);
};
systemd.timers.bot-nietzsche.timerConfig.RandomizedDelaySec = "10h";
age.secrets = {
mastodon-token-nietzsche.file = ../../secrets/mastodon-token-nietzsche.age;
};
}

View File

@@ -1,72 +0,0 @@
{
config,
pkgs,
lib,
...
}:
{
niveum.bots.smyth = {
enable = true;
time = "08:00";
mastodon = {
enable = true;
tokenFile = config.age.secrets.mastodon-token-smyth.path;
language = "en";
};
telegram = {
enable = true;
tokenFile = config.age.secrets.telegram-token-kmein.path;
chatIds = [ "@HerbertWeirSmyth" ];
};
command = toString (
pkgs.writers.writeDash "random-smyth" ''
set -efu
good_curl() {
${pkgs.curl}/bin/curl "$@" \
--compressed \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \
-H 'Accept-Language: en-US,en;q=0.5' \
-H 'DNT: 1' \
-H 'Connection: keep-alive' \
-H 'Upgrade-Insecure-Requests: 1' \
-H 'Sec-Fetch-Dest: document' \
-H 'Sec-Fetch-Mode: navigate' \
-H 'Sec-Fetch-Site: cross-site' \
-H 'Priority: u=0, i' \
-H 'Pragma: no-cache' \
-H 'Cache-Control: no-cache'
}
RANDOM_SECTION=$(
good_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/"$//'
)
url="http://www.perseus.tufts.edu/hopper/text?doc=$RANDOM_SECTION"
good_curl -sSL "$url"\
| ${pkgs.htmlq}/bin/htmlq '#text_main' \
| ${pkgs.gnused}/bin/sed 's/<\/\?hr>//g' \
| ${pkgs.pandoc}/bin/pandoc -f html -t plain --wrap=none
printf '\n%s\n\n#AncientGreek' "$url"
''
);
};
systemd.timers.bot-smyth.timerConfig.RandomizedDelaySec = "10h";
age.secrets = {
mastodon-token-smyth.file = ../../secrets/mastodon-token-smyth.age;
};
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";
}
];
}

View File

@@ -1,176 +0,0 @@
{
pkgs,
config,
...
}:
let
mastodonEndpoint = "https://social.krebsco.de";
in
{
systemd.services.bot-tlg-wotd = {
# TODO reenable
# once https://github.com/NixOS/nixpkgs/pull/462893 is in stable NixOS
enable = true;
wants = [ "network-online.target" ];
startAt = "9:30";
path = [
pkgs.jq
pkgs.curl
pkgs.recode
pkgs.deno
pkgs.imagemagick
pkgs.gawk
pkgs.gnugrep
pkgs.coreutils
];
environment = {
NPM_CONFIG_CACHE = "/tmp";
CLTK_DATA = "/tmp";
};
script = ''
set -efux
chat_id=@tlgwotd
export TELEGRAM_TOKEN="$(cat "$CREDENTIALS_DIRECTORY/telegram-token")"
export MASTODON_TOKEN="$(cat "$CREDENTIALS_DIRECTORY/mastodon-token")"
json_data=$(curl -sSL http://stephanus.tlg.uci.edu/Iris/Wotd | recode html..utf8)
word=$(echo "$json_data" | jq -r '.word')
compact_word=$(echo "$word" | sed 's/,.*$//')
definition=$(echo "$json_data" | jq -r '.definition | sub("<.*>"; "") | rtrimstr(" ")')
first_occurrence=$(echo "$json_data" | jq -r '.firstOccurrence')
total_occurrences=$(echo "$json_data" | jq -r '.totalOccurrences')
telegram_caption="*$word* $definition
First occurrence (century): $first_occurrence
Number of occurrences (in all Ancient Greek texts): $total_occurrences"
mastodon_caption="$word $definition
First occurrence (century): $first_occurrence
Number of occurrences (in all Ancient Greek texts): $total_occurrences"
#ancientgreek #classics #wotd #wordoftheday
transliteration=$(${
pkgs.writers.writePython3 "translit.py"
{
libraries = py: [ py.cltk ];
}
''
import sys
from cltk.phonology.grc.transcription import Transcriber
probert = Transcriber("Attic", "Probert")
text = " ".join(sys.argv[1:])
ipa = probert.transcribe(text)
print(ipa)
''
} "$compact_word")
photo_path=/tmp/output.png
hex_to_rgb() {
hex="$1"
r=$(printf "%d" "0x$(echo "$hex" | cut -c2-3)")
g=$(printf "%d" "0x$(echo "$hex" | cut -c4-5)")
b=$(printf "%d" "0x$(echo "$hex" | cut -c6-7)")
echo "$r $g $b"
}
calculate_luminance() {
r="$1"
g="$2"
b="$3"
r_l=$(echo "$r" | awk '{print ($1 / 255 <= 0.03928) ? $1 / 255 / 12.92 : (($1 / 255 + 0.055) / 1.055)^2.4}')
g_l=$(echo "$g" | awk '{print ($1 / 255 <= 0.03928) ? $1 / 255 / 12.92 : (($1 / 255 + 0.055) / 1.055)^2.4}')
b_l=$(echo "$b" | awk '{print ($1 / 255 <= 0.03928) ? $1 / 255 / 12.92 : (($1 / 255 + 0.055) / 1.055)^2.4}')
echo "$r_l $g_l $b_l" | awk '{print 0.2126*$1 + 0.7152*$2 + 0.0722*$3}'
}
hex_color="#$(echo "$compact_word" | md5sum | cut -c 1-6)"
if echo "$hex_color" | grep -qE '^#[0-9A-Fa-f]{6}$'; then
set -- $(hex_to_rgb "$hex_color")
r="$1"
g="$2"
b="$3"
fi
luminance=$(calculate_luminance "$r" "$g" "$b")
threshold="0.1"
echo "$r $g $b"
if [ "$(echo "$luminance" | awk -v threshold="$threshold" '{print ($1 > threshold)}')" -eq 1 ]; then
color1="black"
color2="#333"
else
color1="white"
color2=lightgrey
fi
magick -size 1400x846 \
xc:"$hex_color" \
-font "${pkgs.gentium}/share/fonts/truetype/GentiumBookPlus-Bold.ttf" \
-fill "$color1" \
-pointsize 150 -gravity west \
-annotate +100-160 "$compact_word" \
-font "${pkgs.gentium}/share/fonts/truetype/GentiumBookPlus-Regular.ttf" \
-fill "$color2" \
-pointsize 60 -gravity west \
-annotate +100+00 "$transliteration" \
-fill "$color1" \
-annotate +100+120 "$definition" \
-fill "$color2" \
-pointsize 40 -gravity southwest \
-annotate +100+60 "attested $total_occurrences times" \
-pointsize 40 -gravity southeast \
-annotate +100+60 "$(date -I)" \
"$photo_path"
curl -X POST "https://api.telegram.org/bot$TELEGRAM_TOKEN/sendPhoto" \
-F "chat_id=\"$chat_id\"" \
-F "photo=@$photo_path" \
-F parse_mode=Markdown \
-F caption="$telegram_caption"
mastodon_upload_response=$(curl -X POST "${mastodonEndpoint}/api/v2/media" \
-H "Authorization: Bearer $MASTODON_TOKEN" \
-F "file=@$photo_path" \
-F "description=$word $definition")
mastodon_image_id=$(echo $mastodon_upload_response | jq -r .id)
curl -X POST "${mastodonEndpoint}/api/v1/statuses" \
-H "Authorization: Bearer $MASTODON_TOKEN" \
-d "status=$mastodon_caption" \
-d "visibility=public" \
-d "media_ids[]=$mastodon_image_id"
'';
serviceConfig = {
Type = "oneshot";
DynamicUser = true;
StateDirectory = "tlgwotd";
PrivateTmp = true;
LoadCredential = [
"telegram-token:${config.age.secrets.telegram-token-kmein.path}"
"mastodon-token:${config.age.secrets.mastodon-token-tlgwotd.path}"
];
};
};
age.secrets = {
mastodon-token-tlgwotd.file = ../../secrets/mastodon-token-tlgwotd.age;
};
niveum.passport.services = [
{
title = "Thesaurus Linguae Graecae Word of the Day";
description = "sends <a href=\"https://stephanus.tlg.uci.edu/\">TLG</a>'s word of the day to Telegram.";
link = "https://t.me/tlgwotd";
}
];
}

View File

@@ -1,76 +0,0 @@
{
config,
pkgs,
lib,
...
}:
let
toSymbols = pkgs.writers.writeDash "to-symbols" ''
${pkgs.gnused}/bin/sed '
s/\bTri\b//;
s/\bOpp\b//;
s/\bSqu\b//;
s/\bSex\b//;
s/\bCon\b//;
s/Sun//g;
s/Moon//g;
s/Mercury//g;
s/Venus//g;
s/Mars//g;
s/Jupiter//g;
s/Saturn//g;
s/Uranus//g;
s/Neptune//g;
s/Pluto//g;
s/North Node//g;
s/\bLeo\b//g;
s/\bCan\(cer\)\?\b//g;
s/\bGem\(ini\)\?\b//g;
s/\bVir\(go\)\?\b//g;
s/\bLib\(ra\)\?\b//g;
s/\bTau\(rus\)\?\b//g;
s/\bAri\(es\)\?\b//g;
s/\bSco\(rpio\)\?\b//g;
s/\bPis\(ces\)\?\b//g;
s/\bSag\(ittarius\)\?\b//g;
s/\bAqu\(arius\)\?\b//g;
s/\bCap\(ricorn\)\?\b//g;
s/-->//g;
s/\s\+/ /g; # replace multiple spaces by one
s/^.*\([ 0-9]\{2\}:[0-9]\{2\}\) /\1 /; # remove date at beginning of line (but not everything up to v/c X:XX)
s/^\s*//
'
'';
in
{
niveum.bots.transits = {
enable = true;
time = "*:0/1";
mastodon = {
enable = true;
tokenFile = config.age.secrets.mastodon-token-transits.path;
};
telegram = {
enable = true;
tokenFile = config.age.secrets.telegram-token-kmein.path;
chatIds = [ "-1001796440545" ];
};
command = toString (
pkgs.writers.writeDash "common-transits" ''
set -efu
now=$(${pkgs.coreutils}/bin/date +%_H:%M | ${pkgs.gnused}/bin/sed 's/^\s*//')
date=$(${pkgs.coreutils}/bin/date +'%m %d %Y')
(
cd ${pkgs.astrolog}/bin
# ./astrolog -Yt -Yd -q 10 22 1999 6:32 -zN Kassel -td $date -R Uranus Neptune Pluto "North Node"
./astrolog -qd $date -zN Berlin -Yt -Yd -d -R Uranus Neptune Pluto "North Node" -A 2
) | ${toSymbols} | ${pkgs.coreutils}/bin/sort -n | ${pkgs.gnugrep}/bin/grep "^$now" || :
''
);
};
age.secrets = {
mastodon-token-transits.file = ../../secrets/mastodon-token-transits.age;
};
}

View File

@@ -1,92 +0,0 @@
{
config,
pkgs,
...
}:
{
environment.systemPackages = [
pkgs.cro
pkgs.tor-browser
pkgs.firefox
pkgs.brave
];
home-manager.users.me = {
programs.firefox = {
enable = true;
profiles =
let
defaultSettings = {
"beacon.enabled" = false;
"browser.bookmarks.showMobileBookmarks" = true;
"browser.newtab.preload" = false;
"browser.search.isUS" = false;
"browser.search.region" = "DE";
"browser.send_pings" = false;
"browser.shell.checkDefaultBrowser" = false;
"browser.startup.homepage" = "chrome://browser/content/blanktab.html";
"browser.uidensity" = 1;
"browser.urlbar.placeholderName" = "Search";
"datareporting.healthreport.service.enabled" = false;
"datareporting.healthreport.uploadEnabled" = false;
"datareporting.policy.dataSubmissionEnabled" = false;
"datareporting.sessions.current.clean" = true;
"distribution.searchplugins.defaultLocale" = "de-DE";
"general.smoothScroll" = true;
"identity.fxaccounts.account.device.name" = config.networking.hostName;
"network.cookie.cookieBehavior" = 1;
"privacy.donottrackheader.enabled" = true;
"privacy.trackingprotection.enabled" = true;
"privacy.trackingprotection.pbmode.enabled" = true;
"privacy.trackingprotection.socialtracking.enabled" = true;
"services.sync.declinedEngines" = "passwords";
"services.sync.engine.passwords" = false;
"signon.autofillForms" = false;
"signon.rememberSignons" = false;
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"toolkit.telemetry.archive.enabled" = false;
"toolkit.telemetry.bhrPing.enabled" = false;
"toolkit.telemetry.cachedClientID" = "";
"toolkit.telemetry.enabled" = false;
"toolkit.telemetry.firstShutdownPing.enabled" = false;
"toolkit.telemetry.hybridContent.enabled" = false;
"toolkit.telemetry.newProfilePing.enabled" = false;
"toolkit.telemetry.prompted" = 2;
"toolkit.telemetry.rejected" = true;
"toolkit.telemetry.server" = "";
"toolkit.telemetry.shutdownPingSender.enabled" = false;
"toolkit.telemetry.unified" = false;
"toolkit.telemetry.unifiedIsOptIn" = false;
"toolkit.telemetry.updatePing.enabled" = false;
"ui.prefersReducedMotion" = 1;
};
in
{
default = {
id = 0;
isDefault = true;
settings = defaultSettings;
# extensions = with pkgs.nur.repos.rycee.firefox-addons; [
# ublock-origin
# darkreader
# sponsorblock
# consent-o-matic
# i-dont-care-about-cookies
# # auto-tab-discard TODO what is this
# ];
userChrome = ''
#TabsToolbar {
visibility: collapse !important;
}
'';
};
};
};
};
home-manager.users.me = {
stylix.targets.firefox.profileNames = [ "default" ];
};
environment.variables.BROWSER = "firefox";
}

View File

@@ -1,38 +0,0 @@
{ pkgs, ... }:
{
networking.networkmanager.ensureProfiles.profiles = {
"39C3" = {
connection = {
id = "39C3";
type = "wifi";
};
wifi = {
mode = "infrastructure";
ssid = "39C3";
};
wifi-security = {
auth-alg = "open";
key-mgmt = "wpa-eap";
};
"802-1x" = {
anonymous-identity = "39C3";
eap = "ttls;";
identity = "39C3";
password = "39C3";
phase2-auth = "pap";
altsubject-matches = "DNS:radius.c3noc.net";
ca-cert = "${builtins.fetchurl {
url = "https://letsencrypt.org/certs/isrgrootx1.pem";
sha256 = "sha256:1la36n2f31j9s03v847ig6ny9lr875q3g7smnq33dcsmf2i5gd92";
}}";
};
ipv4 = {
method = "auto";
};
ipv6 = {
addr-gen-mode = "default";
method = "auto";
};
};
};
}

17
configs/chromium.nix Normal file
View File

@@ -0,0 +1,17 @@
{ pkgs, ... }:
{
programs.chromium = {
enable = true;
extensions = [
"hdokiejnpimakedhajhdlcegeplioahd" # LastPass
"ihlenndgcmojhcghmfjfneahoeklbjjh" # cVim
"fpnmgdkabkmnadcjpehmlllkndpkmiak" # Wayback Machine
"cjpalhdlnbpafiamejdnhcphjbkeiagm" # uBlock Origin
"iaalpfgpbocpdfblpnhhgllgbdbchmia" # asciidoctor
];
};
environment.systemPackages = [ pkgs.chromium ];
niveum.applications.browser = "chromium";
}

View File

@@ -1,8 +0,0 @@
{
config,
pkgs,
...
}:
{
services.clipmenu.enable = true;
}

View File

@@ -1,169 +1,48 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
{
systemd.user.services.systemd-tmpfiles-clean = {
enable = true;
wantedBy = [ "default.target" ];
startAt = "daily";
script = "systemd-tmpfiles --user --clean";
serviceConfig = {
Type = "oneshot";
};
};
systemd.user.tmpfiles.users.me.rules =
map pkgs.lib.niveum.tmpfilesConfig [
{
type = "d";
mode = "0755";
age = "7d";
path = "${config.users.users.me.home}/sync/Downloads";
}
{
type = "d";
mode = "0755";
age = "7d";
path = "${config.users.users.me.home}/cloud/nextcloud/tmp";
}
]
++
map
(
path:
pkgs.lib.niveum.tmpfilesConfig {
type = "L+";
user = config.users.users.me.name;
group = config.users.users.me.group;
mode = "0755";
argument = "${config.users.users.me.home}/sync/${path}";
path = "${config.users.users.me.home}/${path}";
}
)
[
".ssh"
".gnupg"
".pki"
".local/share/aerc"
];
services.gnome.gnome-keyring.enable = true;
security.pam.services.lightdm.enableGnomeKeyring = true;
home-manager.users.me = {
services.nextcloud-client = {
enable = true;
startInBackground = true;
};
};
systemd.user.services.nextcloud-syncer = {
enable = false;
wants = [ "network-online.target" ];
wantedBy = [ "default.target" ];
startAt = "*:00/10";
script =
let
kieran = {
user = "kieran";
passwordFile = config.age.secrets.nextcloud-password-kieran.path;
endpoint = "https://cloud.kmein.de";
target = "${config.users.users.me.home}/notes";
};
in
''
mkdir -p ${lib.escapeShellArg kieran.target}
${pkgs.nextcloud-client}/bin/nextcloudcmd --non-interactive --user ${kieran.user} --password "$(cat ${kieran.passwordFile})" --path /Notes ${lib.escapeShellArg kieran.target} ${kieran.endpoint}
'';
serviceConfig = {
Type = "oneshot";
Restart = "on-failure";
};
};
environment.systemPackages = [
(pkgs.writers.writeDashBin "book" ''
set -efu
book="$({
${pkgs.findutils}/bin/find ${config.users.users.me.home}/cloud/syncthing/library -type f
${pkgs.findutils}/bin/find ${config.users.users.me.home}/cloud/nextcloud/Books -type f
} | ${pkgs.fzf}/bin/fzf)"
exec ${pkgs.zathura}/bin/zathura "$book"
'')
(
let
kieran = {
user = "kieran.meinhardt@gmail.com";
passwordFile = config.age.secrets.mega-password.path;
};
megatools =
command:
''${pkgs.megatools}/bin/megatools ${command} --username ${lib.escapeShellArg kieran.user} --password "$(cat ${kieran.passwordFile})"'';
in
pkgs.writers.writeDashBin "book-mega" ''
set -efu
selection="$(${megatools "ls"} | ${pkgs.fzf}/bin/fzf)"
test -n "$selection" || exit 1
tmpdir="$(mktemp -p "$XDG_RUNTIME_DIR" -d)"
trap clean EXIT
clean() {
rm -rf "$tmpdir"
}
(
cd "$tmpdir"
${megatools "get"} "$selection"
exec ${pkgs.zathura}/bin/zathura "$(basename "$selection")"
)
''
)
imports = [
<modules/seafile.nix>
<modules/google-drive.nix>
<modules/dropbox.nix>
<stockholm/krebs/3modules/syncthing.nix>
];
age.secrets.mega-password = {
file = ../secrets/mega-password.age;
owner = config.users.users.me.name;
group = config.users.users.me.group;
mode = "400";
niveum.dropbox = {
enable = true;
user = config.users.users.me;
};
services.syncthing = {
niveum.seafile = {
enable = true;
user = config.users.users.me;
};
niveum.google-drive = rec {
enable = true;
directory = "${user.home}/cloud/gdrive";
user = config.users.users.me;
};
services.syncthing = rec {
enable = true;
user = "kfm";
openDefaultPorts = true;
configDir = "/home/kfm/.config/syncthing";
dataDir = "/home/kfm/.config/syncthing";
cert = config.age.secrets.syncthing-cert.path;
key = config.age.secrets.syncthing-key.path;
settings = {
devices = pkgs.lib.niveum.syncthingIds;
folders = {
"${config.users.users.me.home}/sync" = {
devices = [
"kabsa"
"manakish"
"fatteh"
];
label = "sync";
versioning.type = "trashcan";
versioning.params.cleanoutDays = 100;
};
"${config.users.users.me.home}/mobile" = {
devices = [
"kabsa"
"manakish"
"fatteh"
"kibbeh"
];
id = "mobile";
label = "mobile";
versioning.type = "trashcan";
versioning.params.cleanoutDays = 100;
};
};
};
krebs.syncthing = rec {
enable = true;
key = toString <secrets/syncthing/key.pem>;
cert = toString <secrets/syncthing/cert.pem>;
peers = {
homeros.id = "HSOL72W-MMN346W-C3WCWCH-OTRKJYG-MY2WWV6-P7JUHN7-5WYYYRV-ZMH4KAA";
scardanelli.id = "7CZYHEX-3CSFDQU-PEEMYHG-6XGQ2ZD-KGVUWH5-GFRB2XK-FP57ERX-7APZUQU";
rilke.id = "NYNNHXP-7JMSTXG-SVNOPWD-RWXCCCL-CBOVBEI-X4QPLF4-NJA5G2P-RSGYRQQ";
wilde.id = "R6DEBD7-G5RYDKN-VFA3HPO-WX4DNVI-373F7OQ-AW5MZTT-3L4BDVW-Y6ROEAF";
};
folders."${config.users.users.me.home}/cloud/syncthing/common".peers = [ "homeros" "scardanelli" "wilde" ];
folders."${config.users.users.me.home}/cloud/syncthing/library".peers = lib.attrNames peers;
folders."${config.users.users.me.home}/cloud/syncthing/mundoiu".peers = lib.attrNames peers;
};
}

8
configs/compton.nix Normal file
View File

@@ -0,0 +1,8 @@
{
services.compton = {
enable = true;
shadow = true;
menuOpacity = "0.9";
shadowOpacity = "0.3";
};
}

View File

@@ -1,264 +1,273 @@
{
pkgs,
lib,
config,
...
}:
let
inherit (lib.strings) makeBinPath;
in
{ pkgs, lib, config, ... }:
{
imports = [
<modules/constants.nix>
{
boot.supportedFilesystems = [ "ntfs" ];
services.dbus.packages = [ pkgs.gnome3.dconf ];
}
<home-manager/nixos>
# <configs/mopidy.nix>
<configs/bash.nix>
<configs/bluetooth.nix>
<configs/chromium.nix>
<configs/cloud.nix>
<configs/compton.nix>
<configs/default.nix>
# <configs/home-assistant.nix>
<configs/distrobump.nix>
<configs/docker.nix>
<configs/dunst.nix>
<configs/fonts.nix>
<configs/git.nix>
<configs/haskell>
<configs/hledger.nix>
<configs/htop.nix>
<configs/hu-berlin.nix>
<configs/i3.nix>
<configs/kdeconnect.nix>
<configs/keybase.nix>
<configs/keyboard.nix>
<configs/mail.nix>
<configs/mpv.nix>
<configs/nano.nix>
<configs/neovim.nix>
<configs/nixpkgs-unstable.nix>
<configs/packages>
<configs/printing.nix>
<configs/python.nix>
<configs/random-background.nix>
<configs/redshift.nix>
<configs/retiolum.nix>
<configs/rofi.nix>
<configs/sncli.nix>
<configs/ssh.nix>
<configs/sudo.nix>
<configs/themes/owickstrom-dark.nix>
<configs/theming.nix>
<configs/tmux.nix>
<configs/todo-txt.nix>
<configs/traadfri.nix>
<configs/unclutter.nix>
<configs/urxvt.nix>
<configs/vscode.nix>
<configs/xautolock.nix>
<configs/xresources.nix>
<configs/zsh.nix>
{
niveum.user = {
github = "kmein";
email = "kieran.meinhardt@gmail.com";
name = "Kierán Meinhardt";
};
niveum.applications = rec {
fileManager = "${config.niveum.applications.terminal} -e ${pkgs.ranger}/bin/ranger";
};
niveum.theme = {
gtk = { name = "Arc"; package = pkgs.arc-theme; };
icon = { name = "Arc"; package = pkgs.arc-icon-theme; };
cursor = { name = "capitaine-cursors"; package = pkgs.capitaine-cursors; };
};
}
{
nixpkgs = {
config = {
allowUnfree = true;
packageOverrides = pkgs: {
dmenu = pkgs.writers.writeDashBin "dmenu" ''exec ${pkgs.rofi}/bin/rofi -dmenu "$@"'';
nixpkgs.config = {
allowUnfree = true;
packageOverrides = pkgs: {
python3Packages = pkgs.python3Packages.override {
overrides = new: old: {
spotify-cli-linux = new.callPackage <packages/spotify-cli-linux.nix> {};
instaloader = new.callPackage <packages/instaloader.nix> {};
sncli = new.callPackage <packages/sncli.nix> {};
};
};
haskellPackages = pkgs.haskellPackages.override {
overrides = new: old: {
blessings = new.callPackage <packages/blessings.nix> {};
scanner = new.callPackage <stockholm/krebs/5pkgs/haskell/scanner.nix> {};
};
};
git-quick-stats = pkgs.callPackage <packages/git-quick-stats.nix> {};
writeDash = pkgs.writers.writeDash;
writeDashBin = pkgs.writers.writeDashBin;
iolanguage = pkgs.callPackage <packages/iolanguage.nix> {};
nix-git = pkgs.callPackage <packages/nix-git.nix> {};
kmein = {
autorenkalender = pkgs.callPackage <packages/autorenkalender.nix> {};
bvg = pkgs.callPackage <packages/bvg.nix> {};
daybook = pkgs.callPackage <packages/daybook.nix> {};
font-size = pkgs.callPackage <packages/font-size.nix> { font = config.niveum.fonts.terminal; };
genius = pkgs.callPackage <packages/genius.nix> {};
instaget = pkgs.callPackage <packages/instaget.nix> {};
literature-quote = pkgs.callPackage <packages/literature-quote.nix> {};
n = pkgs.callPackage <packages/n.nix> {};
depp = pkgs.callPackage <packages/depp.nix> {};
odyssey = pkgs.callPackage <packages/odyssey.nix> {};
wttr = pkgs.callPackage <packages/wttr.nix> {};
nav = pkgs.callPackage <packages/nav.nix> {};
slide =
let slide-package = pkgs.fetchFromGitHub {
owner = "kmein";
repo = "slide";
rev = "0470583d22212745eab4f46076267addf4d2346c";
sha256 = "0skcp3va9v4hmxy5ramghpz53gnyxv10wsacgmc2jr0v1wrqlzbh";
};
in pkgs.callPackage slide-package {};
haskellPackages.mnemosyne =
let mnemosyne-package = pkgs.fetchFromGitHub {
repo = "mnemosyne";
owner = "kmein";
rev = "6bfa13c88db176af80be90840ff03573d67d679f";
sha256 = "1rimv5c5q9602y501hbkgkfbimqnmdkcr5hp1434q06gcazhjhca";
};
in pkgs.haskellPackages.callPackage mnemosyne-package {};
};
permittedInsecurePackages = [
];
};
};
}
{
boot.tmp.cleanOnBoot = true;
boot.cleanTmpDir = true;
boot.loader.timeout = 1;
boot.extraModulePackages = [ config.boot.kernelPackages.exfat-nofuse ];
}
{
age.secrets = {
di-fm-key = {
file = ../secrets/di-fm-key.age;
owner = config.users.users.me.name;
group = config.users.users.me.group;
mode = "400";
};
restic = {
file = ../secrets/restic.age;
owner = config.users.users.me.name;
group = config.users.users.me.group;
mode = "400";
};
};
time.timeZone = "Europe/Berlin";
}
{
home-manager.users.me = {
programs.zathura = {
enable = true;
options = {
selection-clipboard = "clipboard";
# first-page-column = "1:1"; # makes side-by-side mode start on the left side
};
options.selection-clipboard = "clipboard";
};
};
}
{
users.mutableUsers = false;
users.defaultUserShell = pkgs.zsh;
users.users.me = {
name = "kfm";
description = pkgs.lib.niveum.kieran.name;
hashedPasswordFile = config.age.secrets.kfm-password.path;
isNormalUser = true;
uid = 1000;
extraGroups = [
"pipewire"
"audio"
];
};
nix.settings.trusted-users = [ config.users.users.me.name ];
age.secrets = {
kfm-password.file = ../secrets/kfm-password.age;
};
home-manager.users.me.xdg.enable = true;
}
{
environment.interactiveShellInit = "export PATH=$PATH";
environment.shellAliases =
let
swallow = command: "${pkgs.swallow}/bin/swallow ${command}";
in
{
o = "${pkgs.xdg-utils}/bin/xdg-open";
ns = "nix-shell --run zsh";
pbcopy = "${pkgs.xclip}/bin/xclip -selection clipboard -in";
pbpaste = "${pkgs.xclip}/bin/xclip -selection clipboard -out";
tmux = "${pkgs.tmux}/bin/tmux -2";
sxiv = swallow "${pkgs.nsxiv}/bin/nsxiv";
zathura = swallow "${pkgs.zathura}/bin/zathura";
im = "${pkgs.openssh}/bin/ssh weechat@makanek -t tmux attach-session -t IM";
yt = "${pkgs.yt-dlp}/bin/yt-dlp --add-metadata -ic"; # Download video link
yta = "${pkgs.yt-dlp}/bin/yt-dlp --add-metadata --audio-format mp3 --audio-quality 0 -xic"; # Download with audio
};
}
{
i18n = {
defaultLocale = "en_DK.UTF-8";
supportedLocales = [ "all" ];
description = config.niveum.user.name;
home = "/home/kfm";
createHome = true;
group = "users";
hashedPassword = "$6$w9hXyGFl/.IZBXk$5OiWzS1G.5hImhh1YQmZiCXYNAJhi3X6Y3uSLupJNYYXPLMsQpx2fwF4Xr2uYzGMV8Foqh8TgUavx1APD9rcb/";
shell = pkgs.zsh;
};
}
{
services.displayManager = {
autoLogin = {
enable = true;
user = config.users.users.me.name;
sound.enable = true;
hardware.pulseaudio = {
enable = true;
package = pkgs.pulseaudioFull; # for bluetooth sound output
};
users.users.me.extraGroups = [ "audio" ];
environment.systemPackages = [ pkgs.pavucontrol pkgs.pamixer ];
}
{
environment.systemPackages = [
(pkgs.writers.writeDashBin "niveum-deploy" ''
NIVEUM_DIR=/home/kfm/prog/git/niveum
[ $# -eq 1 ] || echo >&2 "Usage: niveum-deploy SYSTEM"
eval $(nix-build --no-out-link "$NIVEUM_DIR/deploy.nix" -A "$1")
'')
(pkgs.writers.writeDashBin "niveum-update" ''
NIVEUM_DIR=/home/kfm/prog/git/niveum
nix-prefetch-git --url https://github.com/NixOS/nixpkgs-channels --rev refs/heads/nixos-${config.system.stateVersion} > "$NIVEUM_DIR/nixpkgs.json"
'')
];
}
{
environment.interactiveShellInit = "export PATH=$PATH:$HOME/.cargo/bin";
environment.shellAliases = {
clipboard = "${pkgs.xclip}/bin/xclip -se c";
o = "${pkgs.xdg_utils}/bin/xdg-open";
tmux = "${pkgs.tmux}/bin/tmux -2";
ip = "${pkgs.iproute}/bin/ip -c";
ns = "nix-shell --run zsh";
nixi = ''nix repl "<nixpkgs>"'';
rm = "rm -i";
cp = "cp -i";
mv = "mv -i";
l = "${pkgs.exa}/bin/exa -a";
ls = "${pkgs.exa}/bin/exa";
ll = "${pkgs.exa}/bin/exa -l";
la = "${pkgs.exa}/bin/exa -la";
dig = "dig +short";
};
}
{
networking.wireless = {
enable = true;
userControlled.enable = true;
networks = {
"Aether".pskRaw = "e1b18af54036c5c9a747fe681c6a694636d60a5f8450f7dec0d76bc93e2ec85a";
"Asoziales Netzwerk".pskRaw = "8e234041ec5f0cd1b6a14e9adeee9840ed51b2f18856a52137485523e46b0cb6";
"EasyBox-927376".pskRaw = "dbd490ab69b39bd67cfa06daf70fc3ef3ee90f482972a668ed758f90f5577c22";
"FlixBus Wi-Fi" = {};
"FlixBus" = {};
"FlixTrain" = {};
"Libertarian WiFi".pskRaw = "e9beaae6ffa55d10e80b8a2e7d997411d676a3cc6f1f29d0b080391f04555050";
"Ni/Schukajlow".pskRaw = "ffc47f6829da59c48aea878a32252223303f5c47a3859edc90971ffc63346781";
"WIFIonICE" = {};
"WLAN-914742".psk = "67647139648174545446";
"WLAN-XVMU6T".pskRaw = "46ea807283255a3d7029233bd79c18837df582666c007c86a8d591f65fae17cc";
"c-base-public" = {};
"discord".psk = "baraustrinken";
"security-by-obscurity".psk = "44629828256481964386";
};
};
environment.systemPackages = [ pkgs.wpa_supplicant_gui ];
}
{
networking.hosts = {
"192.168.178.1" = [ "fritz.box" ];
"192.168.178.21" = [ "scardanelli" ];
"192.168.178.22" = [ "homeros" ];
"192.168.178.24" = [ "catullus" ];
};
}
{
i18n.defaultLocale = "en_GB.UTF-8";
}
{
services.illum.enable = true;
}
{
services.xserver = {
enable = true;
displayManager.lightdm = {
enable = true;
autoLogin.enable = true;
autoLogin.user = config.users.users.me.name;
greeters.gtk = {
enable = true;
indicators = [
"~spacer"
"~host"
"~spacer"
"~session"
"~power"
];
indicators = [ "~spacer" "~host" "~spacer" "~session" "~power" ];
};
};
desktopManager.default = "none";
};
}
{
programs.gnupg = {
agent = {
enable = true;
pinentryPackage = pkgs.pinentry-qt;
settings =
let
defaultCacheTtl = 2 * 60 * 60;
in
{
default-cache-ttl = defaultCacheTtl;
max-cache-ttl = 4 * defaultCacheTtl;
};
};
};
environment.systemPackages = [
pkgs.gnupg
(pkgs.pass.withExtensions (e: [
e.pass-otp
e.pass-import
e.pass-genphrase
]))
];
}
{
services.atd.enable = true;
}
{
services.getty = {
greetingLine = lib.mkForce "As-salamu alaykum wa rahmatullahi wa barakatuh!";
helpLine = lib.mkForce "";
security.wrappers = {
pmount.source = "${pkgs.pmount}/bin/pmount";
pumount.source = "${pkgs.pmount}/bin/pumount";
};
}
{
networking.hosts = lib.mapAttrs' (name: address: {
name = address;
value = [ "${name}.local" ];
}) pkgs.lib.niveum.localAddresses;
programs.command-not-found.enable = true;
}
{
home-manager.users.me.home.stateVersion = "22.05";
home-manager.backupFileExtension = "bak";
}
{
systemd.user.services.udiskie = {
after = [ "udisks2.service" ];
wants = [ "udisks2.service" ];
wantedBy = [ "graphical-session.target" ];
serviceConfig = {
ExecStart = "${pkgs.udiskie}/bin/udiskie --verbose --no-config --notify";
};
};
services.udisks2.enable = true;
programs.dconf.enable = true;
home-manager.users.me = {
dconf.enable = true;
dconf.settings = {
# Change the default terminal for Nemo
"org/cinnamon/desktop/applications/terminal".exec = lib.getExe pkgs.niveum-terminal;
};
};
}
./android.nix
./stylix.nix
./alacritty.nix
./backup.nix
./bash.nix
./bluetooth.nix
./aerc.nix
./khal.nix
./browser.nix
./clipboard.nix
./cloud.nix
./direnv.nix
./docker.nix
./dunst.nix
./fonts.nix
./fzf.nix
./git.nix
./hledger.nix
./htop.nix
./uni.nix
./i3.nix
./i3status-rust.nix
./keyboard
./kdeconnect.nix
{ services.upower.enable = true; }
./lb.nix
./mpv.nix
./mime.nix
./neovim.nix
./newsboat.nix
./flameshot.nix
./packages.nix
./virtualization.nix
./stardict.nix
./polkit.nix
./printing.nix
./redshift.nix
./rofi.nix
./ssh.nix
./sound.nix
./sudo.nix
./tmux.nix
./unclutter.nix
./vscode.nix
./wallpaper.nix
./zsh.nix
{
home-manager.users.me.home.file.".zshrc".text = ''
# nothing to see here
'';
}
{
home-manager.users.me = {
xdg.userDirs =
let
pictures = "${config.users.users.me.home}/cloud/nextcloud/Bilder";
in
{
enable = true;
documents = "${config.users.users.me.home}/cloud/nextcloud/Documents";
desktop = "/tmp";
download = "${config.users.users.me.home}/sync/Downloads";
music = "${config.users.users.me.home}/mobile/audio";
publicShare = "${config.users.users.me.home}/cloud/nextcloud/tmp";
videos = pictures;
pictures = pictures;
};
programs.java = {
enable = true;
package = pkgs.openjdk;
};
}
];

View File

@@ -1,42 +0,0 @@
{ pkgs, ... }:
let
nixify = pkgs.writers.writeDashBin "nixify" ''
set -efuC
if [ ! -e ./.envrc ]; then
echo use_nix > .envrc
direnv allow
fi
if [ ! -e shell.nix ]; then
cat > shell.nix <<'EOF'
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
packages = [];
}
EOF
''${EDITOR:-vim} shell.nix
fi
'';
in
{
environment.systemPackages = [
pkgs.direnv
nixify
];
home-manager.users.me.programs.direnv = {
enable = true;
stdlib = builtins.readFile "${
pkgs.fetchFromGitHub {
owner = "Mic92";
repo = "dotfiles";
rev = "a0a9b7e358fa70a85cd468f8ca1fbb02ae0a91df";
sha256 = "1y9h5s1lf59sczsm0ksq2x1yhl98ba9lwk5yil3q53rg7n4574pg";
}
}/home/.direnvrc";
};
programs.zsh.interactiveShellInit = ''
eval "$(${pkgs.direnv}/bin/direnv hook zsh)"
'';
}

13
configs/distrobump.nix Normal file
View File

@@ -0,0 +1,13 @@
{ lib, config, pkgs, ... }:
{
imports = [
(import <stockholm/makefu/3modules/bump-distrowatch.nix> {
inherit lib config;
pkgs = pkgs // {
writeDash = pkgs.writers.writeDash;
};
})
];
makefu.distrobump.enable = true;
}

View File

@@ -1,20 +1,6 @@
{ pkgs, ... }:
{
lib,
pkgs,
...
}:
{
virtualisation.docker = {
enable = true;
# for ICE wifi, ref https://gist.github.com/sunsided/7840e89ff4e11b64a2d7503fafa0290c
extraOptions = lib.concatStringsSep " " [
"--bip=172.39.1.5/24"
"--fixed-cidr=172.39.1.0/25"
];
};
virtualisation.docker.enable = true;
users.users.me.extraGroups = [ "docker" ];
environment.systemPackages = [
pkgs.docker
pkgs.docker-compose
];
environment.systemPackages = [ pkgs.docker pkgs.docker_compose ];
}

View File

@@ -1,38 +1,24 @@
{
lib,
pkgs,
...
}:
let
sgr = code: string: ''\u001b[${code}m${string}\u001b[0m'';
in
{
environment.systemPackages = [
(pkgs.writers.writeDashBin "notifications" ''
${pkgs.dunst}/bin/dunstctl history \
| ${pkgs.jq}/bin/jq -r '
.data[]
| map("${sgr "90" ''\(.appname.data)''} ${sgr "1" ''\(.summary.data)''} ${sgr "31" ''\(.body.data | gsub("\n"; " | "))''}")
| join("\n")'
'')
];
{ config, pkgs, ... }:
with config.niveum; {
home-manager.users.me.services.dunst = {
enable = true;
iconTheme = pkgs.lib.niveum.theme.icon;
iconTheme = theme.icon;
settings = {
global = {
transparency = 10;
font = "${fonts.terminal.name} ${toString fonts.terminal.size}";
geometry = "200x5-30+20";
frame_color = colours.foreground;
follow = "mouse";
indicate_hidden = true;
notification_height = 0;
separator_height = 2;
padding = 8;
horizontal_padding = 8;
separator_color = "auto";
sort = true;
markup = "full";
format = "%a\\n<b>%s</b>\\n%b";
format = ''%a\n<b>%s</b>\n%b'';
alignment = "left";
show_age_threshold = 60;
bounce_freq = 0;
@@ -45,20 +31,29 @@ in
sticky_history = true;
history_length = 20;
dmenu = "${pkgs.rofi}/bin/rofi -display-run dunst -show run";
browser = lib.getExe pkgs.niveum-browser;
browser = applications.browser;
verbosity = "mesg";
corner_radius = 0;
mouse_left_click = "do_action";
mouse_right_click = "close_current";
mouse_middle_click = "close_all";
};
urgency_low = {
urgency_low = rec {
frame_color = background;
background = colours.foreground;
foreground = colours.background;
timeout = 5;
};
urgency_normal = {
urgency_normal = rec {
frame_color = background;
background = colours.foreground;
foreground = colours.background;
timeout = 10;
};
urgency_critical = {
urgency_critical = rec {
frame_color = background;
background = colours.red.dark;
foreground = colours.background;
timeout = 0;
};
};

View File

@@ -1,23 +0,0 @@
{
lib,
pkgs,
...
}:
{
home-manager.users.me = {
services.flameshot = {
enable = true;
settings.General = {
autoCloseIdleDaemon = true;
drawColor = "#ff0000";
drawThickness = 2;
showDesktopNotification = true;
disabledTrayIcon = true;
showHelp = false;
squareMagnifier = true;
uploadWithoutConfirmation = true;
# buttons = ''@Variant(\0\0\0\x7f\0\0\0\vQList<int>\0\0\0\0\x10\0\0\0\x2\0\0\0\x5\0\0\0\x13\0\0\0\xa\0\0\0\x1\0\0\0\xc\0\0\0\xd\0\0\0\x6\0\0\0\x8\0\0\0\0\0\0\0\xf\0\0\0\x4\0\0\0\xb\0\0\0\x3\0\0\0\x12\0\0\0\x9)'';
};
};
};
}

View File

@@ -1,161 +1,19 @@
{ pkgs, ... }:
{
pkgs,
...
}:
let
zip-font =
name: arguments:
let
directory = pkgs.fetchzip arguments;
in
pkgs.runCommand name { } ''
mkdir -p $out/share/fonts/{truetype,opentype,woff}
${pkgs.findutils}/bin/find ${directory} -name '*.ttf' -exec install '{}' $out/share/fonts/truetype \;
${pkgs.findutils}/bin/find ${directory} -name '*.otf' -exec install '{}' $out/share/fonts/opentype \;
${pkgs.findutils}/bin/find ${directory} -name '*.woff' -exec install '{}' $out/share/fonts/woff \;
'';
simple-ttf =
name: arguments:
let
file = pkgs.fetchurl arguments;
in
pkgs.runCommand name { } ''
mkdir -p $out/share/fonts/truetype
install ${file} $out/share/fonts/truetype
'';
niveum.fonts = {
ui = {
name = "Sans";
size = 9;
};
terminal = {
name = "Monospace";
size = 9;
};
};
egyptianHiero = zip-font "EgyptianHiero" {
url = "https://github.com/MKilani/Djehuty/archive/master.zip";
sha256 = "sha256-S3vZxdeBj57KJsF+zaZw7sQw8T+z1aVC2CnpnZ0/x2c=";
};
antinoou = zip-font "Antinoou" {
url = "https://www.evertype.com/fonts/coptic/AntinoouFont.zip";
sha256 = "0jwihj08n4yrshcx07dnaml2x9yws6dgyjkvg19jqbz17drbp3sw";
stripRoot = false;
};
newGardiner = zip-font "NewGardiner" {
url = "https://mjn.host.cs.st-andrews.ac.uk/egyptian/fonts/NewGardiner.zip";
hash = "sha256-nP0y4ILt+0mlkDRdCNSeO2Gequ8wyix/qQdmujTNw3Y=";
stripRoot = false;
};
newAthenaUnicode = zip-font "NewAthenaUnicode" {
url = "https://classicalstudies.org/sites/default/files/userfiles/files/NAU5_005.zip";
sha256 = "1g7qk9gl4nq2dz41bvck1nzilhin44j8691cxax3dlp77bbn9bxr";
};
jsesh = simple-ttf "JSesh" {
url = "http://files.qenherkhopeshef.org/jsesh/JSeshFont.ttf";
sha256 = "1203jrk2xzvgckcc5hx88kja1i3h8gm1wiyla5j6gspc0hbv56ry";
};
egyptianTextBeta = simple-ttf "EgyptianText-1.0beta" {
url = "http://c.krebsco.de/EgyptianText-v1.0-beta.ttf";
sha256 = "0cfjbk7xxnxhlp6v922psm5j1xzrv6wfk226ji2wz2yfrnkbcbsv";
};
coranica = simple-ttf "Coranica" {
url = "https://corpuscoranicum.de/fonts/coranica_1164.ttf";
sha256 = "0igi8q8b2p38x9jq8c98afsl7bf8rj32zj2052yyjgj9r88y4yi5";
};
koineGreek = simple-ttf "KoineGreek.ttf" {
url = "https://github.com/Center-for-New-Testament-Restoration/font/raw/af83eed50105344edaa5e5eddaf87696e271468c/KoineGreek.ttf";
hash = "sha256-YtC+nj7+Jl8k00rqAAqySYc8iTAOL7PixXc+LfSmnS0=";
};
egyptianText = simple-ttf "EgyptianText" {
url = "https://github.com/microsoft/font-tools/raw/1092cb23520967830001a0807eb21d6a44dda522/EgyptianOpenType/font/eot.ttf";
sha256 = "1n294vhcx90270pnsw1dbk6izd61fjvbnjrh4hcf98ff3s540x0c";
};
in
{
fonts = {
enableDefaultPackages = true;
fontDir.enable = true;
packages = with pkgs; [
alegreya
alegreya-sans
amiri
annapurna-sil
antinoou
cantarell-fonts
cardo
charis-sil
doulos-sil
newAthenaUnicode
coranica
corefonts
crimson
eb-garamond
ipaexfont
jsesh
egyptianHiero
egyptianText
egyptianTextBeta
font-awesome_6
etBook
newGardiner
junicode
koineGreek
# brill
ezra-sil
fira
font-awesome
galatia-sil
gentium
gyre-fonts
ibm-plex
jetbrains-mono
libertinus
libre-bodoni
lmodern
merriweather
ocr-a
montserrat
roboto
roboto-mono
noto-fonts
noto-fonts-cjk-sans
noto-fonts-color-emoji
roboto-slab
scheherazade-new
source-code-pro
source-sans-pro
source-serif-pro
theano
tocharian-font
vista-fonts
vollkorn
zilla-slab
]; # google-fonts league-of-moveable-type
fontconfig.defaultFonts =
let
emoji = [ "Noto Color Emoji" ];
in
{
monospace = [ "Noto Sans Mono" ] ++ emoji;
serif = [
"Noto Serif"
"Noto Naskh Arabic"
"Noto Serif Devanagari"
];
sansSerif = [
"Noto Sans Display"
"Noto Naskh Arabic"
"Noto Sans Hebrew"
"Noto Sans Devanagari"
"Noto Sans CJK JP"
"Noto Sans Coptic"
"Noto Sans Syriac Western"
];
inherit emoji;
};
# xelatex fails with woff files
# ref https://tex.stackexchange.com/questions/392144/xelatex-and-fontspec-crash-trying-to-find-woff-file-for-some-fonts-but-not-other
fontconfig.localConf = ''
<fontconfig>
<!-- Reject WOFF fonts We don't register WOFF(2) fonts with fontconfig because of the W3C spec -->
<selectfont>
<rejectfont>
<glob>*.woff*</glob>
</rejectfont>
</selectfont>
</fontconfig>
'';
enableDefaultFonts = true;
enableFontDir = true;
fonts = with pkgs; [ corefonts eb-garamond fira libertine lmodern noto-fonts roboto ubuntu_font_family ];
};
}

View File

@@ -1,27 +0,0 @@
{ pkgs, ... }:
{
programs.fzf = {
fuzzyCompletion = true;
keybindings = true;
};
home-manager.users.me = {
programs.fzf =
let
defaultCommand = "${pkgs.fd}/bin/fd --type f --strip-cwd-prefix --follow --no-ignore-vcs --exclude .git";
in
{
enable = true;
defaultCommand = defaultCommand;
defaultOptions = [ "--height=40%" ];
changeDirWidgetCommand = "${pkgs.fd}/bin/fd --type d";
changeDirWidgetOptions = [
"--preview='${pkgs.tree}/bin/tree -L 1 {}'"
"--bind=space:toggle-preview"
"--preview-window=hidden"
];
fileWidgetCommand = defaultCommand;
fileWidgetOptions = [ "--preview='head -$LINES {}'" ];
};
};
}

View File

@@ -1,23 +0,0 @@
{ pkgs, ... }:
{
environment.systemPackages = [
pkgs.zeroad
pkgs.mari0
pkgs.luanti # fka minetest
# pkgs.openarena
# pkgs.teeworlds
pkgs.nethack
# pkgs.freeciv
# pkgs.lincity-ng
# pkgs.superTuxKart
pkgs.morris
pkgs.gnome-chess
pkgs.gnuchess
];
networking.firewall = {
# for 0ad multiplayer
allowedTCPPorts = [ 20595 ];
allowedUDPPorts = [ 20595 ];
};
}

View File

@@ -1,33 +1,26 @@
{
pkgs,
lib,
...
}:
{ pkgs, config, ... }:
{
environment.systemPackages = [
pkgs.mr
pkgs.gitFull
pkgs.git-crypt
pkgs.gitflow
pkgs.gh
pkgs.git-extras
# pkgs.git-trim
pkgs.git-absorb
pkgs.git
pkgs.gitAndTools.hub
pkgs.gitAndTools.git-extras
pkgs.gitstats
pkgs.patch
pkgs.patchutils
pkgs.git-quick-stats
pkgs.git-preview
];
environment.shellAliases = {
gf = "git-flow";
g = "git";
};
home-manager.users.me = {
home.file.".mrconfig".text = builtins.readFile <dot/mrconfig.ini>;
programs.git = {
enable = true;
package = pkgs.gitFull;
settings.alias = {
package = pkgs.gitAndTools.gitFull;
userName = config.niveum.user.name;
userEmail = config.niveum.user.email;
aliases = {
br = "branch";
co = "checkout";
ci = "commit";
@@ -40,13 +33,7 @@
logs = "log --pretty=oneline";
graph = "log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all";
};
ignores = pkgs.lib.niveum.ignorePaths;
settings.user.name = pkgs.lib.niveum.kieran.name;
settings.user.email = pkgs.lib.niveum.kieran.email;
settings.pull.ff = "only";
settings.rebase.autoStash = true;
settings.merge.autoStash = true;
settings.push.autoSetupRemove = true;
ignores = config.niveum.ignore;
};
};
}

View File

@@ -1,5 +0,0 @@
{
services.xserver.enable = true;
services.xserver.displayManager.lightdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
}

5
configs/gollum.nix Normal file
View File

@@ -0,0 +1,5 @@
{
services.gollum = {
enable = true;
};
}

View File

@@ -0,0 +1,46 @@
{ config, pkgs, ... }:
{
home-manager.users.me.home.file = {
".ghc/ghci.conf".text = ''
:set editor vim
:def hoogle \s -> return $ ":!${pkgs.haskellPackages.hoogle}/bin/hoogle search --color -l --count=15 \"" ++ s ++ "\""
:def doc \s -> return $ ":!${pkgs.haskellPackages.hoogle}/bin/hoogle search --color -l --info \"" ++ s ++ "\""
:def pl \x -> return $ ":!${pkgs.haskellPackages.pointfree}/bin/pointfree -v \"" ++ x ++ "\""
:set prompt "\o033[1m%s\o033[1;34m λ\o033[0m "
:set -Wall
'';
# :def unpl \x -> return $ ":!${pkgs.haskellPackages.pointful}/bin/pointful \"" ++ x ++ "\""
".stack/config.yaml".text = let user = config.niveum.user; in ''
templates:
params:
author-name: ${user.name}
author-email: ${user.email}
copyright: 'Copyright: (c) 2019 ${user.name}'
github-username: ${user.github}
'';
};
services.hoogle = {
enable = true;
packages = import ./packages.nix;
port = 8091;
};
environment.systemPackages = with pkgs; [
cabal2nix
stack2nix
cabal-install
hlint
# haskellPackages.brittany
(haskellPackages.ghcWithHoogle (import ./packages.nix))
] ++ map haskell.lib.justStaticExecutables [
haskellPackages.ghcid
haskellPackages.hakyll
# haskellPackages.hfmt
haskellPackages.hasktags
haskellPackages.hindent
haskellPackages.pointfree
# haskellPackages.pointful
haskellPackages.hpack
];
}

View File

@@ -0,0 +1,101 @@
haskellPackages:
with haskellPackages; [
blessings
scanner
HTTP
HUnit
MissingH
QuickCheck
ad
adjunctions
aeson
# algebra
ansi-terminal
async
attoparsec
base-orphans
bifunctors
binary
blaze-html
blaze-markup
brick
bytes
bytestring
case-insensitive
cassava
cereal
clock
comonad
comonad-transformers
conduit
conduit-extra
constraints
containers
contravariant
criterion
data-default
diagrams
directory
dlist
either
exceptions
extra
filepath
foundation
free
haskeline
hedgehog
hourglass
hspec
http-client
http-conduit
kan-extensions
lens
linear
lucid
megaparsec
microlens
monad-logger
mono-traversable
mtl
network
pandoc
parallel
parsec
persistent
pipes
pointed
pretty-show
primitive
process
profunctors
regex-tdfa
safe
scalpel
semigroupoids
semigroups
servant
servant-blaze
servant-client
servant-docs
servant-server
servant-swagger
split
stm
tagsoup
tasty
text
time
transformers
turtle
type-unary
unix-time
unordered-containers
vector
vinyl
void
vty
warp
wreq
yaml
]

View File

@@ -1,30 +1,15 @@
{ config, pkgs, ... }:
{
pkgs,
...
}:
let
ledgerDirectory = "/home/kfm/sync/src/ledger";
hora = pkgs.callPackage ../packages/hora.nix { timeLedger = "${ledgerDirectory}/time.timeclock"; };
in
{
environment.systemPackages =
let
git = "${pkgs.git}/bin/git -C ${ledgerDirectory}";
in
[
hora
pkgs.hledger
(pkgs.writers.writeDashBin "hledger-git" ''
if [ "$1" = entry ]; then
${pkgs.hledger}/bin/hledger balance -V > "${ledgerDirectory}/balance.txt"
${git} add balance.txt
${git} commit --all --message="$(date -Im)"
else
${git} $*
fi
'')
(pkgs.writers.writeDashBin "hledger-edit" ''
$EDITOR ${ledgerDirectory}/current.journal
'')
];
imports = [ <modules/hledger.nix> ];
niveum.hledger = {
enable = true;
ledgerFile = "$HOME/prog/git/ledger/current.journal";
server = {
enable = false;
user = config.users.users.me;
package = pkgs.unstable.hledger-web;
};
package = pkgs.unstable.hledger;
};
}

View File

@@ -0,0 +1,7 @@
{
services.home-assistant = {
enable = true;
configWritable = true;
lovelaceConfigWritable = true;
};
}

View File

@@ -2,38 +2,33 @@
home-manager.users.me = {
programs.htop = {
enable = true;
settings = {
color_scheme = 0;
account_guest_in_cpu_meter = true;
cpu_count_from_zero = false;
delay = 15;
detailed_cpu_time = false;
header_margin = true;
hide_kernel_threads = true;
hide_threads = true;
hide_userland_threads = true;
highlight_base_name = true;
highlight_megabytes = true;
highlight_threads = true;
shadow_other_users = true;
show_program_path = false;
show_thread_names = false;
sort_descending = true;
sort_key = "PERCENT_CPU";
tree_view = false;
update_process_names = false;
right_meters = [
"Uptime"
"Tasks"
"LoadAverage"
"Battery"
];
left_meters = [
"LeftCPUs2"
"RightCPUs2"
"Memory"
"Swap"
colorScheme = 0;
accountGuestInCpuMeter = true;
cpuCountFromZero = false;
delay = 15;
detailedCpuTime = false;
headerMargin = true;
hideKernelThreads = true;
hideThreads = false;
hideUserlandThreads = false;
highlightBaseName = true;
highlightMegabytes = true;
highlightThreads = true;
shadowOtherUsers = true;
showProgramPath = false;
showThreadNames = true;
sortDescending = true;
sortKey = "PERCENT_CPU";
treeView = true;
updateProcessNames = false;
meters = {
left = [
{ kind = "LeftCPUs2"; mode = 1; }
{ kind = "RightCPUs2"; mode = 1; }
{ kind = "Memory"; mode = 1; }
{ kind = "Swap"; mode = 1; }
];
right = [ "Uptime" "Tasks" "LoadAverage" "Battery" ];
};
};
};

43
configs/hu-berlin.nix Normal file
View File

@@ -0,0 +1,43 @@
{ pkgs, lib, ... }:
let
eduroam = {
identity = lib.strings.removeSuffix "\n" (builtins.readFile <shared-secrets/eduroam/identity>);
password = lib.strings.removeSuffix "\n" (builtins.readFile <shared-secrets/eduroam/password>);
};
eduroamAuth = ''
key_mgmt=WPA-EAP
eap=TTLS
proto=RSN
identity="${eduroam.identity}"
anonymous_identity="anonymous@wlan.hu-berlin.de"
altsubject_match="DNS:srv1-radius.cms.hu-berlin.de;DNS:srv2-radius.cms.hu-berlin.de"
password="${eduroam.password}"
ca_cert="${pkgs.fetchurl {
url = https://www.cms.hu-berlin.de/de/dl/netze/wlan/config/eduroam/t-telesec_globalroot_class_2.pem;
sha256 = "0if8aqd06sid7a0vw009zpa087wxcgdd2x6z2zs4pis5kvyqj2dk";
}}"
phase2="auth=PAP"
'';
in {
networking.wireless.networks = {
eduroam_5GHz.auth = eduroamAuth;
eduroam.auth = eduroamAuth;
};
services.openvpn.servers = {
hu-berlin = {
config = ''
config ${pkgs.fetchurl {
url = https://www.cms.hu-berlin.de/de/dl/netze/vpn/openvpn/hu-berlin.ovpn;
sha256 = "15b55aibik5460svjq2gwxrcyh6ay4k8savd6cd5lncgndmd8p8h";
}}
# route-nopull
# route 141.20.0.0 255.255.0.0
'';
authUserPass = {
username = eduroam.identity;
password = eduroam.password;
};
};
};
}

Some files were not shown because too many files have changed in this diff Show More