home/pbsds: split into profiles

This commit is contained in:
Peder Bergebakken Sundt 2023-03-03 23:33:37 +01:00
parent f923e028af
commit e99df9db4d
7 changed files with 186 additions and 134 deletions

View File

@ -2,14 +2,20 @@
{ pkgs, config, ... }:
{
# TODO: upstream?
programs.jump.enableBash = true;
imports = [
./modules/jump.nix
./modules/micro.nix
];
disabledModules = [
"programs/micro.nix"
./profiles/bat.nix
./profiles/git.nix
./profiles/gtk.nix
./profiles/micro.nix
./profiles/ssh.nix
./profiles/tmate.nix
];
nixpkgs.config.allowUnfree = true;
home.stateVersion = "22.05";
@ -25,22 +31,18 @@
}
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
# remote-exec
it command -v remote >/dev/null && remote-quick >/dev/null; then
complete -F _command remote
complete -F _command remote-quick
#complete -F _command tldr
fi
# tldr
it command -v tldr >/dev/null; then
complete -F _command tldr
fi
# TODO: remove
function atom_nix {
nix-shell -p atom --run "atom $(printf "%q " "$@") --in-process-gpu --no-sandbox"
}
@ -92,7 +94,6 @@
#tldr
entr
axel aria
bat bat-extras.batman # TODO: condition on programs.bat.enable
xe # xargs alternative
sd # sed alternative
fd # find alternative
@ -148,8 +149,6 @@
#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";
@ -163,42 +162,21 @@
# 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";
# TODO: ps1?
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'';
# TODO: move to /run/user/...
nixpkgs-review = ''mkdir -p /dev/shm/nixpkgs-review && ln -sfn /dev/shm/nixpkgs-review $HOME/.cache/nixpkgs-review && nixpkgs-review'';
};
# TODO: "bind -s 'set completion-ignore-case on'"
programs.bash.enable = true;
#programs.bash.enableCompletion = true;
programs.bash.shellOptions = [
@ -213,110 +191,26 @@
# 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.bindings."SHIFT+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;

View File

@ -0,0 +1,31 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
bat
bat-extras.batman
];
# bat - TODO: condition these on programs.bat.enable ?
home.shellAliases.cat = "bat --style=plain --paging=never";
home.shellAliases.man = "batman";
# 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 ];
};
}

View File

@ -0,0 +1,44 @@
{ pkgs, ... }:
{
#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"
"result-info"
"result-doc"
"result-man"
"result-dev"
"result-lib"
"__pycache__"
];
home.shellAliases = {
# 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";
};
}

View File

@ -0,0 +1,14 @@
{ pkgs, ... }:
{
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";
};
}

View File

@ -0,0 +1,40 @@
{ pkgs, ... }:
{
# TODO: upstream this
imports = [ ./modules/micro.nix ];
disabledModules = [ "programs/micro.nix" ];
home.shellAliases.ed = "$EDITOR"; # ed is the standard editor
home.shellAliases.de = "$EDITOR";
programs.micro.enable = true;
programs.micro.trueColor = true;
programs.micro.settings.colorscheme = "railscast";
programs.micro.settings.rmtrailingws = true;
programs.micro.settings.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"
];
}

View File

@ -0,0 +1,15 @@
{ pkgs, ... }:
{
programs.bash.initExtra = ''
# 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
'';
}

View File

@ -0,0 +1,14 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
tmate
];
# 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"
'';
}