2025-05-04 10:53:18 +02:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
cfg = config.features.cli.nushell;
|
|
|
|
in {
|
|
|
|
options.features.cli.nushell.enable = mkEnableOption "enable nushell";
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
programs.nushell = {
|
|
|
|
enable = true;
|
|
|
|
envFile.text = ''
|
|
|
|
$env.config.show_banner = false
|
|
|
|
$env.NIX_PATH = "nixpkgs=channel:nixos-unstable"
|
|
|
|
$env.NIX_LOG = "iunfo"
|
|
|
|
$env.WEBKIT_DISABLE_COMPOSITING_MODE = "1"
|
|
|
|
$env.TERMINAL = "kitty"
|
|
|
|
$env.EDITOR = "nvim"
|
|
|
|
$env.VISUAL = "zed"
|
|
|
|
$env.XDG_DATA_HOME = $"($env.HOME)/.local/share"
|
|
|
|
$env.FZF_DEFAULT_COMMAND = "fd --type f --exclude .git --follow --hidden"
|
2025-05-21 14:23:59 +02:00
|
|
|
$env.SSH_AUTH_SOCK = "/run/user/1000/gnupg/S.gpg-agent.ssh"
|
2025-05-04 10:53:18 +02:00
|
|
|
$env.FLAKE = $"($env.HOME)/p/nixos/nixos-config"
|
2025-05-19 12:53:05 +02:00
|
|
|
source /run/agenix/${config.home.username}-secrets
|
2025-05-04 10:53:18 +02:00
|
|
|
'';
|
|
|
|
configFile.text = ''
|
|
|
|
if (tty) == "/dev/tty1" {
|
|
|
|
exec uwsm start -S -F /run/current-system/sw/bin/Hyprland
|
|
|
|
}
|
|
|
|
if (tty) == "/dev/tty2" {
|
|
|
|
exec gamescope -O HDMI-A-1 -W 1920 -H 1080 --adaptive-sync --hdr-enabled --rt --steam -- steam -pipewire-dmabuf -tenfoot
|
|
|
|
}
|
|
|
|
|
|
|
|
alias .. = cd ..
|
2025-05-05 01:58:36 +02:00
|
|
|
alias ... = cd ...
|
|
|
|
alias h = cd $env.HOME
|
2025-05-04 10:53:18 +02:00
|
|
|
alias b = yazi
|
|
|
|
alias lt = eza --tree --level=2 --long --icons --git
|
|
|
|
alias grep = rg
|
|
|
|
alias just = just --unstable
|
|
|
|
|
|
|
|
alias n = nix
|
|
|
|
alias nd = nix develop -c $nu.current-shell
|
|
|
|
alias ns = nix shell
|
|
|
|
alias nsn = nix shell nixpkgs#
|
|
|
|
alias nb = nix build
|
|
|
|
alias nbn = nix build nixpkgs#
|
|
|
|
alias nf = nix flake
|
|
|
|
|
|
|
|
alias nr = sudo nixos-rebuild --flake .
|
|
|
|
alias nrs = sudo nixos-rebuild switch --flake .#(sys host | get hostname)
|
|
|
|
alias snr = sudo nixos-rebuild --flake .
|
|
|
|
alias snrs = sudo nixos-rebuild --flake . switch
|
|
|
|
alias hm = home-manager --flake .
|
|
|
|
alias hms = home-manager --flake . switch
|
|
|
|
alias hmr = do { cd ~/projects/nix-configurations; nix flake lock --update-input dotfiles; home-manager --flake .#(whoami)@(hostname) switch }
|
|
|
|
|
|
|
|
alias tsu = sudo tailscale up
|
|
|
|
alias tsd = sudo tailscale down
|
|
|
|
|
|
|
|
alias vi = nvim
|
|
|
|
alias vim = nvim
|
|
|
|
|
2025-05-04 19:00:11 +02:00
|
|
|
def history_fuzzy [] {
|
|
|
|
let selected = (
|
|
|
|
history
|
2025-05-19 21:03:09 +02:00
|
|
|
| reverse
|
2025-05-04 19:00:11 +02:00
|
|
|
| get command
|
2025-05-19 21:03:09 +02:00
|
|
|
| uniq
|
|
|
|
| to text
|
|
|
|
| ^fzf
|
2025-05-04 19:00:11 +02:00
|
|
|
)
|
|
|
|
if ($selected | is-not-empty) {
|
2025-05-19 21:03:09 +02:00
|
|
|
commandline edit ($selected)
|
2025-05-04 19:00:11 +02:00
|
|
|
} else {
|
|
|
|
null
|
|
|
|
}
|
|
|
|
}
|
2025-05-05 01:58:36 +02:00
|
|
|
def --env dir_fuzzy [] {
|
|
|
|
let selected = (
|
|
|
|
fd --type directory
|
2025-05-19 21:03:09 +02:00
|
|
|
| ^fzf
|
2025-05-05 01:58:36 +02:00
|
|
|
)
|
|
|
|
cd $selected
|
|
|
|
}
|
2025-05-04 19:00:11 +02:00
|
|
|
def find_fuzzy [] {
|
|
|
|
# Find non-hidden text files with matches for any content and select one via fuzzy search
|
|
|
|
let selected = (
|
|
|
|
^fd --type file --no-hidden -X rg -l --files-with-matches .
|
|
|
|
| lines
|
2025-05-19 21:03:09 +02:00
|
|
|
| to text
|
|
|
|
| ^fzf
|
2025-05-04 19:00:11 +02:00
|
|
|
)
|
|
|
|
if ($selected | is-not-empty) {
|
|
|
|
^$env.EDITOR $selected
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$env.config = {
|
|
|
|
keybindings: [
|
|
|
|
{
|
|
|
|
name: history_fuzzy
|
|
|
|
modifier: control
|
|
|
|
keycode: char_r
|
|
|
|
mode: [emacs, vi_insert, vi_normal]
|
|
|
|
event: [
|
|
|
|
{
|
|
|
|
send: executehostcommand
|
|
|
|
cmd: "history_fuzzy"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2025-05-05 01:58:36 +02:00
|
|
|
{
|
|
|
|
name: dir_fuzzy
|
|
|
|
modifier: alt
|
|
|
|
keycode: char_c
|
|
|
|
mode: [emacs, vi_insert, vi_normal]
|
|
|
|
event: [
|
|
|
|
{
|
|
|
|
send: executehostcommand
|
|
|
|
cmd: "dir_fuzzy"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2025-05-04 19:00:11 +02:00
|
|
|
{
|
|
|
|
name: history_fuzzy
|
|
|
|
modifier: control
|
|
|
|
keycode: char_t
|
|
|
|
mode: [emacs, vi_insert, vi_normal]
|
|
|
|
event: [
|
|
|
|
{
|
|
|
|
send: executehostcommand
|
|
|
|
cmd: "find_fuzzy"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2025-05-04 10:53:18 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|