Skip to content

Instantly share code, notes, and snippets.

@balsoft
Created March 13, 2018 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save balsoft/d158ad4a919b5e4b08e0f37fc6cba9e6 to your computer and use it in GitHub Desktop.
Save balsoft/d158ad4a919b5e4b08e0f37fc6cba9e6 to your computer and use it in GitHub Desktop.
{pkgs, ...}:
{
programs.home-manager = {
enable = true;
path = https://github.com/rycee/home-manager/archive/master.tar.gz;
};
programs.zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
oh-my-zsh = {
enable = true;
theme = "agnoster";
plugins = [
"git"
"compleat"
"dirhistory"
];
};
plugins = [
{
# will source zsh-autosuggestions.plugin.zsh
name = "zsh-syntax-highlighting";
src = pkgs.fetchgit {
url = "git://github.com/zsh-users/zsh-syntax-highlighting";
};
}
];
initExtra = ''
heroku(){
docker run -it --rm -u $(id -u):$(id -g) -w "$HOME" \
-v /etc/passwd:/etc/passwd:ro \
-v /etc/group:/etc/group:ro \
-v /etc/localtime:/etc/localtime:ro \
-v /home:/home \
-v /tmp:/tmp \
-v /run/user/$(id -u):/run/user/$(id -u) \
--name heroku \
johnnagro/heroku-toolbelt "$@"
}
#randomquote(){${pkgs.curl}/bin/curl -s $(${pkgs.curl}/bin/curl -s "http://bash.im/forweb/"|grep -o "http://bash.im/quote/[[:digit:]]*") | iconv -f CP1251 -t UTF-8 | ${pkgs.gnugrep}/bin/grep "<div class=\"text\">[^<]*" -a|${pkgs.gnused}/bin/sed "s/<br>/\x0a/g" | ${pkgs.gnused}/bin/sed "s/<br \/>/\x0a/"|${pkgs.gnused}/bin/sed "s/<div class=\x22text\x22>//"|${pkgs.gnused}/bin/sed "s/<\/div>//"|${pkgs.gnused}/bin/sed "s/&quot;/\"/g" |${pkgs.gnused}/bin/sed "s/&gt;/>/g"| ${pkgs.gnused}/bin/sed "s/&lt;/</g"| ${pkgs.gnused}/bin/sed 's/^\s*//g'}
# commands to ignore
cmdignore=(htop tmux top vim)
function active_window_id () {
if [[ -n $DISPLAY ]] ; then
xprop -root _NET_ACTIVE_WINDOW | awk '{print $5}'
return
fi
echo nowindowid
}
# end and compare timer, notify-send if needed
function notifyosd-precmd() {
retval=$?
if [ ! -z "$cmd" ]; then
cmd_end=`date +%s`
((cmd_time=$cmd_end - $cmd_start))
fi
if [ $retval -eq 0 ]; then
cmdstat="succesfully"
sound="/home/balsoft/.local/share/gnome-shell/extensions/timepp@zagortenay333/data/sounds/bell.ogg"
else
cmdstat="with errors"
sound="/home/balsoft/.local/share/gnome-shell/extensions/timepp@zagortenay333/data/sounds/goat.ogg"
fi
if [ ! -z "$cmd" -a $cmd_time -gt 10 -a ! $term_window = $(active_window_id) ]; then
if [ ! -z $SSH_TTY ] ; then
notify-send -i utilities-terminal -u low "$cmd on `hostname` completed $cmdstat" "\"$cmd\" took $cmd_time seconds"
else
notify-send -i utilities-terminal -u low ""$cmd" completed $cmdstat" "\"$cmd\" took $cmd_time seconds"
fi
gsound-play -f $sound
fi
unset cmd
}
# make sure this plays nicely with any existing precmd
precmd_functions+=( notifyosd-precmd )
# get command name and start the timer
function notifyosd-preexec() {
cmd=$1
term_window=$(active_window_id)
cmd_start=`date +%s`
}
# make sure this plays nicely with any existing preexec
preexec_functions+=( notifyosd-preexec )
'';
};
gtk = {
enable = true;
iconTheme = {
name = "Papirus-Dark";
package = pkgs.papirus-icon-theme;
};
theme = {
name = "Adapta-Nokto";
package = pkgs.adapta-gtk-theme;
};
};
home.packages = with pkgs; [
wget
curl
git
chromium
vscode
nox
discord
tdesktop
zip
unrar
mc
telepathy_haze
telepathy_idle
libnotify
# powerline-fonts
vlc
];
home.keyboard = {
options = ["grp:caps_toggle" "grp_led:caps"];
};
programs.command-not-found.enable = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment