ft: home-manager terminal
This commit is contained in:
1 parent
098a146863
commit
b3f3902737
22 files changed
+255
-34
No files matched your search
@@ -19,6 +19,7 @@
|
|||||||
};
|
};
|
||||||
hardware.tuxedo-drivers.enable = true;
|
hardware.tuxedo-drivers.enable = true;
|
||||||
|
|
||||||
|
# FIXME: this patch does not work
|
||||||
# adds a `stretch_aspect` scaler (Valve/gamescope#927) and lets `--rt` use the
|
# adds a `stretch_aspect` scaler (Valve/gamescope#927) and lets `--rt` use the
|
||||||
# rtprio limit from modules/gaming.nix instead of CAP_SYS_NICE.
|
# rtprio limit from modules/gaming.nix instead of CAP_SYS_NICE.
|
||||||
# nixpkgs.overlays = [
|
# nixpkgs.overlays = [
|
||||||
|
|||||||
@@ -59,6 +59,7 @@
|
|||||||
yad
|
yad
|
||||||
brightnessctl
|
brightnessctl
|
||||||
grim
|
grim
|
||||||
|
file
|
||||||
tree
|
tree
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
+31
-18
@@ -53,22 +53,35 @@
|
|||||||
vim
|
vim
|
||||||
];
|
];
|
||||||
|
|
||||||
# TODO: switch to home manager
|
home-manager = {
|
||||||
# home-manager = {
|
useGlobalPkgs = true;
|
||||||
# useGlobalPkgs = true;
|
useUserPackages = true;
|
||||||
# useUserPackages = true;
|
extraSpecialArgs = { inherit inputs; };
|
||||||
# extraSpecialArgs = { inherit inputs; };
|
backupFileExtension = "bck";
|
||||||
# # Move a file home-manager would overwrite aside instead of failing.
|
|
||||||
# backupFileExtension = "backup";
|
users."djai" = {
|
||||||
#
|
programs.home-manager.enable = true;
|
||||||
# users.djai = {
|
|
||||||
# home.stateVersion = "26.05";
|
home.file.".ssh/config".text = ''
|
||||||
# programs.home-manager.enable = true;
|
Include ${config.sops.secrets."ssh-config".path}
|
||||||
#
|
'';
|
||||||
# # TODO: unified ssh-config secret
|
|
||||||
# home.file.".ssh/config".text = ''
|
home = {
|
||||||
# Include ${config.sops.secrets."ssh-config".path}
|
stateVersion = "26.05";
|
||||||
# '';
|
sessionPath = [
|
||||||
# };
|
"$HOME/bin"
|
||||||
# };
|
"$HOME/.local/bin"
|
||||||
|
"$HOME/.cargo/bin"
|
||||||
|
"$HOME/Scripts"
|
||||||
|
];
|
||||||
|
|
||||||
|
sessionVariables = {
|
||||||
|
NEWT_COLORS_FILE = "$HOME/.newtColours";
|
||||||
|
BROWSER = "librewolf";
|
||||||
|
EDITOR = "nvim";
|
||||||
|
STARSHIP_LOG = "error";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
@@ -64,6 +64,7 @@
|
|||||||
hyprpicker
|
hyprpicker
|
||||||
hyprsunset
|
hyprsunset
|
||||||
wf-recorder
|
wf-recorder
|
||||||
|
grimblast
|
||||||
wmctrl
|
wmctrl
|
||||||
hyprprop
|
hyprprop
|
||||||
hyprlandPlugins.hypr-darkwindow
|
hyprlandPlugins.hypr-darkwindow
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
imports = [
|
||||||
|
./fish.nix
|
||||||
|
./kitty.nix
|
||||||
|
];
|
||||||
|
|
||||||
environment.defaultPackages = with pkgs; [
|
environment.defaultPackages = with pkgs; [
|
||||||
fbterm
|
fbterm
|
||||||
kitty
|
kitty
|
||||||
starship
|
starship
|
||||||
];
|
];
|
||||||
|
|
||||||
# TODO: switch to home manager
|
# keeping these here so root also benefits
|
||||||
programs.fish.enable = true;
|
programs.fish.enable = true;
|
||||||
programs.tmux = {
|
programs.tmux = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -18,19 +23,4 @@
|
|||||||
resurrect
|
resurrect
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# home-manager.users.djai = {
|
|
||||||
# programs.fish.enable = true;
|
|
||||||
# programs.tmux.enable = true;
|
|
||||||
#
|
|
||||||
# programs.kitty = {
|
|
||||||
# enable = true;
|
|
||||||
# settings = {
|
|
||||||
# shell = "${pkgs.tmux}/bin/tmux";
|
|
||||||
# font_family = "Iosevka Nerd Font";
|
|
||||||
# };
|
|
||||||
# extraConfig = ""; # TODO theming
|
|
||||||
# };
|
|
||||||
#
|
|
||||||
# };
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
case Hyprland
|
||||||
|
hyprctl dispatch 'hl.dsp.focus({ direction = "left" })'
|
||||||
|
for i in (ls | grep "$argv[1]")
|
||||||
|
sleep 0.05
|
||||||
|
copy "$i"
|
||||||
|
sleep 0.05
|
||||||
|
hyprctl dispatch 'hl.dsp.send_shortcut({ mods = "CTRL", key = "v" })'
|
||||||
|
end
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
switch "$XDG_SESSION_TYPE"
|
||||||
|
case wayland
|
||||||
|
echo "file://$(realpath -- "$argv")" | wl-copy -t text/uri-list
|
||||||
|
case x11
|
||||||
|
echo "file://$(realpath -- "$argv")" | xclip -i -selection clipboard -t text/uri-list
|
||||||
|
end
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
if test -z "$argv[1]"
|
||||||
|
set dir '.'
|
||||||
|
else
|
||||||
|
set dir "$argv[1]"
|
||||||
|
end
|
||||||
|
for i in (find "$dir" -maxdepth 1 -type d )
|
||||||
|
set b (find "$i" -type f| wc -l)
|
||||||
|
printf "%d/%s\n" $b (basename "$i")
|
||||||
|
end | sort -nr | column -ts/
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
set dest "$(fzf)"
|
||||||
|
if test $status -eq 0
|
||||||
|
cd "$(realpath (dirname "$dest"))"
|
||||||
|
end
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
string match -qr '^(exit|ls$|clear)' -- $argv
|
||||||
|
and history delete --exact --case-sensitive -- (string trim -r $argv)
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
rename.sh "$argv"
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
if test -n "$argv"
|
||||||
|
eval "nix-shell --run fish -p" (string join -- " -p " $argv)
|
||||||
|
else
|
||||||
|
nix-shell --run fish
|
||||||
|
end
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
set tempfile '/tmp/chosendir'
|
||||||
|
command ranger --choosedir=$tempfile (pwd) $argv
|
||||||
|
|
||||||
|
if test -f $tempfile
|
||||||
|
if [ (cat $tempfile) != (pwd) ]
|
||||||
|
cd (cat $tempfile)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
rm -f $tempfile
|
||||||
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
echo (cat -- "$argv")
|
||||||
|
fish -c (cat -- "$argv")
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
if test -n "$argv[2]"
|
||||||
|
echo (cat -- "$argv[1]" | sed -n $argv[2]p)
|
||||||
|
fish -c (cat -- "$argv[1]" | sed -n $argv[2]p)
|
||||||
|
else
|
||||||
|
cat -n -- "$argv[1]"
|
||||||
|
end
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
tr -dc A-Za-z0-9 </dev/urandom | head -c 32
|
||||||
|
echo
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
perl -e 'foreach $a(@ARGV){print "\e[48:2::".join(":",unpack("C*",pack("H*",$a)))."m \e[49m "};print "\n"' "$argv"
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
if test "$argv" = !!
|
||||||
|
echo sudo $history[1]
|
||||||
|
eval command sudo $history[1]
|
||||||
|
else
|
||||||
|
command sudo $argv
|
||||||
|
end
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
if set -q TMUX
|
||||||
|
set -l name (tmux display -p '#{session_name}')
|
||||||
|
if test -n "$name"; and string match -qr '^[0-9]+' -- $name
|
||||||
|
set num (string match -rim 1 "[0-9]*" -- $name)
|
||||||
|
tmux rename-session "$num: cmd: $argv[1]" 2>/dev/null
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
set tempfile /tmp/chosendir
|
||||||
|
command yazi cwd-file=$tempfile (pwd) $argv
|
||||||
|
|
||||||
|
if test -f $tempfile
|
||||||
|
if [ (cat $tempfile) != (pwd) ]
|
||||||
|
cd (cat $tempfile)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
rm -f $tempfile
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
# automatically discover functions in the relative fish functions directory
|
||||||
|
fishFuncDir = ./fish-config/functions;
|
||||||
|
fishFuncs = lib.attrsets.mapAttrs'
|
||||||
|
(name: _: lib.nameValuePair (lib.strings.removeSuffix ".fish" "${name}") ({
|
||||||
|
body = builtins.readFile (fishFuncDir + "/${name}");
|
||||||
|
}))
|
||||||
|
(lib.attrsets.filterAttrs
|
||||||
|
(name: type: type == "regular")
|
||||||
|
(builtins.readDir fishFuncDir)
|
||||||
|
);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
home-manager.users.djai.programs.fish = {
|
||||||
|
enable = true;
|
||||||
|
binds = {
|
||||||
|
"\cf" = {
|
||||||
|
command = "forward-char";
|
||||||
|
mode = "insert";
|
||||||
|
};
|
||||||
|
"\ef" = {
|
||||||
|
command = "forward-word";
|
||||||
|
mode = "insert";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
shellInit = ''
|
||||||
|
# start fbterm if in raw tty
|
||||||
|
if string match -qr "/dev/tty[2-9]" (tty)
|
||||||
|
fbterm -- env TERM=fbterm tmux new
|
||||||
|
end
|
||||||
|
|
||||||
|
[ -d "$HOME/.cargo/env.fish" ] && source "$HOME/.cargo/env.fish"
|
||||||
|
'';
|
||||||
|
|
||||||
|
interactiveShellInit = ''
|
||||||
|
fish_vi_key_bindings
|
||||||
|
starship init fish | source
|
||||||
|
fish_config theme choose "Catppuccin Macchiato"
|
||||||
|
|
||||||
|
if test -n "$TMUX"
|
||||||
|
ascii.sh
|
||||||
|
else
|
||||||
|
if test "$TERM" != "linux"
|
||||||
|
tmux new
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# make clear also remove scrollback on kitty
|
||||||
|
[ "(set -q TERM)" -a "$TERM" = "xterm-kitty" ] && alias clear "printf '\033[2J\033[3J\033[1;1H'"
|
||||||
|
'';
|
||||||
|
|
||||||
|
loginShellInit = ''
|
||||||
|
~/Scripts/diaryEntry.sh > /dev/null # TODO: move to somewhere
|
||||||
|
'';
|
||||||
|
|
||||||
|
shellAbbrs = {
|
||||||
|
"webcam" = "mpv av://v4l2:/dev/video0 --profile=low-latency --untimed";
|
||||||
|
"venv" = ". .venv/bin/activate.fish";
|
||||||
|
"rug" = "sudo openconnect --protocol=gp safenet.vpn.rug.nl";
|
||||||
|
"dia" = "nvim (date +%F)";
|
||||||
|
|
||||||
|
"rm" = "rm -I";
|
||||||
|
"mv" = "mv -vn";
|
||||||
|
"make" = "make -j8";
|
||||||
|
|
||||||
|
"ll" = "ls -hlav --ignore=..";
|
||||||
|
"l" = "ls -lav --ignore=.\?\*";
|
||||||
|
"la" = "ls -A";
|
||||||
|
|
||||||
|
"lg" = "lazygit";
|
||||||
|
"fih" = "fish";
|
||||||
|
"twi" = "twitch";
|
||||||
|
"keh" = "kitten icat";
|
||||||
|
};
|
||||||
|
|
||||||
|
# discovered functions + overrides
|
||||||
|
functions = fishFuncs // {
|
||||||
|
tmux-updater = fishFuncs.tmux-updater // {onEvent = "fish_preexec";};
|
||||||
|
histdelete = fishFuncs.histdelete // {onEvent = "fish_postexec";};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
home-manager.users."djai".home.shell.enableFishIntegration = true;
|
||||||
|
|
||||||
|
home.file.".config/fish/themes".source = config.lib.file.mkOutOfStoreSymLink ./fish-config/themes/;
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
home-manager.users."djai".programs.kitty = {
|
||||||
|
enable = true;
|
||||||
|
keybindings = {
|
||||||
|
"ctrl+shift+t" = "new_tab_with_cwd";
|
||||||
|
"ctrl+shift+enter" = "new_window_with_cwd";
|
||||||
|
"ctrl+shift+b" = "detach_window";
|
||||||
|
|
||||||
|
"ctrl+j" = "neighboring_window down";
|
||||||
|
"ctrl+k" = "neighboring_window up";
|
||||||
|
"ctrl+h" = "neighboring_window left";
|
||||||
|
"ctrl+l" = "neighboring_window right";
|
||||||
|
|
||||||
|
"ctrl+shift+n" = "new_os_window_with_cwd";
|
||||||
|
};
|
||||||
|
themeFile = "Catppuccin-Macchiato";
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
shell = "${pkgs.fish}/bin/fish";
|
||||||
|
font_family = "CaskaydiaCove Nerd Font Mono";
|
||||||
|
close_on_child_death = true;
|
||||||
|
enable_audio_bell = false;
|
||||||
|
|
||||||
|
window_padding_width = 6;
|
||||||
|
tab_bar_min_tabs = 1;
|
||||||
|
tab_bar_edge = "bottom";
|
||||||
|
tab_bar_style = "powerline";
|
||||||
|
tab_powerline_style = "slanted";
|
||||||
|
tab_title_template = "{title}{' - {}'.format(num_windows) if num_windows > 1 else ''}";
|
||||||
|
|
||||||
|
allow_remote_control = "password";
|
||||||
|
listen_on = "unix:@kitty";
|
||||||
|
remote_control_password = " \"\" allow_safe.py"; # FIXME: seems to be borked on nixos
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
home-manager.users."djai".home.file.".config/kitty/allow_safe.py".text = ''
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
def is_cmd_allowed(pcmd, window, from_socket, extra_data):
|
||||||
|
if pcmd['cmd'] == "launch":
|
||||||
|
return 'args' not in pcmd['payload']
|
||||||
|
return False
|
||||||
|
'';
|
||||||
|
}
|
||||||