initial commit

This commit is contained in:
2025-05-04 02:47:36 +02:00
commit d5e06f3f49
91 changed files with 9063 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
{pkgs, ...}:
pkgs.writeShellScriptBin "askpass" ''
${pkgs.wofi}/bin/wofi -d -P -L 1 -p "$(printf $1 | sed s/://)"''

3
users/scripts/backup.nix Normal file
View File

@@ -0,0 +1,3 @@
{pkgs, ...}:
pkgs.writeShellScriptBin "backup" ''
cp -r "$1" "$1.bak.$(date +%Y%m%d%H%M%S)"''

View File

@@ -0,0 +1,4 @@
{pkgs, ...}:
pkgs.writeShellScriptBin "hyprland-autostart" ''
${pkgs.waybar}/bin/waybar &
${pkgs.wlsunset}/bin/wlsunset -l 48.5 -L 2.2 -d 1500''

3
users/scripts/keygen.nix Normal file
View File

@@ -0,0 +1,3 @@
{pkgs, ...}:
pkgs.writeShellScriptBin "keygen"
"tr -cd '[:alnum:]' < /dev/urandom | fold -w 64 | head -n 1 | tr -d '\n'"

View File

@@ -0,0 +1,10 @@
{
pkgs,
emacsPackage,
...
}:
pkgs.writeShellScriptBin "launch-with-emacsclient" ''
filename="$1"
line="$2"
column="$3"
${emacsPackage}/bin/emacsclient +$line:$column "$filename"''

View File

@@ -0,0 +1,3 @@
{pkgs, ...}:
pkgs.writeShellScriptBin "mp42webm" ''
${pkgs.ffmpeg}/bin/ffmpeg -i "$1" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "$1".webm''

18
users/scripts/scripts.nix Normal file
View File

@@ -0,0 +1,18 @@
{
config,
pkgs,
...
}: let
askpass = import ./askpass.nix {inherit pkgs;};
in [
askpass
(import ./backup.nix {inherit pkgs;})
(import ./hyprland-autostart.nix {inherit pkgs;})
(import ./keygen.nix {inherit pkgs;})
(import ./launch-with-emacsclient.nix {
inherit pkgs;
emacsPackage = config.emacsPkg;
})
(import ./mp42webm.nix {inherit pkgs;})
(import ./sshbind.nix {inherit pkgs;})
]

View File

@@ -0,0 +1,3 @@
{pkgs, ...}:
pkgs.writeShellScriptBin "sshbind" ''
ssh -L "$1:$3:$1" "$2" -N''

18
users/scripts/ytplay.nix Normal file
View File

@@ -0,0 +1,18 @@
{pkgs, ...}: let
rofi = pkgs.rofi-wayland;
in
pkgs.writeShellScriptBin "ytplay" ''
URL=$(${rofi}/bin/rofi -dmenu -i -p "Video URL")
if [ -z "$URL" ]; then
echo "You need to provide a URL"
exit 1
fi
RESOLUTION_CHOICE=$(${pkgs.yt-dlp}/bin/yt-dlp --list-formats "$URL" | \
grep -E "webm.*[0-9]+x[0-9]" | \
awk '{print $3 " " $1}' | \
sort -gu | \
${rofi}/bin/rofi -dmenu -i -p "Resolution")
mapfile -t RESOLUTION <<< "$RESOLUTION_CHOICE"
RESOLUTION_CODE=''${RESOLUTION[0]}
${pkgs.mpv}/bin/mpv --ytdl-format="''${RESOLUTION_CODE}+bestaudio/best" "$URL"
''