336 lines
9.4 KiB
Nix
336 lines
9.4 KiB
Nix
# https://nix-community.github.io/home-manager/options.html
|
|
{ pkgs, config, ... }:
|
|
|
|
{
|
|
imports = [
|
|
./modules/jump.nix
|
|
./modules/micro.nix
|
|
];
|
|
disabledModules = [
|
|
"programs/micro.nix"
|
|
];
|
|
|
|
nixpkgs.config.allowUnfree = true;
|
|
|
|
home.stateVersion = "22.05";
|
|
home.sessionVariables.EDITOR = "micro";
|
|
programs.bash.initExtra = ''
|
|
if [ "$COLORTERM" = "truecolor" ] || [ "$TERM" == "xterm" ]; then
|
|
export TERM=xterm-256color
|
|
export MICRO_TRUECOLOR=1
|
|
fi
|
|
|
|
parse_git_branch() {
|
|
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
|
|
}
|
|
export PS1='\[\033[01;32m\]\u@\h\[\033[01;37m\] \[\033[01;34m\]\W\[\033[33m\]$(parse_git_branch)\[\033[01;32m\]\$\[\033[00m\] '
|
|
|
|
# ssh autocomplete
|
|
if test -f ~/.ssh/config; then
|
|
complete -W "$(cat ~/.ssh/config | grep '^Host ' | cut -b 6- | grep -v "\*")" ssh
|
|
complete -W "$(cat ~/.ssh/config | grep '^Host ' | cut -b 6- | grep -v "\*")" rssh
|
|
complete -W "$(cat ~/.ssh/config | grep '^Host ' | cut -b 6- | grep -v "\*")" vpn
|
|
complete -W "$(cat ~/.ssh/config | grep '^Host ' | cut -b 6- | grep -v "\*")" lvpn
|
|
complete -W "$(cat ~/.ssh/config | grep '^Host ' | cut -b 6- | grep -v "\*")" dvpn
|
|
complete -W "$(cat ~/.ssh/config | grep '^Host ' | cut -b 6- | grep -v "\*")" scp
|
|
complete -W "$(cat ~/.ssh/config | grep '^Host ' | cut -b 6- | grep -v "\*")" remote-init
|
|
fi
|
|
|
|
# remote-exec and tldr
|
|
complete -F _command remote
|
|
complete -F _command remote-quick
|
|
#complete -F _command tldr
|
|
|
|
function atom_nix {
|
|
nix-shell -p atom --run "atom $(printf "%q " "$@") --in-process-gpu --no-sandbox"
|
|
}
|
|
'';
|
|
# TODO: split ^
|
|
|
|
|
|
home.packages = with pkgs; [
|
|
rsync
|
|
bind.dnsutils
|
|
xclip
|
|
|
|
zip
|
|
unrar
|
|
unzip
|
|
atool
|
|
p7zip
|
|
bzip2
|
|
gzip
|
|
atool
|
|
|
|
micro
|
|
aspell
|
|
aspellDicts.en
|
|
aspellDicts.nb
|
|
vimv
|
|
dos2unix
|
|
|
|
pandoc
|
|
graphviz
|
|
vgmstream
|
|
gallery-dl
|
|
yt-dlp
|
|
youtube-dl
|
|
ffmpeg-full
|
|
|
|
git
|
|
curl
|
|
wget
|
|
|
|
visidata
|
|
|
|
lolcat
|
|
toilet
|
|
boxes
|
|
tewisay
|
|
ponysay
|
|
|
|
#tldr
|
|
entr
|
|
axel aria
|
|
bat bat-extras.batman # TODO: condition on programs.bat.enable
|
|
xe # xargs alternative
|
|
sd # sed alternative
|
|
fd # find alternative
|
|
silver-searcher # `ag`
|
|
ripgrep
|
|
gron
|
|
jq
|
|
yq
|
|
fq
|
|
htmlq
|
|
just
|
|
sysz
|
|
du-dust # du alternative
|
|
ncdu # Disk usage analyzer with an ncurses interface
|
|
xplr # tui file explorer
|
|
aha
|
|
|
|
mesa-demos
|
|
cage
|
|
|
|
gh
|
|
hub
|
|
|
|
librespeed-cli
|
|
|
|
cachix
|
|
nix-template
|
|
nix-output-monitor
|
|
nixpkgs-review
|
|
manix
|
|
comma
|
|
|
|
(python3.withPackages (python-packages: with python-packages; [
|
|
requests
|
|
numpy
|
|
scipy
|
|
ptpython
|
|
poetry
|
|
rich
|
|
matplotlib
|
|
more-itertools
|
|
toml
|
|
pyyaml
|
|
virtualenv
|
|
]))
|
|
|
|
];
|
|
home.shellAliases = {
|
|
ip = "ip -br -color";
|
|
watch = "watch -c ";
|
|
hman = "man -H ";
|
|
#igrep = "grep -i";
|
|
#flexget = "ssh -t knut.pbsds.net sudo -u flexget flexget";
|
|
flexget = "sudo --user=flexget flexget -c /var/lib/flexget/flexget.yml";
|
|
tmux = "systemd-run --scope --user tmux";
|
|
ed = "$EDITOR"; # ed is the standard editor
|
|
de = "$EDITOR";
|
|
dush = "du -shc * | sort -h";
|
|
dushd = "du -shc * .[!.]?* | sort -h";
|
|
diff = "diff -u --color";
|
|
sudo = "sudo ";
|
|
xargs = "xargs ";
|
|
dc = "cd";
|
|
#sl = "ls";
|
|
sl = "exa";
|
|
rssh = "ssh -l root";
|
|
|
|
# TODO: wayland detection
|
|
clip = "xclip -sel clip -t text/plain -rmlastnl -i";
|
|
|
|
# git gud
|
|
gs = "git status";
|
|
gb = "git blame";
|
|
gl = "git log --oneline --color | head -n 30";
|
|
glg = "git log --all --decorate --oneline --graph";
|
|
gpra = "git pull --rebase --autostash";
|
|
gd = "git diff";
|
|
gdwd = "git diff --word-diff";
|
|
gdwdr = "git diff --word-diff --word-diff-regex=.";
|
|
gds = "git diff --staged";
|
|
gdswd = "git diff --staged --word-diff";
|
|
gdswdr = "git diff --staged --word-diff --word-diff-regex=.";
|
|
gcp = "git cherry-pick";
|
|
gca = "git commit --amend";
|
|
gcara = "git commit --amend --reset-author";
|
|
gpo = "git push origin";
|
|
gpasr = "git pull --autostash --rebase";
|
|
#gfr = "git fetch origin master && git rebase FETCH_HEAD";
|
|
gfr = "git pull --rebase";
|
|
gp = "git pull --rebase --autostash";
|
|
|
|
# bat - TODO: condition these on programs.bat.enable ?
|
|
cat = "bat --style=plain --paging=never";
|
|
man = "batman";
|
|
|
|
python = "ptpython"; # this has too many problems...
|
|
cpython = "python";
|
|
|
|
pwd-fqdn = ''echo "$(whoami)@$(hostname -f):$(printf "%q" "$(realpath .)/")"'';
|
|
|
|
http-server = "${pkgs.python3}/bin/python -m http.server";
|
|
|
|
manix-fzf = ''manix "" 2>/dev/null | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --preview="manix '{}'" | xargs manix'';
|
|
|
|
nixpkgs-review = ''mkdir -p /dev/shm/nixpkgs-review && ln -sfn /dev/shm/nixpkgs-review $HOME/.cache/nixpkgs-review && nixpkgs-review'';
|
|
};
|
|
programs.bash.enable = true;
|
|
#programs.bash.enableCompletion = true;
|
|
programs.bash.shellOptions = [
|
|
# Append to history file rather than replacing it.
|
|
"histappend"
|
|
# check the window size after each command and, if
|
|
# necessary, update the values of LINES and COLUMNS.
|
|
"checkwinsize"
|
|
# Extended globbing.
|
|
"extglob"
|
|
"globstar"
|
|
# Warn if closing shell with running jobs.
|
|
"checkjobs"
|
|
];
|
|
programs.fzf.enable = true; # TODO: does this conflict with system-wide setup?
|
|
#programs.git.gitui.enable = true;
|
|
programs.git.enable = true;
|
|
programs.git.delta.enable = true;
|
|
#programs.git.lfs.enable = true;
|
|
#programs.git.signing
|
|
#programs.git.userName = "pbsds"
|
|
programs.git.userName = "Peder Bergebakken Sundt";
|
|
programs.git.userEmail = "pbsds@hotmail.com";
|
|
programs.git.ignores = [ "result" "__pycache__" ];
|
|
programs.exa.enable = true;
|
|
programs.exa.enableAliases = true;
|
|
programs.direnv.enable = true;
|
|
programs.mpv.enable = true;
|
|
programs.mpv.bindings."SHIFT+n" = "sub-seek -1";
|
|
programs.mpv.bindings."n" = "sub-seek 1";
|
|
#programs.mpv.config
|
|
programs.mpv.scripts = with pkgs.mpvScripts; [ thumbnail ];
|
|
|
|
# TODO: implement programs.bat.enableAliases
|
|
programs.bat = {
|
|
enable = true;
|
|
themes.railscast = builtins.readFile (pkgs.fetchFromGitHub {
|
|
owner = "jeromedalbert";
|
|
repo = "sublime-text-railscasttextmate-theme";
|
|
rev = "0a4861f35e72f9ad4cc1cac42730ea563be2ffd3";
|
|
hash = "sha256-1Ml5vqP9r6oCfLhaNGPQJXS8e7utxQQycIm3Hk9wE3w=";
|
|
} + "/railscast-textmate.tmtheme");
|
|
config.theme = "railscast";
|
|
#config.style = "plain";
|
|
config.map-syntax = [
|
|
"poetry.toml:toml"
|
|
"flake.lock:json"
|
|
"*.jsonl:json"
|
|
];
|
|
# only in unstable as of 22.11:
|
|
#extraPackages = with pkgs.bat-extras; [ batdiff batman batgrep batwatch ];
|
|
};
|
|
|
|
/**/
|
|
# TODO: upstream this
|
|
programs.micro.enable = true;
|
|
programs.micro.trueColor = true;
|
|
programs.micro.settings = {
|
|
colorscheme = "railscast";
|
|
rmtrailingws = true;
|
|
tabstospaces = true;
|
|
};
|
|
#xdg.configFile."micro/bindings.json".source = (pkgs.formats.json {}).generate "micro-bindings" {
|
|
programs.micro.bindings = {
|
|
"Alt-/" = "lua:comment.comment";
|
|
"Alt-d" = "SpawnMultiCursor";
|
|
"Alt-j" = "lua:joinLines.joinLines";
|
|
"Alt-l" = "command:lower";
|
|
"Alt-u" = "command:upper";
|
|
"AltLeft" = "PreviousTab";
|
|
"AltRight" = "NextTab";
|
|
"Ctrl-j" = "EndOfLine,CursorRight,OutdentLine,OutdentLine,OutdentLine,OutdentLine,OutdentLine,OutdentLine,OutdentLine,OutdentLine,OutdentLine,OutdentLine,OutdentLine,OutdentLine,OutdentLine,OutdentLine,Backspace";
|
|
"CtrlDown" = "None";
|
|
"CtrlUnderscore" = "lua:comment.comment";
|
|
"CtrlUp" = "None";
|
|
"Escape" = "RemoveAllMultiCursors";
|
|
"Shift-PageDown" = "SelectPageDown";
|
|
"Shift-PageUp" = "SelectPageUp";
|
|
};
|
|
programs.micro.ensurePlugins = [
|
|
"aspell"
|
|
"detectindent"
|
|
"editorconfig"
|
|
"joinLines"
|
|
"manipulator"
|
|
"quoter"
|
|
];
|
|
/**/
|
|
|
|
# generated with `tmate-client-config` on noximilien
|
|
home.file.".tmate.conf".text = ''
|
|
set -g tmate-server-host "noximilien.pbsds.net"
|
|
set -g tmate-server-port 42244
|
|
set -g tmate-server-ed25519-fingerprint "SHA256:/e9EGMfvC+8gbaNiCoFbl87Pps7e/V+2pOSjEpMDdfA"
|
|
set -g tmate-server-rsa-fingerprint "SHA256:UzoAW9TynFQZDINgDiS+G06SmYcIX/ObI1zL19PpKEE"
|
|
'';
|
|
|
|
programs.nix-index.enable = true;
|
|
programs.tealdeer.enable = true;
|
|
|
|
xdg.enable = true;
|
|
#xdg.desktopEntries
|
|
|
|
gtk.enable = true; # TODO: only if programs.dconf is enabled
|
|
#gtk.theme.name = "vimix-dark-ruby"; # TODO: keep vimix as gnome-shell theme?
|
|
#gtk.theme.package = pkgs.vimix-gtk-themes;
|
|
gtk.theme.name = "Colloid-Dark";
|
|
gtk.theme.package = pkgs.colloid-gtk-theme;
|
|
gtk.iconTheme.name = "Flat-Remix-Blue-Dark";
|
|
gtk.iconTheme.package = pkgs.flat-remix-icon-theme;
|
|
dconf.settings."org/gnome/desktop/background" = {
|
|
"picture-uri" = "file:///mnt/reidun/Images/Wallpapers/1575232313831.jpg";
|
|
"picture-uri-dark" = "file:///mnt/reidun/Images/Wallpapers/1575232313831.jpg";
|
|
};
|
|
|
|
# TODO: upstream?
|
|
programs.jump.enableBash = true;
|
|
|
|
/** /
|
|
programs.beets = {
|
|
enable = true;
|
|
settings = {
|
|
directory = "/mnt/meconium/beets_preprocessed/data";
|
|
#library = "/mnt/meconium/beets_preprocessed/library.db";
|
|
library = "${config.xdg.configHome}/beets/library_preprocessed.db";
|
|
|
|
#directory = "/mnt/meconium/beets_music/library";
|
|
#library = "${config.xdg.configHome}/beets/library_meconium.db";
|
|
##library = "/mnt/meconium/beets_music/data.db";
|
|
};
|
|
};
|
|
/**/
|
|
|
|
}
|