nixos-config/nixos/components/gui/home-manager/default.nix
2023-06-23 09:03:24 +02:00

232 lines
5.9 KiB
Nix

{ pkgs, lib, config, ... }:
with lib;
{
imports = [
./dunst.nix
./doom-emacs.nix
./ssh.nix
./i3.nix
];
config = mkIf config.components.gui.enable {
# don't run autoload -U compinit && compinit before ~/.zshrc
programs.zsh.enableGlobalCompInit = false;
home-manager.users.mainUser = {
home.stateVersion = "22.11";
# a better cat
programs.bat = {
enable = true;
config.theme = "gruvbox-light";
};
home.shellAliases.cat = "${pkgs.bat}/bin/bat";
# notify me when a command is finished
programs.noti.enable = true;
# a better ls
programs.exa = {
enable = true;
enableAliases = true;
};
home.shellAliases.llt = "${pkgs.exa}/bin/exa -a --tree";
# use z instead of cd
# use zi to fuzzy search through all registered directories
programs.zoxide = {
enable = true;
enableZshIntegration = true;
};
# provide better `Ctrl+r` command in terminal
programs.mcfly = {
enable = true;
keyScheme = "vim";
fuzzySearchFactor = 3;
enableZshIntegration = true;
enableBashIntegration = true;
};
programs.zsh = {
enable = true;
defaultKeymap = "viins";
};
xdg.configFile."ncmpcpp/config".text = ''
mpd_host = "pepe.private"
mpd_port = 6600
'';
programs.git = {
enable = true;
userName = "Ingolf Wagner";
userEmail = "contact@ingolf-wagner.de";
signing = {
key = "42AC51C9482D0834CF488AF1389EC2D64AC71EAC";
signByDefault = true;
};
ignores = [ "*.swp" "*~" ".idea" ".*penis.*" "result" ".envrc" ];
extraConfig = {
init.defaultBranch = "main";
pull.ff = "only";
};
};
programs.gpg = {
enable = true;
settings = {
auto-key-locate = "local";
keyid-format = "long";
utf8-strings = "";
verbose = "";
with-fingerprint = "";
keyserver = "keyserver.ubuntu.com";
personal-digest-preferences = "SHA512";
cert-digest-algo = "SHA512";
default-preference-list =
"SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed";
};
};
programs.htop = {
enable = true;
settings.highlight_base_name = true;
settings.tree_view = true;
};
xdg.configFile."albert/albert.conf".text = ''
[General]
hotkey=Meta+Space
showTray=false
telemetry=false
terminal=urxvt -e
[org.albert.extension.applications]
enabled=true
fuzzy=true
use_generic_name=true
use_keywords=true
[org.albert.extension.calculator]
enabled=true
[org.albert.extension.hashgenerator]
enabled=true
[org.albert.frontend.widgetboxmodel]
alwaysOnTop=true
clearOnHide=false
displayIcons=true
displayScrollbar=false
displayShadow=false
hideOnClose=false
hideOnFocusLoss=true
itemCount=5
showCentered=true
theme=SolarizedBrightViolet
'';
xdg.configFile."Code/User/settings.json".text = builtins.toJSON {
"keyboard.dispatch" = "keyCode";
"explorer.confirmDragAndDrop" = false;
"editor.tabSize" = 2;
"window.zoomLevel" = -1;
"git.enableSmartCommit" = true;
"files.autoSave" = "onFocusChange";
"terminal.integrated.setLocaleVariables" = true;
"terminal.external.linuxExec" = "xterm";
"explorer.confirmDelete" = false;
"todo-tree.tags" = [ "todo" "TODO" "fixme" "FIXME" ];
"workbench.colorTheme" = "Solarized Light";
};
xdg.configFile."mimeapps.list".text = ''
[Default Applications]
text/html=browser-select.desktop
x-scheme-handler/http=browser-select.desktop
x-scheme-handler/https=browser-select.desktop
x-scheme-handler/about=browser-select.desktop
x-scheme-handler/mailto=thunderbird.desktop;
x-scheme-handler/unknown=browser-select.desktop
x-scheme-handler/postman=Postman.desktop
image/png=sxiv.desktop
image/jpeg=sxiv.desktop
'';
xdg.configFile."khal/config".text = ''
[calendars]
[[local_calendar]]
path = ~/.calendars/*
type = discover
[locale]
timeformat = %H:%M
dateformat = %Y-%m-%d
longdateformat = %Y-%m-%d
datetimeformat = %Y-%m-%d %H:%M
longdatetimeformat = %Y-%m-%d %H:%M
'';
xdg.configFile."vdirsyncer/config".text = ''
[general]
# A folder where vdirsyncer can store some metadata about each pair.
status_path = "~/.vdirsyncer/status/"
# CALDAV
[pair my_calendar]
a = "nextcloud_calendar"
b = "local_calendar"
collections = ["from a", "from b"]
[storage nextcloud_calendar]
type = "caldav"
url = "https://nextcloud.ingolf-wagner.de/"
username = "palo"
password.fetch = ["command", "${pkgs.pass}/bin/pass", "home/nextcloud/palo/nextcloudcmd-token"]
[storage local_calendar]
type = "filesystem"
path = "~/.calendars/"
fileext = ".ics"
'';
};
environment.systemPackages =
let
fixXhost = pkgs.writeScriptBin "fix-xhost" # sh
''
${pkgs.xorg.xhost}/bin/xhost + &> /dev/null
'';
fixX = pkgs.writeScriptBin "fix-X" # sh
''
for file in `ls ~/.screenlayout`
do
echo $file
~/.screenlayout/$file &> /dev/null
RETURN_CODE=$?
if [[ $RETURN_CODE -eq 0 ]]
then
exit 0;
fi
done
'';
in
[
fixX
fixXhost
];
};
}