From 87b5d5733f6f72df604da29c39cc2f228ad601ff Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Sat, 4 Mar 2023 00:09:57 +0100 Subject: [PATCH] home/pbsds: moar --- flake.nix | 16 ++--- users/pbsds/home/default.nix | 102 +++------------------------- users/pbsds/home/profiles/bat.nix | 2 + users/pbsds/home/profiles/git.nix | 3 + users/pbsds/home/profiles/micro.nix | 3 + users/pbsds/home/profiles/mpv.nix | 10 +++ users/pbsds/home/profiles/shell.nix | 86 +++++++++++++++++++++++ 7 files changed, 122 insertions(+), 100 deletions(-) create mode 100644 users/pbsds/home/profiles/mpv.nix create mode 100644 users/pbsds/home/profiles/shell.nix diff --git a/flake.nix b/flake.nix index 995508c..6bda9c1 100644 --- a/flake.nix +++ b/flake.nix @@ -16,14 +16,14 @@ # temp inputs.pr-polaris14.url = "github:pbsds/nixpkgs/polaris-14"; - outputs = { - self, - nixpkgs, - unstable, - nixos-hardware, - nur, - home-manager, - ... + outputs = { + self, + nixpkgs, + unstable, + nixos-hardware, + nur, + home-manager, + ... } @ inputs: let systems = [ diff --git a/users/pbsds/home/default.nix b/users/pbsds/home/default.nix index 0f276ec..a44bf49 100644 --- a/users/pbsds/home/default.nix +++ b/users/pbsds/home/default.nix @@ -2,8 +2,7 @@ { pkgs, config, ... }: { - # TODO: upstream? - programs.jump.enableBash = true; + programs.jump.enableBash = true; # TODO: upstream? imports = [ ./modules/jump.nix @@ -11,37 +10,27 @@ ./profiles/git.nix ./profiles/gtk.nix ./profiles/micro.nix + ./profiles/mpv.nix + ./profiles/shell.nix ./profiles/ssh.nix ./profiles/tmate.nix ]; - nixpkgs.config.allowUnfree = true; + home.stateVersion = "22.11"; - 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\] ' - # remote-exec it command -v remote >/dev/null && remote-quick >/dev/null; then complete -F _command remote complete -F _command remote-quick 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" @@ -49,10 +38,7 @@ ''; # TODO: split ^ - home.packages = with pkgs; [ - rsync - bind.dnsutils xclip zip @@ -64,11 +50,9 @@ gzip atool - micro aspell aspellDicts.en aspellDicts.nb - vimv dos2unix pandoc @@ -79,10 +63,6 @@ youtube-dl ffmpeg-full - git - curl - wget - visidata lolcat @@ -91,32 +71,10 @@ tewisay ponysay - #tldr - entr - axel aria - 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 - + # TODO: move to graphical? kiosk? mesa-demos cage - gh - hub - librespeed-cli cachix @@ -139,25 +97,15 @@ 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"; - 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"; + + hman = "man -H "; # HTML opened in a browser + + tmux = "systemd-run --scope --user tmux"; # detach from ssh scope, surviving logout # TODO: wayland detection clip = "xclip -sel clip -t text/plain -rmlastnl -i"; @@ -176,37 +124,7 @@ 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 = [ - # 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.exa.enable = true; - programs.exa.enableAliases = true; - - programs.direnv.enable = true; - - programs.mpv.enable = true; - 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 ]; - programs.nix-index.enable = true; - programs.tealdeer.enable = true; xdg.enable = true; #xdg.desktopEntries diff --git a/users/pbsds/home/profiles/bat.nix b/users/pbsds/home/profiles/bat.nix index b4e0dc1..0cd221e 100644 --- a/users/pbsds/home/profiles/bat.nix +++ b/users/pbsds/home/profiles/bat.nix @@ -28,4 +28,6 @@ # only in unstable as of 22.11: #extraPackages = with pkgs.bat-extras; [ batdiff batman batgrep batwatch ]; }; + + # TODO: generate bat syntax cache: 'bat cache --build' } diff --git a/users/pbsds/home/profiles/git.nix b/users/pbsds/home/profiles/git.nix index c02a337..98110e1 100644 --- a/users/pbsds/home/profiles/git.nix +++ b/users/pbsds/home/profiles/git.nix @@ -1,5 +1,8 @@ { pkgs, ... }: { + + home.packages = with pkgs; [ git gh hub ]; + #programs.git.gitui.enable = true; programs.git.enable = true; programs.git.delta.enable = true; diff --git a/users/pbsds/home/profiles/micro.nix b/users/pbsds/home/profiles/micro.nix index af3ad84..cdbea12 100644 --- a/users/pbsds/home/profiles/micro.nix +++ b/users/pbsds/home/profiles/micro.nix @@ -6,6 +6,9 @@ home.shellAliases.ed = "$EDITOR"; # ed is the standard editor home.shellAliases.de = "$EDITOR"; + home.sessionVariables.EDITOR = "micro"; + + home.packages = with pkgs; [ micro ]; programs.micro.enable = true; programs.micro.trueColor = true; diff --git a/users/pbsds/home/profiles/mpv.nix b/users/pbsds/home/profiles/mpv.nix new file mode 100644 index 0000000..d0c1241 --- /dev/null +++ b/users/pbsds/home/profiles/mpv.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ mpv ]; + + programs.mpv.enable = true; + 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 ]; +} diff --git a/users/pbsds/home/profiles/shell.nix b/users/pbsds/home/profiles/shell.nix new file mode 100644 index 0000000..6081112 --- /dev/null +++ b/users/pbsds/home/profiles/shell.nix @@ -0,0 +1,86 @@ +{ pkgs, ... }: +{ + # TODO: "bind -s 'set completion-ignore-case on'" + 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.exa.enable = true; + programs.exa.enableAliases = true; + + # i can't type + home.shellAliases.sl = "exa"; + home.shellAliases.dc = "cd"; + + programs.direnv.enable = true; + + programs.tealdeer.enable = true; + + + # just use ncdu lol + home.shellAliases.dush = "du -shc * | sort -h"; + home.shellAliases.dushd = "du -shc * .[!.]?* | sort -h"; + + home.shellAliases.diff = "diff -u --color"; # eyo + home.shellAliases.ip = "ip -br -color"; + home.shellAliases.rssh = "ssh -l root"; + home.shellAliases.sudo = "sudo "; + home.shellAliases.watch = "watch -c "; # parse colors + home.shellAliases.xargs = "xargs "; + + home.packages = with pkgs; [ + rsync + bind.dnsutils + vimv + git + curl + wget + + #tldr + entr + axel aria + 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 + ]; + + programs.bash.initExtra = '' + 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\] ' + + # tldr + it command -v tldr >/dev/null; then + complete -F _command tldr + fi + ''; + + +}