summaryrefslogtreecommitdiffstats
path: root/users
diff options
context:
space:
mode:
Diffstat (limited to 'users')
-rw-r--r--users/sils/default.nix3
-rw-r--r--users/sils/gpg/default.nix2
-rw-r--r--users/sils/grades/config.yaml57
-rw-r--r--users/sils/grades/default.nix9
-rw-r--r--users/sils/mako/default.nix46
-rw-r--r--users/sils/packages/default.nix11
-rw-r--r--users/sils/river/res/keys.ron2
-rw-r--r--users/sils/yambar/config/laptop.yml234
-rw-r--r--users/sils/yambar/default.nix49
-rwxr-xr-xusers/sils/yambar/scripts/disk24
-rwxr-xr-xusers/sils/yambar/scripts/grades-average17
-rwxr-xr-xusers/sils/yambar/scripts/network49
-rwxr-xr-xusers/sils/yambar/scripts/sound-volume22
-rw-r--r--users/sils/zsh/default.nix12
14 files changed, 529 insertions, 8 deletions
diff --git a/users/sils/default.nix b/users/sils/default.nix
index 92731cf..642c189 100644
--- a/users/sils/default.nix
+++ b/users/sils/default.nix
@@ -3,8 +3,11 @@
./direnv
./git
./gpg
+ ./grades
+ ./mako
./packages
./river
+ ./yambar
./zsh
];
diff --git a/users/sils/gpg/default.nix b/users/sils/gpg/default.nix
index 5c93735..a48f08c 100644
--- a/users/sils/gpg/default.nix
+++ b/users/sils/gpg/default.nix
@@ -5,6 +5,6 @@
};
services.gpg-agent = {
enable = true;
- pinentryFlavor = "curses";
+ pinentryFlavor = "gtk2";
};
}
diff --git a/users/sils/grades/config.yaml b/users/sils/grades/config.yaml
new file mode 100644
index 0000000..d80516a
--- /dev/null
+++ b/users/sils/grades/config.yaml
@@ -0,0 +1,57 @@
+# für oberstufe
+---
+unit: Punkte
+grade_groups:
+ - name: Zeugnis
+ weight: '100'
+ - name: Sonstige
+ weight: '1'
+ - name: Klausur
+ weight: '1'
+
+grade_types:
+ - name: Zeugnis
+ group: Zeugnis
+ - name: Klausur
+ group: Klausur
+ - name: Epo
+ group: Sonstige
+ - name: Test
+ group: Sonstige
+
+class_types:
+ - name: NebenFach
+ - name: LeistungsKurs
+
+classes:
+ - name: M
+ long_name: Mathe
+ class_type: LeistungsKurs
+ - name: EK
+ long_name: Erdkunde
+ class_type: LeistungsKurs
+ - name: PH
+ long_name: Physik
+ class_type: LeistungsKurs
+
+ - name: d
+ long_name: Deutsch
+ class_type: NebenFach
+ - name: g
+ long_name: Geschichte
+ class_type: NebenFach
+ - name: mu
+ long_name: Musik
+ class_type: NebenFach
+ - name: rel
+ long_name: Religion
+ class_type: NebenFach
+ - name: spj
+ long_name: Sport
+ class_type: NebenFach
+ - name: inf
+ long_name: Informatik
+ class_type: NebenFach
+ - name: e
+ long_name: Englisch
+ class_type: NebenFach
diff --git a/users/sils/grades/default.nix b/users/sils/grades/default.nix
new file mode 100644
index 0000000..64af8a6
--- /dev/null
+++ b/users/sils/grades/default.nix
@@ -0,0 +1,9 @@
+{
+ config,
+ grades,
+ ...
+}: {
+ xdg.configFile."grades/config.yaml".source = ./config.yaml;
+
+ home.packages = [grades];
+}
diff --git a/users/sils/mako/default.nix b/users/sils/mako/default.nix
new file mode 100644
index 0000000..2ce853b
--- /dev/null
+++ b/users/sils/mako/default.nix
@@ -0,0 +1,46 @@
+{
+ config,
+ pkgs,
+ ...
+}: {
+ services.mako = {
+ enable = true;
+ backgroundColor = "#2e3440";
+ borderColor = "#88c0d0";
+ borderRadius = 25;
+ borderSize = 2;
+ defaultTimeout = 5000;
+ font = "Source Code Pro 10";
+ width = 500;
+ height = 500;
+ icons = true;
+ ignoreTimeout = true;
+ layer = "overlay";
+ markup = true; # TODO
+ maxIconSize = 64;
+ sort = "-time";
+ extraConfig = ''
+ [urgency=low]
+ border-color=#cccccc
+
+ [urgency=normal]
+ border-color=#d08770
+
+ [urgency=high]
+ border-size=3
+ border-color=#bf616a
+ default-timeout=0
+
+ [urgency=critical]
+ border-size=4
+ border-color=#bf616a
+ default-timeout=0
+
+ [category=mpd]
+ default-timeout=2000
+ group-by=category
+ '';
+ };
+}
+# vim: ts=2
+
diff --git a/users/sils/packages/default.nix b/users/sils/packages/default.nix
index 57fafa7..24cbc02 100644
--- a/users/sils/packages/default.nix
+++ b/users/sils/packages/default.nix
@@ -1,4 +1,9 @@
-{pkgs, ...}: {
+{
+ grades,
+ system,
+ pkgs,
+ ...
+}: {
home.packages = with pkgs; [
# core tools
neofetch # a must-have
@@ -79,5 +84,9 @@
river
yambar
swaylock
+
+ # soispha
+
+ grades.outputs.packages.${system}.default
];
}
diff --git a/users/sils/river/res/keys.ron b/users/sils/river/res/keys.ron
index 0df6d77..9c11e2e 100644
--- a/users/sils/river/res/keys.ron
+++ b/users/sils/river/res/keys.ron
@@ -24,7 +24,7 @@ RiverctlCommandArray(
RiverctlCommand( map_mode: Map, mode: ["normal"], key: "F1", mods: "Super", command: "spawn", command_args: "firefox",),
RiverctlCommand( map_mode: Map, mode: ["normal"], key: "F2", mods: "Super", command: "spawn", command_args: "keepassxc",),
RiverctlCommand( map_mode: Map, mode: ["normal"], key: "F3", mods: "Super", command: "spawn", command_args: "element-desktop",),
- RiverctlCommand( map_mode: Map, mode: ["normal"], key: "L", mods: "Super", command: "spawn", command_args: "swaylock -f",),
+ RiverctlCommand( map_mode: Map, mode: ["normal"], key: "Q", mods: "Super", command: "spawn", command_args: "swaylock -f",),
// Client
RiverctlCommand( map_mode: Map, mode: ["normal"], key: "f", mods: "Super", command: "toggle-fullscreen", command_args: None,),
diff --git a/users/sils/yambar/config/laptop.yml b/users/sils/yambar/config/laptop.yml
new file mode 100644
index 0000000..1c16982
--- /dev/null
+++ b/users/sils/yambar/config/laptop.yml
@@ -0,0 +1,234 @@
+---
+# Config file for yambar
+# Note that this may be version-dependent, this file is written for v1.8.0
+
+
+# Font anchors
+font-main: &fontmain Source Code Pro:pixelsize=22
+font-aws: &awesome Font Awesome 5 Free:style=solid:pixelsize=20
+
+# Color anchors
+fg-none: &fgnone 00000000
+fg-1: &fg1 c6ceefff
+fg-blue: &fgblue 99d1dbff
+fg-sapphire: &fgsapp 74c7ecdd
+fg-green: &fggreen a6e3a1dd
+fg-peach: &fgpeach fab387dd
+fg-mauve: &fgmauve cba6f7dd
+fg-teal: &fgteal 94e2d5dd
+fg-lavendar: &fglav b4befedd
+fg-focus: &fgfocus e78284ff
+bg-1: &bg1 303446ff
+bg-tag: &bgtag 585b70ff
+bg-tag2: &bgtag2 45475aff
+bg-urgent: &bgurgent e78284ff
+
+# Background blocks
+background-block: &bgcblock {background: {color: *bg1 }}
+background-block-urgent: &bgcurg {background: {color: *bgurgent }}
+
+# Underlines
+underline-focused: &line {underline: { size: 3, color: *fgfocus}}
+underline-urgent: &lineurgent {underline: { size: 3, color: *fgblue}}
+underline-utils: &lineutil {underline: { size: 3, color: *fgpeach}}
+underline-resources: &linemem {underline: { size: 3, color: *fggreen}}
+underline-battery: &linebat {underline: { size: 3, color: *fgsapp}}
+underline-clock: &lineclock {underline: { size: 3, color: *fgteal}}
+underline-weather: &linewea {underline: { size: 3, color: *fglav}}
+underline-title: &linetitle {underline: { size: 3, color: *bgtag}}
+
+# Combined decorations
+combination-utils: &combutil {stack: [ <<: *bgcblock, <<: *lineutil]}
+combination-resources: &combmem {stack: [ <<: *bgcblock, <<: *linemem]}
+combination-battery: &combbat {stack: [ <<: *bgcblock, <<: *linebat]}
+combination-clock: &combclock {stack: [ <<: *bgcblock, <<: *lineclock]}
+combination-weather: &combwea {stack: [ <<: *bgcblock, <<: *linewea]}
+
+
+### Main
+
+bar:
+ location: top
+ height: 25
+ layer: bottom
+ spacing: 0
+ margin: 10
+ border: {margin: 0, top-margin: 5}
+ foreground: *fg1
+ background: *fgnone
+ font: *fontmain
+
+ ### Left, river tags
+ left:
+ - river:
+ anchors:
+ - id: &name { text: "{id}" }
+ - string: &focus { stack: [ {background: {color: *bg1}} ] }
+ - string: &normal { string: { <<: *name, margin: 10 } }
+ - string:
+ &occupied { string: { <<: *name, deco: {background: {color: *bgtag2}}, margin: 10 } }
+ - string: &urgent { string: { <<: *name, deco: {stack: [background: {color: *bgurgent}, <<: *lineurgent]}, margin: 10 } }
+ - string: &focused { string: { <<: *name, deco: {stack: [background: {color: *bgtag}, <<: *line]}, margin: 10 } }
+ - string: &unfocused { string: { <<: *name, deco: {background: {color: *bgtag2}}, margin: 10 } }
+ - base: &river_base
+ default: *normal
+ conditions:
+ state == focused: *focused
+ state == unfocused: *unfocused
+ state == urgent: *urgent
+ state == invisible:
+ map:
+ conditions:
+ occupied: *occupied
+ ~occupied: *normal
+ content:
+ map:
+ on-click:
+ left: sh -c "riverctl set-focused-tags $((1 << ({id} - 1)))"
+ right: sh -c "riverctl toggle-focused-tags $((1 << ({id} -1)))"
+ middle: sh -c "riverctl toggle-view-tags $((1 << ({id} -1)))"
+ conditions:
+ id == 1: { map: { <<: *river_base } }
+ id == 2: { map: { <<: *river_base } }
+ id == 3: { map: { <<: *river_base } }
+ id == 4: { map: { <<: *river_base } }
+ id == 5: { map: { <<: *river_base } }
+ id == 6: { map: { <<: *river_base } }
+ id == 7: { map: { <<: *river_base } }
+ id == 8: { map: { <<: *river_base } }
+ id == 9: { map: { <<: *river_base } }
+ title:
+ map:
+ default:
+ {
+ string:
+ {
+ text: "{title}",
+ left-margin: 12,
+ right-margin: 12,
+ # max: 35,
+ deco: *linetitle
+ },
+ }
+ conditions:
+ title == "": { string: { text: "" } }
+
+ ### Center, clock & weather gadget
+ center:
+ - clock:
+ time-format: "%H:%M:%S %Z"
+ date-format: "%d/%m/%y (%a)"
+ foreground: *fgblue
+ content:
+ string:
+ text: " {date} {time} "
+ deco: *combclock
+
+ ### Right, system tray
+ right:
+ #- network:
+ # name: wlp5s0
+ # poll-interval: 10
+ # content:
+ # map:
+ # on-click: /bin/sh -c "nmtui"
+ # conditions:
+ # ~carrier: {empty: {}}
+ # carrier:
+ # string: {text: "  {ssid} ", deco: *combutil}
+ #- network:
+ # name: enp4s0
+ # content:
+ # map:
+ # on-click: /bin/sh -c "nmtui"
+ # conditions:
+ # ~carrier:
+ # string: {text: "  Eth failed ", deco: *combutil}
+ # carrier: {empty: {}}
+
+ - script: # Sound volume
+ path: @volume_script@
+ content:
+ map:
+ on-click: /bin/sh -c "pavucontrol"
+ conditions:
+ muted:
+ string:
+ text: " ﱝ "
+ deco: *bgcurg
+ ~muted:
+ string: {text: "  {volume}% ", deco: *combutil}
+
+ - script: # Grade average
+ path: @grade_average_script@
+ content:
+ string:
+ text: "  {grade} "
+ deco: *combmem
+
+ - backlight:
+ name: @backlight@
+ content:
+ - string: {text: "  {percent}% ", deco: *combutil}
+
+ - script: # CPU
+ path: @cpu_script@
+ content:
+ string:
+ text: "  {cpu}% "
+ deco: *combmem
+
+ - script: # Memory info
+ path: @memory_script@
+ content:
+ map:
+ conditions:
+ swapstate:
+ string:
+ text: "  {memperc}%({swapperc}%) "
+ deco: *combmem
+ ~swapstate:
+ string:
+ text: "  {memperc}% "
+ deco: *combmem
+ - script: # Disk space
+ path: @disk_script@
+ content:
+ string:
+ text: "  {diskspace}({diskperc})"
+ deco: *combmem
+ - battery:
+ name: BAT0
+ poll-interval: 30
+ content:
+ list:
+ items:
+ - ramp:
+ tag: capacity
+ items:
+ - string:
+ text: "  {capacity}%({estimate}) "
+ deco: *bgcurg
+ - string:
+ text: "  {capacity}%({estimate}) "
+ deco: {stack: [ <<: *bgcblock, <<: *linebat]}
+ - string:
+ text: "  {capacity}%({estimate}) "
+ deco: {stack: [ <<: *bgcblock, <<: *linebat]}
+ - string:
+ text: "  {capacity}%({estimate}) "
+ deco: {stack: [ <<: *bgcblock, <<: *linebat]}
+ - string:
+ text: "  {capacity}%({estimate}) "
+ deco: {stack: [ <<: *bgcblock, <<: *linebat]}
+ #- script: # tray
+ # path: /home/dt/.config/yambar/scripts/yambar-tray
+ # content:
+ # empty: {}
+ #- script:
+ # path: /home/dt/.config/yambar/scripts/yambar-tray-width
+ # poll-interval: 10
+ # content:
+ # string:
+ # text: "{padding}"
+ # deco: *combmem
diff --git a/users/sils/yambar/default.nix b/users/sils/yambar/default.nix
new file mode 100644
index 0000000..814174c
--- /dev/null
+++ b/users/sils/yambar/default.nix
@@ -0,0 +1,49 @@
+{
+ nixosConfig,
+ sysLib,
+ system,
+ pkgs,
+ grades,
+ yambar_cpu,
+ yambar_memory,
+ ...
+}: let
+ makeScript = {
+ file,
+ dependencies,
+ ...
+ }:
+ sysLib.makeShellScriptWithLibrary {
+ name = "${builtins.baseNameOf file}";
+ script = file;
+ dependencies = dependencies ++ (builtins.attrValues {inherit (pkgs) dash;});
+ }
+ + "/bin/${builtins.baseNameOf file}";
+in {
+ xdg.configFile."yambar/config.yml".source = pkgs.substituteAll {
+ src = ./config/laptop.yml;
+
+ backlight = "intel_backlight";
+ volume_script = makeScript {
+ dependencies = builtins.attrValues {inherit (pkgs) pulseaudio gawk coreutils;};
+ file = ./scripts/sound-volume;
+ };
+ grade_average_script = makeScript {
+ dependencies =
+ [
+ grades.outputs.packages.${system}.default
+ ]
+ ++ (builtins.attrValues {inherit (pkgs) coreutils gawk;});
+ file = ./scripts/grades-average;
+ };
+ cpu_script = yambar_cpu.app.${system}.default.program;
+ memory_script = yambar_memory.app.${system}.default.program;
+
+ disk_script = makeScript {
+ dependencies = builtins.attrValues {inherit (pkgs) gawk btrfs-progs coreutils;};
+ file = ./scripts/disk;
+ };
+ };
+}
+# vim: ts=2
+
diff --git a/users/sils/yambar/scripts/disk b/users/sils/yambar/scripts/disk
new file mode 100755
index 0000000..dad41fe
--- /dev/null
+++ b/users/sils/yambar/scripts/disk
@@ -0,0 +1,24 @@
+#! /usr/bin/env dash
+# shellcheck disable=SC2086
+# shellcheck source=/dev/null
+# . ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
+
+# Main loop
+while true; do
+ # vars
+ used_space=$(btrfs filesystem usage /srv 2> /dev/null | awk '{if ( /Used:/ ) { print $2 } } ' | head -n1)
+ all_space=$(btrfs filesystem usage /srv 2> /dev/null | awk '{if ( /Device size:/ ) { print $3 } } ' | head -n1 | tr -d "GiB")
+
+
+ # Check space available (4) and percentage used (5)
+ spaceperc=$(echo "$(echo "$used_space" | tr -d "GiB" )" "$all_space" | awk '{div=$1/$2;div *= 100; printf"%2d%%\n",div }')
+
+ echo "diskspace|string|$used_space"
+ echo "diskperc|string|$spaceperc"
+ echo ""
+ sleep 1
+done
+
+if [ -d "$LIB_TEMP_DIR_FOR_SCRIPT" ];then rm -r "$LIB_TEMP_DIR_FOR_SCRIPT"; fi
+# vim: ft=sh
diff --git a/users/sils/yambar/scripts/grades-average b/users/sils/yambar/scripts/grades-average
new file mode 100755
index 0000000..98e0685
--- /dev/null
+++ b/users/sils/yambar/scripts/grades-average
@@ -0,0 +1,17 @@
+#! /usr/bin/env dash
+# shellcheck disable=SC2086
+# shellcheck source=/dev/null
+# . ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
+
+while true; do
+ grade=$(grades list average | awk '{print $2}');
+
+ echo "grade|string|$grade";
+ echo "";
+
+ sleep 1;
+done
+
+if [ -d "$LIB_TEMP_DIR_FOR_SCRIPT" ];then rm -r "$LIB_TEMP_DIR_FOR_SCRIPT"; fi
+# vim: ft=sh
diff --git a/users/sils/yambar/scripts/network b/users/sils/yambar/scripts/network
new file mode 100755
index 0000000..45c164d
--- /dev/null
+++ b/users/sils/yambar/scripts/network
@@ -0,0 +1,49 @@
+#! /usr/bin/env dash
+# shellcheck disable=SC2086
+# shellcheck source=/dev/null
+# . ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
+
+retest=120
+retest_if_con_fails=10
+backend=nmcli
+
+case "$backend" in
+ "nmcli") # Test for connectivity with nmcli
+ while true; do
+ connection_status=$(nmcli networking connectivity)
+ if [ "$connection_status" = "full" ]; then
+ echo "internet|string|Connected"
+ echo ""
+ sleep $retest
+ else
+ echo "internet|string|Disconnected"
+ echo ""
+ sleep $retest_if_con_fails
+ fi
+ done
+ ;;
+ "ping") # Test for connectivity with ping
+ ip_address='8.8.8.8'
+ ping_number=3
+
+ while true; do
+
+ ping_result=$(mktmp)
+ ping $ip_address -c $ping_number -q | awk 'BEGIN {FS="/"} END {print $5}' > $ping_result
+
+ if [ "$(cat $ping_result | wc -l)" -eq 0 ]; then
+ echo "med|string|No connection"
+ echo ""
+ sleep $retest_if_con_fails
+ else
+ echo "med|string|$(cat $ping_result) ms"
+ echo ""
+ sleep $retest
+ fi
+ done
+ ;;
+esac
+
+if [ -d "$LIB_TEMP_DIR_FOR_SCRIPT" ];then rm -r "$LIB_TEMP_DIR_FOR_SCRIPT"; fi
+# vim: ft=sh
diff --git a/users/sils/yambar/scripts/sound-volume b/users/sils/yambar/scripts/sound-volume
new file mode 100755
index 0000000..8a9cf0d
--- /dev/null
+++ b/users/sils/yambar/scripts/sound-volume
@@ -0,0 +1,22 @@
+#! /usr/bin/env dash
+# shellcheck disable=SC2086
+# shellcheck source=/dev/null
+# . ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
+
+while true; do
+ volume=$(pactl get-sink-volume 0 | awk 'BEGIN { FS="/" } {gsub("%","",$2); gsub(" ","",$2)} {printf $2}')
+
+ if [ "$volume" -eq 0 ]; then
+ echo "muted|bool|true"
+ else
+ echo "volume|string|$volume"
+ echo "muted|bool|false"
+ fi
+ echo ""
+
+ sleep 1;
+done
+
+if [ -d "$LIB_TEMP_DIR_FOR_SCRIPT" ];then rm -r "$LIB_TEMP_DIR_FOR_SCRIPT"; fi
+# vim: ft=sh
diff --git a/users/sils/zsh/default.nix b/users/sils/zsh/default.nix
index e2e8ca4..5e54636 100644
--- a/users/sils/zsh/default.nix
+++ b/users/sils/zsh/default.nix
@@ -22,6 +22,10 @@
historySubstringSearch.enable = true;
+ sessionVariables = {
+ WALLPAPER = "${config.home.homeDirectory}/srv/wallpaper.jpg";
+ };
+
shellAliases = {
vim = "nvim";
ls = "lsd";
@@ -33,17 +37,15 @@
repreconf = "restic -r /mnt/storage/backups --password-file ~/srv/restic_pswd";
b-del = "sudo btrfs subv delet /srv/snapshots/home";
b-shot = "sudo btrfs subvolume snapshot -r /home /srv/snapshots/home";
- b-home = "[ -d /srv/snapshots/home ] && sudo btrfs subvolume delete /srv/snapshots/home;
- sudo btrfs subvolume snapshot -r /home /srv/snapshots/home; sudo restic -r /mnt/storage/backups --
- password-file ~/srv/restic_pswd --cache-dir /srv/.restic-cache backup /srv/snapshots/home;";
- r-clean = "sudo restic -r /mnt/storage/backups --password-file ~/srv/restic_pswd --cache-
+ b-home = ''[ -d /srv/snapshots/home ] && sudo btrfs subvolume delete /srv/snapshots/home; sudo btrfs subvolume snapshot -r /home /srv/snapshots/home; sudo restic -r /mnt/storage/backups --password-file ~/srv/restic_pswd --cache-dir /srv/.restic-cache backup /srv/snapshots/home;'';
+ r-clean = ''sudo restic -r /mnt/storage/backups --password-file ~/srv/restic_pswd --cache-
dir /srv/.restic-cache forget \
--keep-weekly 7 \
--keep-daily 7 \
--keep-monthly 6 \
--keep-yearly 10 \
--keep-hourly 5 \
- --keep-tag prs";
+ --keep-tag prs'';
r-prune = "sudo restic -r /mnt/storage/backups --password-file ~/srv/restic_pswd --cache-
dir /srv/.restic-cache prune";
r-check = "sudo restic -r /mnt/storage/backups --cache-dir /srv/.restic-cache --password-