aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-10-03 07:06:10 +0100
committerAkshay <[email protected]>2021-10-03 07:06:10 +0100
commit072e34034a99a8aac7dc0f3b651a3f1243d06f90 (patch)
tree94789741a98dcf49f200805b9d21553f0cc2e66d
parent94d534975ab228b27d4713f7dec41bfa3900fdfb (diff)
migrate scripts into nix
-rw-r--r--home.nix6
-rw-r--r--programs/readline.nix2
-rw-r--r--programs/tmux.nix4
-rw-r--r--scripts/default.nix26
4 files changed, 33 insertions, 5 deletions
diff --git a/home.nix b/home.nix
index 5230399..3e52d11 100644
--- a/home.nix
+++ b/home.nix
@@ -9,7 +9,6 @@
9 imports = [ 9 imports = [
10 ./programs 10 ./programs
11 ./services 11 ./services
12 # ./scripts
13 ./x 12 ./x
14 ./mail.nix 13 ./mail.nix
15 ]; 14 ];
@@ -55,13 +54,16 @@
55 fd 54 fd
56 du-dust 55 du-dust
57 jq 56 jq
57 stylish-haskell
58 libnotify
59 inotify-tools
58 60
59 # meta 61 # meta
60 nixpkgs-review 62 nixpkgs-review
61 nixpkgs-fmt 63 nixpkgs-fmt
62 nix-prefetch-scripts 64 nix-prefetch-scripts
63 65
64 ]; 66 ] ++ (import ./scripts { inherit pkgs; });
65 67
66 xdg = { 68 xdg = {
67 userDirs = { 69 userDirs = {
diff --git a/programs/readline.nix b/programs/readline.nix
index be43ace..e7b7b33 100644
--- a/programs/readline.nix
+++ b/programs/readline.nix
@@ -7,7 +7,7 @@
7 programs.readline = { 7 programs.readline = {
8 enable = true; 8 enable = true;
9 bindings = { 9 bindings = {
10 "\\C-o" = ''"$HOME/scripts/tmux-fzf.sh\n"''; 10 "\\C-o" = ''tmux-fzf\n'';
11 "\\t" = "menu-complete"; 11 "\\t" = "menu-complete";
12 "\\e[Z" = "menu-complete-backward"; 12 "\\e[Z" = "menu-complete-backward";
13 }; 13 };
diff --git a/programs/tmux.nix b/programs/tmux.nix
index 58369da..30483aa 100644
--- a/programs/tmux.nix
+++ b/programs/tmux.nix
@@ -15,7 +15,7 @@
15 unbind-key C-b 15 unbind-key C-b
16 bind-key C-a send-prefix 16 bind-key C-a send-prefix
17 17
18 bind r source-file ~/.tmux.conf 18 bind r source-file ~/.config/tmux/tmux.conf
19 19
20 set-option -g default-terminal xterm-256color-italic 20 set-option -g default-terminal xterm-256color-italic
21 set escape-time 20 21 set escape-time 20
@@ -79,7 +79,7 @@
79 set -g status-left-length 100 79 set -g status-left-length 100
80 set -g status-left "#[fg=colour15]#(date +"%H%M") #[fg=colour8]hrs " 80 set -g status-left "#[fg=colour15]#(date +"%H%M") #[fg=colour8]hrs "
81 set -ag status-left "#[fg=colour15]#(date +"%d/%m")#[fg=colour8] #(date +"%Y") " 81 set -ag status-left "#[fg=colour15]#(date +"%d/%m")#[fg=colour8] #(date +"%Y") "
82 set -ag status-left "#[fg=colour7]#(~/scripts/bat -q)#[fg=colour12]" 82 set -ag status-left "#[fg=colour7]#(bat -q)#[fg=colour12]"
83 ''; 83 '';
84 }; 84 };
85} 85}
diff --git a/scripts/default.nix b/scripts/default.nix
index a6e5936..35ed43e 100644
--- a/scripts/default.nix
+++ b/scripts/default.nix
@@ -36,11 +36,37 @@ let
36 # battery script 36 # battery script
37 battery = import ./battery.nix pkgs; 37 battery = import ./battery.nix pkgs;
38 38
39 # fzf script to switch between tmux sessions
40 tmux-fzf = pkgs.writeScriptBin "tmux-fzf" ''
41 tbin() {
42 ${pkgs.tmux}/bin/tmux "$@"
43 }
44 fbin() {
45 ${pkgs.fzf}/bin/fzf "$@"
46 }
47
48 __fzf() {
49 fbin --cycle --height 7 --reverse
50 }
51
52 __list_to_fzf() {
53 fbin ls -F "#{session_name}" | fzf
54 }
55
56 if [ -n "$TMUX" ]; then
57 tbin switch-client -t "$(__list_to_fzf)"
58 else
59 tbin a -t "$(tbin ls -F "#{session_name}" | fbin)"
60 fi
61 '';
62
39in 63in
40[ 64[
41 webcam 65 webcam
42 git-set-desc 66 git-set-desc
67 git-new-repo
43 record 68 record
44 uploader 69 uploader
45 battery 70 battery
71 tmux-fzf
46] 72]