nixconfigs/home/home.nix

588 lines
14 KiB
Nix

{ pkgs, lib, config, ... }:
with pkgs;
let
# nix-channel --add https://nixos.org/channels/nixos-unstable nixos-unstable
#unstable = import <nixos-unstable> { };
# nix-channel --add https://github.com/nix-community/NUR/archive/master.tar.gz NUR
nur = import <NUR> { inherit pkgs; };
myNur = nur.repos.schmittlauch;
desktopApps = [
# use pre-built Mozilla binary until nixpkgs build has similar performance (build profiling information)
firefox-bin
chromium
falkon
thunderbird
calibre
dino
zotero
keepassxc
ding
aspell
aspellDicts.de
aspellDicts.en
# for kate/KDE applications
hunspellDicts.de-de
hunspellDicts.en-us
hunspellDicts.en-gb-ise
seafile-client
alacritty
libreoffice-qt # fresh with KDE integration
backintime-common
anki-bin
signal-desktop
(tor-browser-bundle-bin.override {
mediaSupport = true;
pulseaudioSupport = true;
# prevent segfault on Intel graphics systems
useHardenedMalloc = false;
})
pdfpc
quaternion
nheko
gpx-viewer
gpxsee
cawbird
subsurface
yate
# split and merge PDFs in a GUI
pdfarranger
qbittorrent
#(pkgs.pidgin-with-plugins.override {
# plugins = [ pkgs.pidginotr ];})
# for Hibiscus banking software
jameica
#ToDo: which of these drivers is actually used?
geckodriver
chromedriver
];
graphicsApps = [
inkscape
darktable
#hugin
#luminanceHDR
exiftool
gimp
#xournal # FIXME: broken on darwin-aarch64
]
++ (
with gimpPlugins; [
fourier
lqrPlugin
]
);
multimediaApps = [
mpv
#vlc
#amarok
#clementine
#elisa
yt-dlp
#sonic-pi
#musescore
#audacity
#avidemux
#linphone
#soundkonverter
];
cliApps = [
myVim
htop
tmux
httpie
ponysay
gti
tree
lsof
mosh
openssh
sshfs-fuse
cryfs
#smbnetfs # for FUSE smb mounting
openssh
sshuttle
thefuck
gnupg
unar
lzop
p7zip
pwgen
pandoc
#agrep # FIXME: broken on darwin-aarch64
pdfgrep
#torsocks # FIXME: broken on darwin-aarch64
# zig dependency breaks occasionally, stay on C version for now
ncdu
#psmisc # for killall
dos2unix
#reptyr # re-bind running program to other tty
xclip
unzip
fswatch
#myNur.lolcommits # from NUR
jq
age
_1password
];
nixHelpers = [
lorri
nixpkgs-review
nixpkgs-fmt
nix-top
statix
];
kdeTools = with plasma5Packages; with kdeGear; [
okular
gwenview
yakuake
kmail
kontact
korganizer
akonadi-mime #for KOrganizer
kaddressbook
kdeconnect
dolphin
spectacle
kate
kleopatra
qdirstat
ark
kwalletmanager
ktouch
kcharselect
konversation
okteta
krdc
skanlite
akonadiconsole
plasma-browser-integration
]
++ (
with kdeFrameworks; [
networkmanager-qt
kcrash
breeze-gtk
phonon-backend-vlc
#(phonon-backend-vlc.override {qtbase=qt5.qtbase; qtx11extras=qt5.qtx11extras;})
]
);
devTools = [
curl
httpie
#gdb
#strace
#ltrace
#valgrind
#zeal
gcc
shellcheck
mtr
ripgrep
gitui
lazygit
pre-commit
scriv
# Haskell
ghc
cabal2nix
];
latexApps = [
texmaker
kile
biber
# customize texlive installation
(
texlive.combine {
inherit (texlive)
scheme-medium
xetex
luatex
unicode-math
fontspec
collection-binextra
collection-fontsrecommended
collection-latex
collection-latexextra
collection-latexrecommended
collection-langgerman
IEEEtran
moderncv
fontawesome5
academicons
acronym
ccicons
fontawesome
biblatex
logreq
koma-script
;
}
)
];
pythonApps = with python3Packages; [
notebook
ipython
pip
numpy
matplotlib
jedi
jedi-language-server
black
flake8
mypy
];
fonts = [
comic-neue
source-sans-pro
source-code-pro
source-serif-pro
fira-code
fira-mono # unsere Ersatz-Monospace Font für Mails
ubuntu_font_family
twemoji-color-font
open-sans
(iosevka-bin.override {
variant = "curly-slab";
})
myNur.vollkorn
# TODO: humor-sans
];
games = [
superTuxKart
#hedgewars
];
macosTools = [
];
in
{
home.packages =
cliApps
#++ desktopApps
#++ latexApps
++ pythonApps
++ graphicsApps
++ multimediaApps
++ devTools
#++ kdeTools
++ fonts
++ nixHelpers
#++ games
++ macosTools
;
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"1password-cli"
];
programs.home-manager.enable = true;
#programs.home-manager.path = "$HOME/.nix-defexpr/channels/home-manager";
home.stateVersion = "22.05";
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = "os";
home.homeDirectory = "/Users/os";
programs.direnv =
{
enable = true;
enableZshIntegration = true;
};
# programs.vim =
# { enable = true;
# };
programs.vscode = {
enable = true;
package = pkgs.vscodium;
extensions = with pkgs.vscode-extensions; [
ms-python.python
vscodevim.vim
yzhang.markdown-all-in-one
bungcip.better-toml
eamodio.gitlens
jnoortheen.nix-ide
mkhl.direnv
kamadorueda.alejandra
] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
{
name = "Sync-Rsync";
publisher = "vscode-ext";
version = "0.36.0";
sha256 = "sha256-0b/OHLZfXo0NAVAVkzZSqMGDzF0uvPRoiqsZtW1iOdA";
}
# TODO: probably available in nixpkgs soonish?
{
name = "mypy-type-checker";
publisher = "ms-python";
version = "2023.3.12681020";
sha256 = "sha256-rhed7CQlvxksVCGc9nPU2oYQWtXcAV5TzuG63e8Y3zM=";
}
{
name = "black-formatter";
publisher = "ms-python";
version = "2023.5.12771008";
sha256 = "sha256-lJG0RRUUMhQGs2a6oBtoqt+uY1kSJ0+cbmaP07hNh2o=";
}
];
userSettings = let
defaultPython = pkgs.python3.withPackages (ps: [
ps.jedi ps.jedi-language-server
ps.pip ps.setuptools # for pkg_resources
ps.black ps.mypy
]);
in {
"editor.fontLigatures" = true;
"window.autoDetectColorScheme" = true;
"workbench.preferredDarkColorTheme" = "Default Dark Modern";
"workbench.preferredLightColorTheme" = "Default Light Modern";
"[nix]" = {
"editor.insertSpaces" = true;
"editor.tabSize" = 2;
"editor.defaultFormatter" = "kamadorueda.alejandra";
# for now, disable automatic formatting to prevent disruption of existing code bases
"editor.formatOnPaste" = false;
"editor.formatOnSave" = false;
"editor.formatOnType" = false;
};
"editor.fontSize" = 13;
"editor.fontWeight" = "normal";
"git.detectSubmodulesLimit" = 30;
"[python]" = {
"breadcrumbs.showClasses" = true;
"breadcrumbs.showFunctions" = true;
"gitlens.codeLens.symbolScopes" = [
"!Module"
];
"editor.defaultFormatter" = "ms-python.black-formatter";
"editor.formatOnSave" = true;
};
"python.languageServer" = "Jedi"; # don't use proprietary pylance server
"python.defaultInterpreterPath" = "${defaultPython}/bin/python";
"black-formatter.path" = ["${pkgs.python3Packages.black}/bin/black"];
"black-formatter.importStrategy" = "fromEnvironment";
"mypy-type-checker.path" = ["${pkgs.python3Packages.mypy}/bin/mypy"];
"mypy-type-checker.importStrategy" = "fromEnvironment";
"mypy-type-checker.args" = [
"--ignore-missing-imports"
];
"gitlens.telemetry.enabled" = false;
"vim.highlightedyank.enable" = true;
"vim.history" = 500;
"vim.neovimUseConfigFile" = true;
"vim.enableNeovim" = true;
"git.suggestSmartCommit" = false;
"editor.rulers" = [ 79 ];
"vim.useSystemClipboard" = true;
"vim.smartRelativeLine" = true;
"diffEditor.ignoreTrimWhitespace" = false;
"files.associations" = {
"*.py" = "python";
};
"editor.renderWhitespace" = "all";
"editor.fontFamily" = "Iosevka Curly Slab, Menlo, Monaco, 'Courier New', monospace";
"vim.neovimPath" = "/Users/os/.nix-profile/bin/nvim";
"sync-rsync.options" = [];
};
};
programs.bat = {
enable = true;
# pinning theme is necessary until iTerm 3.5, because despite the dark terminal background, bat detects light mode and adapts theme
config.theme = "Visual Studio Dark+";
};
# services.gpg-agent =
# {
# enable = true;
# enableSshSupport = true;
# pinentryFlavor = "qt";
# };
programs.ssh =
{
enable = true;
# ssh host config
matchBlocks = {
"hydra01" = {
hostname = "hydra01.fe.whq.fcio.net";
user = "os";
};
"fcio-whq-jump" = {
hostname = "vpn-whq.services.fcio.net";
extraOptions.LogLevel = "Verbose";
};
"fcio-rzob-jump" = {
hostname = "vpn-rzob.services.fcio.net";
};
};
};
programs.tmux = {
enable = true;
keyMode = "vi";
extraConfig =
# for direnv not messing up the environment
''set-option -g update-environment "DIRENV_DIFF DIRENV_DIR DIRENV_WATCHES"
set-environment -gu DIRENV_DIFF
set-environment -gu DIRENV_DIR
set-environment -gu DIRENV_WATCHES
set-environment -gu DIRENV_LAYOUT
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel'';
terminal = "screen-256color";
};
#systemd.user.startServices = true;
#services.lorri.enable = true;
# media button control support from Bluetooth devices
#services.mpris-proxy.enable = true;
fonts.fontconfig.enable = true;
programs.git =
let contacts = import ./secrets/contacts.nix;
in
{
enable = true;
includes = [
{
condition = "gitdir:~/Seafile/Studium/";
contents = {
user.name = contacts.realName;
user.email = contacts.uniMail;
};
}
{
condition = "gitdir:~/src/nixpkgs/";
contents = {
user.name = "Trolli Schmittlauch";
user.email = contacts.nixosMail;
};
}
]
# set default name for several other common locations
++ map
(dir: {
condition = "gitdir:${dir}";
contents = {
user.name = "Trolli Schmittlauch";
user.email = contacts.mainMail;
};
}) [ "~/src/" "~/bin/" "~/tmp/" "~/nixconfigs/" ];
extraConfig = {
credential.helper = "cache";
push.default = "simple";
init.defaultBranch = "mainline";
diff.tool = "vimdiff";
merge.tool = "vimdiff";
core.excludesfile = toString (pkgs.writeText ".gitignore_global" ''
# Direnv stuff
.direnv
.envrc
# Editor files #
################
*~
*.swp
*.swo
'');
core.whitespace = "-blank-at-eol,blank-at-eof,space-before-tab";
};
lfs.enable = true;
};
# shell config
programs.zsh = {
enable = true;
syntaxHighlighting.enable = true;
history.ignoreSpace = true;
initExtra = ''
# Uncomment following line if you want red dots to be displayed while waiting for completion
COMPLETION_WAITING_DOTS="true"
### Fix slowness of pastes with zsh-syntax-highlighting.zsh
pasteinit() {
OLD_SELF_INSERT=''${''${(s.:.)widgets[self-insert]}[2,3]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
}
pastefinish() {
zle -N self-insert $OLD_SELF_INSERT
}
zstyle :bracketed-paste-magic paste-init pasteinit
zstyle :bracketed-paste-magic paste-finish pastefinish
# automatic rehash of path completion
zstyle ':completion:*' rehash true
eval "$(${pkgs.thefuck}/bin/thefuck --alias)"
## helper functions
nixify() {
if [ ! -e ./.envrc ]; then
echo "eval \"$(lorri direnv)\"" > .envrc
direnv allow
fi
if [ ! -e shell.nix ]; then
cat > shell.nix <<'EOF'
with import <nixpkgs> {};
mkShell {
buildInputs = [
bashInteractive
];
}
EOF
${EDITOR:-vim} default.nix
fi
}
binpath() {
realpath $(${pkgs.which}/bin/which $1)
}
''
+ (import ./scripts/reporsync.nix {inherit pkgs;})
+ (import ./scripts/ssh-loop-fc.nix {inherit pkgs;});
oh-my-zsh = {
enable = true;
theme = "bira";
plugins = [ "git" "python" "systemd" "gpg-agent"];
};
};
home.shellAliases = {
ip = "ip --color";
ipb = "ip --color --brief";
ll = "ls -l";
wavesynth = "nix-shell -p sox --run 'play -n synth brownnoise synth pinknoise mix synth 0 0 0 15 40 80 trapezium amod 0.2 20'";
vim = "nvim";
};
home.sessionVariables = {
EDITOR = "nvim";
BATOU_AGE_IDENTITY_PASSPHRASE="op://Private/SSH key/password";
};
}