2023-07-16 22:17:50 +00:00
|
|
|
{ pkgs, lib, ... }:
|
2021-12-06 22:35:29 +00:00
|
|
|
|
2022-12-20 19:34:16 +00:00
|
|
|
let
|
2023-04-10 17:24:05 +00:00
|
|
|
inherit (pkgs) fetchFromGitHub;
|
2022-12-20 19:34:16 +00:00
|
|
|
inherit (pkgs.stdenv) isDarwin;
|
|
|
|
inherit (lib) optionals;
|
2024-07-19 23:21:57 +00:00
|
|
|
inherit (lib.attrsets) optionalAttrs;
|
2022-12-20 19:34:16 +00:00
|
|
|
in
|
2021-12-06 22:35:29 +00:00
|
|
|
{
|
2022-12-20 19:34:16 +00:00
|
|
|
|
2023-09-10 15:36:32 +00:00
|
|
|
home.packages = with pkgs; optionals isDarwin [
|
2022-12-20 19:34:16 +00:00
|
|
|
terminal-notifier
|
|
|
|
];
|
2022-12-19 21:02:48 +00:00
|
|
|
|
2021-12-06 22:35:29 +00:00
|
|
|
programs.fish = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
plugins = [
|
2022-04-27 20:16:55 +00:00
|
|
|
# https://github.com/dracula/fish
|
2021-12-06 22:35:29 +00:00
|
|
|
{
|
|
|
|
name = "dracula";
|
2023-04-10 17:24:05 +00:00
|
|
|
src = fetchFromGitHub {
|
2021-12-06 22:35:29 +00:00
|
|
|
owner = "dracula";
|
|
|
|
repo = "fish";
|
2023-10-02 19:33:14 +00:00
|
|
|
rev = "269cd7d76d5104fdc2721db7b8848f6224bdf554";
|
|
|
|
hash = "sha256-Hyq4EfSmWmxwCYhp3O8agr7VWFAflcUe8BUKh50fNfY=";
|
2021-12-06 22:35:29 +00:00
|
|
|
};
|
|
|
|
}
|
2022-01-10 11:28:26 +00:00
|
|
|
|
2022-12-19 21:02:48 +00:00
|
|
|
# https://github.com/franciscolourenco/done/releases
|
2022-03-02 22:31:45 +00:00
|
|
|
{
|
|
|
|
name = "done-fish";
|
2023-04-10 17:24:05 +00:00
|
|
|
src = fetchFromGitHub {
|
2022-12-19 21:02:48 +00:00
|
|
|
owner = "franciscolourenco";
|
2022-03-02 22:31:45 +00:00
|
|
|
repo = "done";
|
2023-11-18 20:40:58 +00:00
|
|
|
rev = "1.19.1";
|
|
|
|
hash = "sha256-BGHfwKoMfOZUsa05kEt8W2luc1aC3Su/OyaGmcb4UiI=";
|
2022-03-02 22:31:45 +00:00
|
|
|
};
|
2022-01-10 11:28:26 +00:00
|
|
|
}
|
|
|
|
|
2022-04-27 20:16:55 +00:00
|
|
|
# https://github.com/jorgebucaran/autopair.fish/releases
|
2022-01-10 11:28:26 +00:00
|
|
|
{
|
|
|
|
name = "autopair-fish";
|
2023-04-10 17:24:05 +00:00
|
|
|
src = fetchFromGitHub {
|
2022-01-10 11:28:26 +00:00
|
|
|
owner = "jorgebucaran";
|
|
|
|
repo = "autopair.fish";
|
2022-07-05 19:10:07 +00:00
|
|
|
rev = "1.0.4";
|
|
|
|
sha256 = "sha256-s1o188TlwpUQEN3X5MxUlD/2CFCpEkWu83U9O+wg3VU=";
|
2022-01-10 11:28:26 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-04-27 20:16:55 +00:00
|
|
|
# https://github.com/PatrickF1/colored_man_pages.fish
|
2022-01-10 11:28:26 +00:00
|
|
|
{
|
|
|
|
name = "colored_man_pages";
|
2023-04-10 17:24:05 +00:00
|
|
|
src = fetchFromGitHub {
|
2022-01-10 11:28:26 +00:00
|
|
|
owner = "PatrickF1";
|
|
|
|
repo = "colored_man_pages.fish";
|
2022-05-22 21:05:13 +00:00
|
|
|
rev = "f885c2507128b70d6c41b043070a8f399988bc7a";
|
|
|
|
sha256 = "sha256-ii9gdBPlC1/P1N9xJzqomrkyDqIdTg+iCg0mwNVq2EU=";
|
2022-01-10 11:28:26 +00:00
|
|
|
};
|
|
|
|
}
|
2021-12-06 22:35:29 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
shellAliases = {
|
2022-02-16 08:36:08 +00:00
|
|
|
upa = "nix flake update ~/.config/nixpkgs -v && upn";
|
|
|
|
ngc = "nix-collect-garbage -d && sudo nix-collect-garbage -d";
|
|
|
|
nsr = "sudo nix-store --verify --check-contents --repair";
|
|
|
|
|
2023-12-12 23:45:38 +00:00
|
|
|
la = "${lib.getExe pkgs.eza} --long --all --group --header --group-directories-first --sort=type --icons";
|
|
|
|
lg = "${lib.getExe pkgs.eza} --long --all --group --header --git";
|
|
|
|
lt = "${lib.getExe pkgs.eza} --long --all --group --header --tree --level ";
|
2024-07-19 23:21:57 +00:00
|
|
|
} // optionalAttrs isDarwin {
|
|
|
|
tailscale = "/Applications/Tailscale.app/Contents/MacOS/Tailscale";
|
2021-12-06 22:35:29 +00:00
|
|
|
};
|
|
|
|
|
2021-12-12 18:19:28 +00:00
|
|
|
functions = {
|
2023-10-01 20:56:08 +00:00
|
|
|
base64decode = /* fish */ ''
|
2022-08-20 19:10:55 +00:00
|
|
|
echo "$argv" | base64 --decode
|
|
|
|
'';
|
|
|
|
|
2024-07-24 07:54:07 +00:00
|
|
|
nrsw = /* fish */ ''
|
|
|
|
set -f os (uname)
|
|
|
|
set -f other_hostname $argv[1]
|
|
|
|
|
|
|
|
switch $os
|
|
|
|
case Darwin
|
2024-11-08 22:01:20 +00:00
|
|
|
set -f nix_hostname (scutil --get LocalHostName)
|
2024-07-24 07:54:07 +00:00
|
|
|
set -f config_dir "$HOME/.config/nixpkgs"
|
|
|
|
case Linux
|
2024-11-08 22:01:20 +00:00
|
|
|
set -f nix_hostname (hostname -s)
|
2024-07-24 07:54:07 +00:00
|
|
|
set -f config_dir /etc/nixos
|
|
|
|
case '*'
|
|
|
|
echo "Unsupported OS"
|
|
|
|
exit 1
|
|
|
|
end
|
|
|
|
|
|
|
|
pushd "$config_dir"
|
|
|
|
rm -rf result
|
|
|
|
|
|
|
|
if test -z "$DIRENV_DIR"
|
|
|
|
eval (direnv export fish 2>/dev/null)
|
|
|
|
end
|
|
|
|
|
|
|
|
if test "$other_hostname" = ""
|
2024-11-08 22:01:20 +00:00
|
|
|
just deploy-local-machine "$nix_hostname"
|
2024-07-24 07:54:07 +00:00
|
|
|
else
|
|
|
|
just deploy-remote-machine "$other_hostname"
|
|
|
|
end
|
|
|
|
|
|
|
|
rm -f result
|
|
|
|
popd
|
|
|
|
'';
|
|
|
|
|
2023-10-01 20:56:08 +00:00
|
|
|
upn = /* fish */ ''
|
2023-05-04 09:14:12 +00:00
|
|
|
set -f os (uname)
|
|
|
|
|
|
|
|
switch $os
|
|
|
|
case Darwin
|
|
|
|
$HOME/.config/nixpkgs/home/programs/nvim/update-plugins.sh
|
|
|
|
case Linux
|
|
|
|
/etc/nixos/home/programs/nvim/update-plugins.sh
|
|
|
|
case '*'
|
|
|
|
echo "Unsupported OS"
|
|
|
|
exit 1
|
|
|
|
end
|
2022-06-29 15:39:37 +00:00
|
|
|
'';
|
|
|
|
|
2023-10-01 20:56:08 +00:00
|
|
|
upp = /* fish */ ''
|
2022-03-19 21:54:55 +00:00
|
|
|
if not test -f ./.envrc; or rg --quiet '^use flake$' ./.envrc
|
2021-12-28 20:56:14 +00:00
|
|
|
nix flake update ./ -v
|
|
|
|
else
|
2021-12-29 23:55:41 +00:00
|
|
|
nix flake update (rg --no-line-number --color never '^use flake' ./.envrc | cut -d ' ' -f 3 | xargs -I {} sh -c 'echo {}') -v
|
2021-12-28 20:56:14 +00:00
|
|
|
end
|
|
|
|
'';
|
|
|
|
|
2023-12-27 22:49:39 +00:00
|
|
|
wezssh = /* fish */ ''
|
|
|
|
wezterm cli spawn --domain-name "SSH:$argv"
|
|
|
|
'';
|
|
|
|
|
2023-10-01 20:56:08 +00:00
|
|
|
wget-browser = /* fish */ ''
|
2021-12-12 18:19:28 +00:00
|
|
|
set user_agent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15"
|
2023-12-12 23:45:38 +00:00
|
|
|
${lib.getExe pkgs.wget} -U "$user_agent" $argv
|
2021-12-12 18:19:28 +00:00
|
|
|
'';
|
|
|
|
|
2023-10-01 20:56:08 +00:00
|
|
|
aria-browser = /* fish */ ''
|
2021-12-29 23:55:41 +00:00
|
|
|
set user_agent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15"
|
2023-12-12 23:45:38 +00:00
|
|
|
${lib.getExe pkgs.aria2} -U "$user_agent" --file-allocation none --async-dns=false -x 2 $argv
|
2023-06-05 14:32:21 +00:00
|
|
|
'';
|
2024-06-17 22:02:32 +00:00
|
|
|
|
|
|
|
macos-app-id = /* fish */ ''
|
|
|
|
osascript -e "id of app \"$argv\""
|
|
|
|
'';
|
2021-12-12 18:19:28 +00:00
|
|
|
};
|
|
|
|
|
2023-10-01 20:56:08 +00:00
|
|
|
shellInit = /* fish */ ''
|
2021-12-27 20:24:11 +00:00
|
|
|
# Disable greeting
|
|
|
|
set fish_greeting
|
|
|
|
|
2022-01-05 09:52:59 +00:00
|
|
|
if test -d "$HOME/.bin"
|
|
|
|
set -gx PATH "$HOME/.bin" $PATH
|
2021-12-06 22:35:29 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# Custom Scripts
|
|
|
|
if test -d "$HOME/.config/fish/custom-scripts"
|
|
|
|
for custom_script in $HOME/.config/fish/custom-scripts/*.fish
|
|
|
|
source "$custom_script"
|
|
|
|
end
|
|
|
|
end
|
2022-03-02 22:31:45 +00:00
|
|
|
|
|
|
|
# Plugin: done
|
|
|
|
set -g __done_min_cmd_duration 10000
|
2021-12-06 22:35:29 +00:00
|
|
|
'';
|
|
|
|
};
|
2022-12-20 16:56:47 +00:00
|
|
|
|
|
|
|
xdg.configFile."fish/conf.d" = {
|
|
|
|
source = ../config/fish;
|
|
|
|
recursive = true;
|
|
|
|
};
|
2021-12-06 22:35:29 +00:00
|
|
|
}
|