flake: Restructure home/
This commit is contained in:
parent
07268b2730
commit
9389d2661a
5 changed files with 3 additions and 4 deletions
188
home/alex/cli.nix
Normal file
188
home/alex/cli.nix
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
# minimal config, suitable for servers
|
||||
let
|
||||
user = {
|
||||
name = config.home.username;
|
||||
fullName = "Alexander Kobjolke";
|
||||
mail = "me@failco.de";
|
||||
};
|
||||
|
||||
myEza = if builtins.hasAttr "eza" pkgs then "eza" else "exa";
|
||||
in {
|
||||
imports = [ ./programs/neovim/default.nix ./programs/emacs/default.nix ];
|
||||
|
||||
programs.home-manager.enable = true;
|
||||
home = {
|
||||
stateVersion = "21.05";
|
||||
sessionPath = [ "$HOME/.local/bin" ];
|
||||
};
|
||||
|
||||
# do not show home-manager notifications
|
||||
news.display = "silent";
|
||||
|
||||
home.packages = with pkgs; [
|
||||
# archives
|
||||
#p7zip
|
||||
#unrar
|
||||
git-absorb
|
||||
git-annex
|
||||
git-annex-remote-rclone
|
||||
|
||||
tea # command-line frontend for gitea
|
||||
|
||||
# nix tools
|
||||
nix-index
|
||||
nixfmt
|
||||
# misc
|
||||
fd # better find
|
||||
file # info about files
|
||||
unzip
|
||||
dropbox
|
||||
gotop
|
||||
gnumake
|
||||
ripgrep # better grep
|
||||
pijul
|
||||
sqlite.dev
|
||||
sqlite
|
||||
|
||||
# editing
|
||||
nil # nix language server
|
||||
shellcheck
|
||||
editorconfig-core-c
|
||||
shfmt
|
||||
(aspellWithDicts (dicts: with dicts; [ en en-computers en-science de ]))
|
||||
|
||||
# system tools
|
||||
htop-vim # htop with vim bindings
|
||||
erdtree # du+tree had sex
|
||||
dua # ncdu but better
|
||||
fzf
|
||||
|
||||
gopass
|
||||
gopass-jsonapi
|
||||
gopass-hibp
|
||||
|
||||
gcc
|
||||
cmake
|
||||
graphviz
|
||||
plantuml
|
||||
gnuplot
|
||||
|
||||
pandoc
|
||||
hledger
|
||||
hledger-web
|
||||
hledger-ui
|
||||
|
||||
nix-prefetch-git
|
||||
];
|
||||
home.extraOutputsToInstall = [ "doc" "info" "devdoc" ];
|
||||
|
||||
xdg.enable = true;
|
||||
|
||||
xdg.configFile.tmux = {
|
||||
target = "tmux/tmux.conf";
|
||||
text = ''
|
||||
set -g default-terminal "tmux-256color"
|
||||
set -g prefix C-z
|
||||
# do not wait for a manually entered escape sequence, just forward it immediately
|
||||
set -g escape-time 0
|
||||
bind-key C-z send-prefix
|
||||
set -g renumber-windows on
|
||||
|
||||
bind-key T swap-window -t 0
|
||||
'';
|
||||
};
|
||||
|
||||
xdg.configFile.pijul = {
|
||||
target = "pijul/config.toml";
|
||||
text = ''
|
||||
[author]
|
||||
name = "${user.name}"
|
||||
full_name = "${user.fullName}"
|
||||
email = "${user.mail}"
|
||||
'';
|
||||
};
|
||||
|
||||
programs = {
|
||||
bash = { enable = true; };
|
||||
|
||||
# better cat
|
||||
bat.enable = true;
|
||||
|
||||
# htop replacement with a nice UI
|
||||
btop.enable = true;
|
||||
|
||||
zsh = {
|
||||
enable = true;
|
||||
enableAutosuggestions = true;
|
||||
oh-my-zsh = {
|
||||
enable = true;
|
||||
plugins = [ "git" "fzf" "fd" "z" ];
|
||||
theme = "simple";
|
||||
};
|
||||
};
|
||||
|
||||
# better ls with icons and stuff, maybe also try lsd
|
||||
${myEza} = {
|
||||
enable = true;
|
||||
icons = true;
|
||||
enableAliases = true;
|
||||
};
|
||||
|
||||
starship = { enable = true; };
|
||||
|
||||
direnv = {
|
||||
enable = true;
|
||||
nix-direnv = { enable = true; };
|
||||
enableZshIntegration = true;
|
||||
enableBashIntegration = true;
|
||||
};
|
||||
|
||||
gh = {
|
||||
enable = true;
|
||||
settings.git_protocol = "ssh";
|
||||
};
|
||||
|
||||
git = {
|
||||
enable = true;
|
||||
ignores = [ "*~" "*.swp" "result" "dist-newstyle" ];
|
||||
userEmail = user.mail;
|
||||
userName = user.fullName;
|
||||
aliases = { st = "status"; };
|
||||
extraConfig = { init.defaultBranch = "main"; };
|
||||
};
|
||||
|
||||
gpg = {
|
||||
enable = true;
|
||||
settings = { homedir = "~/.local/share/gnupg"; };
|
||||
};
|
||||
|
||||
helix = {
|
||||
enable = true;
|
||||
settings.theme = "gruvbox";
|
||||
};
|
||||
|
||||
password-store = {
|
||||
enable = true;
|
||||
package = pkgs.gopass;
|
||||
settings = { PASSWORD_STORE_DIR = "$HOME/.local/share/password-store"; };
|
||||
};
|
||||
|
||||
ssh.enable = true;
|
||||
|
||||
texlive.enable = true;
|
||||
};
|
||||
|
||||
services.gpg-agent = {
|
||||
enable = true;
|
||||
enableSshSupport = true;
|
||||
defaultCacheTtl = 300;
|
||||
defaultCacheTtlSsh = 300;
|
||||
};
|
||||
|
||||
home.file.".local" = {
|
||||
recursive = true;
|
||||
source = ./local;
|
||||
};
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [ ../cli.nix ];
|
||||
imports = [ ./cli.nix ];
|
||||
|
||||
home = {
|
||||
homeDirectory = "/home/alex";
|
||||
|
|
|
|||
16
home/alex/local/bin/kill-old-mosh
Executable file
16
home/alex/local/bin/kill-old-mosh
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
mysession=$(cat /proc/self/sessionid)
|
||||
count=0
|
||||
while read pid _; do
|
||||
session=$(cat /proc/$pid/sessionid)
|
||||
if [ "$mysession" != "$session" ]; then
|
||||
if kill $pid; then
|
||||
echo 2>&1 "stale mosh session $pid killed"
|
||||
count=$((count + 1))
|
||||
fi
|
||||
fi
|
||||
done <<<$(ps -C mosh-server -o pid=,etimes= | sort -k 2 -r)
|
||||
|
||||
if [[ $count -eq 0 ]]; then
|
||||
echo 2>&1 "No stale mosh session found"
|
||||
fi
|
||||
74
home/alex/local/bin/merge-pdf
Executable file
74
home/alex/local/bin/merge-pdf
Executable file
|
|
@ -0,0 +1,74 @@
|
|||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p ghostscript -p coreutils
|
||||
#
|
||||
# Local Variables:
|
||||
# mode: sh
|
||||
# End:
|
||||
#
|
||||
|
||||
workdir=
|
||||
keep_workdir=false
|
||||
output=-
|
||||
|
||||
function usage {
|
||||
cat <<EOF
|
||||
usage: merge-pdf [options] files...
|
||||
|
||||
options:
|
||||
-o FILE write result to FILE (default: -)
|
||||
EOF
|
||||
}
|
||||
|
||||
function cleanup {
|
||||
if [ x"${keep_workdir}" != x"true" ]; then
|
||||
if [ -d "${workdir}" ]; then
|
||||
rm -rf "${workdir}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
trap "cleanup" EXIT
|
||||
|
||||
while getopts ":ho:k" o; do
|
||||
case "$o" in
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
o)
|
||||
output="$OPTARG"
|
||||
;;
|
||||
k)
|
||||
keep_workdir=true
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
workdir=$(mktemp -d)
|
||||
|
||||
echo >&2 "[INFO] Putting temporary files into ${workdir}"
|
||||
|
||||
files=()
|
||||
for f; do
|
||||
fname=$(basename "$f" .pdf)
|
||||
of="${workdir}/${fname}.ps"
|
||||
echo >&2 "[PS ] \"${f}\" -> \"${of}\""
|
||||
pdf2ps "$f" "${of}" >&/dev/null
|
||||
files+=("$of")
|
||||
done
|
||||
|
||||
echo >&2 "[PDF ] combining ${#files[@]} file(s) into ${output}"
|
||||
|
||||
gs -dNOPAUSE -sDEVICE=pdfwrite \
|
||||
-dPDFSETTINGS=/prepress \
|
||||
-sPAPERSIZE=a4 \
|
||||
-sFIXEDMEDIA \
|
||||
-sOUTPUTFILE="${output}" \
|
||||
-dBATCH \
|
||||
"${files[@]}" >&/dev/null
|
||||
Loading…
Add table
Add a link
Reference in a new issue