blob: 20808e76ee92920ec6c971e5a25b35b1c2b5ccad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
{ pkgs, ... }:
let
# open a window with live video feed from the camera
webcam = pkgs.writeScriptBin "webcam" ''
${pkgs.mpv}/bin/mpv av://v4l2:/dev/video0 --profile=low-latency --untimed
'';
# create new repo on fern
git-new-repo = pkgs.writeScriptBin "git-new-repo" ''
if [ $# -eq 0 ]; then
echo "requires an arg"
exit 1
fi
# $1 - section/repo-name
ssh git@ferrn git init --bare "$1";
git remote add origin git@ferrn:"$1";
git push -u origin HEAD;
'';
# set git repo descriptions on cgit
git-set-desc = pkgs.writeScriptBin "git-set-desc" ''
remote=$(git remote get-url --push origin)
scp .git/description "$remote/description"
'';
# screen record with ffmpeg and slop
record = import ./record.nix pkgs;
# file uploader
uploader = import ./up.nix pkgs;
# battery script
battery = import ./battery.nix pkgs;
# fzf script to switch between tmux sessions
tmux-fzf = pkgs.writeScriptBin "tmux-fzf" ''
tbin() {
${pkgs.tmux}/bin/tmux "$@"
}
fbin() {
${pkgs.fzf}/bin/fzf "$@"
}
__fzf() {
fbin --cycle --height 7 --reverse
}
__list_to_fzf() {
tbin ls -F "#{session_name}" | fzf
}
if [ -n "$TMUX" ]; then
tbin switch-client -t "$(__list_to_fzf)"
else
tbin a -t "$(tbin ls -F "#{session_name}" | fbin)"
fi
'';
in
[
webcam
git-set-desc
git-new-repo
record
uploader
battery
tmux-fzf
]
|