Switch zsh back to fish

Add extracted zsh functions to path

Remove shebang from all scripts as writeShellScriptBin handles that automatically
This commit is contained in:
Evie Litherland-Smith 2024-01-15 14:20:59 +00:00
parent 2dff72c9ff
commit b3988f8eae
6 changed files with 17 additions and 65 deletions

View file

@ -20,7 +20,7 @@
user = "xenia";
system = "x86_64-linux";
group = "users";
shell = "zsh";
shell = "fish";
systemModules = [ ./system/hyprland.nix ];
serviceModules = [ ];
homeModules = [
@ -103,6 +103,7 @@
targets = {
chromium.enable = true;
console.enable = true;
fish.enable = true;
};
image = ./wallpapers/space.png;
base16Scheme =

View file

@ -1,4 +1,5 @@
{ config, lib, pkgs, ... }: {
{ lib, ... }: {
imports = [ ./scripts/default.nix ];
stylix.targets = {
avizo.enable = true;
foot.enable = true;
@ -11,6 +12,7 @@
./Catppuccin-mocha.tmTheme;
programs = rec {
bash.enable = true;
fish.enable = true;
bat = {
enable = true;
config.theme = "Catppuccin-mocha";
@ -60,13 +62,10 @@
direnv = {
enable = true;
nix-direnv.enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
};
fzf = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
enableFishIntegration = true;
};
git = {
enable = true;
@ -124,8 +123,7 @@
};
starship = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
enableFishIntegration = true;
enableTransience = true;
settings = {
command_timeout = 1000;
@ -210,56 +208,5 @@
};
};
};
zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
enableVteIntegration = true;
autocd = true;
historySubstringSearch.enable = true;
initExtra = ''
git-sync-all () {
for DIRECTORY in $HOME/.nixos $HOME/.emacs $HOME/.password-store $HOME/.elfeed $HOME/Documents/Org $HOME/Documents/References; do
echo "--- $DIRECTORY ---"
mkdir -p $DIRECTORY
cd $DIRECTORY && git-sync
cd -
done
}
xdg-query-program () {
FILETYPE=$(xdg-mime query filetype $@)
DEFAULT=$(xdg-mime query default $FILETYPE)
echo "$FILETYPE -> $DEFAULT"
}
rsync-local-config () {
HOST=$1
for TARGET in bat git starship.toml; do
SOURCE="${config.xdg.configHome}/$TARGET"
TMP_TARGET=/tmp/rsync-local-config
TMP_SOURCE=$TMP_TARGET
NIX_SED="${pkgs.gnused}/bin/sed -i 's|/nix/.*/bin/||g'"
NIX_REPLACE="$NIX_SED $TMP_TARGET"
if [[ -e ${config.xdg.configHome}/$TARGET ]]; then
if [[ -d $SOURCE ]]; then
SOURCE=$SOURCE/
TMP_SOURCE=$TMP_SOURCE/
NIX_REPLACE="${pkgs.fd}/bin/fd -g '**' $TMP_TARGET -tfile -x $NIX_SED {};"
fi
${pkgs.rsync}/bin/rsync -avzL --exclude=".git*" $SOURCE $TMP_TARGET
${pkgs.coreutils}/bin/chmod u+rw -R $TMP_SOURCE
${pkgs.bash}/bin/sh -c "$NIX_REPLACE"
${pkgs.rsync}/bin/rsync -avzL --delete --exclude=".git*" $TMP_SOURCE $HOST:.config/$TARGET
${pkgs.coreutils}/bin/rm -rf $TMP_SOURCE
fi
done
}
'';
oh-my-zsh = {
enable = true;
plugins = [ "colored-man-pages" "lol" "rand-quote" ];
theme = "";
};
};
};
}

10
home/scripts/default.nix Normal file
View file

@ -0,0 +1,10 @@
{ pkgs, ... }: {
home.packages = [
(pkgs.writeShellScriptBin "git-sync-all"
(builtins.readFile ./git-sync-all.sh))
(pkgs.writeShellScriptBin "rsync-local-config"
(builtins.readFile ./rsync-local-config.sh))
(pkgs.writeShellScriptBin "xdg-query-program"
(builtins.readFile ./xdg-query-program.sh))
];
}

View file

@ -1,5 +1,3 @@
#!/usr/bin/env bash
for DIRECTORY in $HOME/.nixos $HOME/.emacs $HOME/.password-store $HOME/.elfeed $HOME/Documents/Org $HOME/Documents/References; do
echo "--- $DIRECTORY ---"
mkdir -p $DIRECTORY

View file

@ -1,5 +1,3 @@
#!/usr/bin/env bash
HOST=$1
for TARGET in bat git starship.toml; do
SOURCE="$HOME/.config/$TARGET"

View file

@ -1,5 +1,3 @@
#!/usr/bin/env bash
FILETYPE=$(xdg-mime query filetype $@)
DEFAULT=$(xdg-mime query default $FILETYPE)
echo "$FILETYPE -> $DEFAULT"