build(nix/flake): adding tmux-setup script
This commit is contained in:
parent
3394a073a3
commit
9c30479fcf
1 changed files with 25 additions and 7 deletions
32
flake.nix
32
flake.nix
|
|
@ -7,16 +7,34 @@
|
|||
};
|
||||
outputs = { self, nixpkgs, flake-utils, c_formatter_42 }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let pkgs = nixpkgs.legacyPackages.${system};
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
tmux-setup = pkgs.writeShellScriptBin "tmux-setup" ''
|
||||
#!/usr/bin/env sh
|
||||
SESSION="ft_ping"
|
||||
DIR=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
|
||||
if ! tmux has-session -t $SESSION 2>/dev/null; then
|
||||
tmux new-session -d -s $SESSION -c "$DIR" -n dev
|
||||
tmux send-keys -t $SESSION:0 'vim' C-m
|
||||
tmux split-window -h -p 30 -t $SESSION:0 -c "$DIR"
|
||||
tmux send-keys -t $SESSION:0.1 'exec zsh' C-m
|
||||
tmux new-window -t $SESSION:1 -n git -c "$DIR"
|
||||
tmux send-keys -t $SESSION:1 'lazygit' C-m
|
||||
fi
|
||||
tmux select-window -t $SESSION:0
|
||||
tmux select-pane -t $SESSION:0.0
|
||||
tmux attach -t $SESSION
|
||||
'';
|
||||
in {
|
||||
devShell = pkgs.mkShell {
|
||||
packages = [
|
||||
packages = with pkgs; [
|
||||
tmux-setup
|
||||
c_formatter_42.packages.${system}.default
|
||||
pkgs.clang
|
||||
pkgs.clang-tools
|
||||
pkgs.fastmod
|
||||
pkgs.tree
|
||||
] ++ (if pkgs.stdenv.isLinux then [ pkgs.valgrind ] else [ ]);
|
||||
clang
|
||||
clang-tools
|
||||
fastmod
|
||||
tree
|
||||
] ++ (if stdenv.isLinux then [ pkgs.valgrind ] else [ ]);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue