398 lines
12 KiB
Nix
398 lines
12 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
# TODO: implement plasma configuration
|
|
# TODO: Plasma does not see home manager installed packages
|
|
let
|
|
username = "becky";
|
|
homedir = "/home/${username}";
|
|
|
|
zshSourceDirs = [
|
|
./zsh/dingleberry
|
|
];
|
|
in
|
|
{
|
|
# Breaks SDDM
|
|
# targets.genericLinux.enable = true;
|
|
|
|
# Enable XDG for non terminal apps
|
|
# https://github.com/nix-community/home-manager/issues/1439
|
|
programs.bash.enable = true;
|
|
|
|
xdg = {
|
|
enable = true;
|
|
mime = {
|
|
enable = true;
|
|
};
|
|
mimeApps = {
|
|
defaultApplications = {
|
|
"inode/directory" = "org.kde.krusader.desktop";
|
|
"model/3mf" = "org.supermaker.superslicer.desktop";
|
|
"x-scheme-handler/geo" = "google-maps-geo-handler.desktop";
|
|
"x-scheme-handler/http" = "userapp-Firefox-5T0SK2.desktop";
|
|
"x-scheme-handler/https" = "userapp-Firefox-5T0SK2.desktop";
|
|
"x-scheme-handler/mailto" = "thunderbird.desktop";
|
|
"x-scheme-handler/slack" = "slack.desktop";
|
|
"x-scheme-handler/tel" = "org.kde.kdeconnect.handler.desktop";
|
|
"x-scheme-handler/tg" = "org.telegram.desktop._18faa92ddda377ceaa5a576303af9e59.desktop";
|
|
"x-scheme-handler/chrome" = "userapp-Firefox-5T0SK2.desktop";
|
|
"text/html" = "userapp-Firefox-5T0SK2.desktop";
|
|
"application/x-extension-htm" = "userapp-Firefox-5T0SK2.desktop";
|
|
"application/x-extension-html" = "userapp-Firefox-5T0SK2.desktop";
|
|
"application/x-extension-shtml" = "userapp-Firefox-5T0SK2.desktop";
|
|
"application/xhtml+xml" = "userapp-Firefox-5T0SK2.desktop";
|
|
"application/x-extension-xhtml" = "userapp-Firefox-5T0SK2.desktop";
|
|
"application/x-extension-xht" = "userapp-Firefox-5T0SK2.desktop";
|
|
};
|
|
enable = true;
|
|
};
|
|
# portal = {
|
|
# enable = true;
|
|
# };
|
|
};
|
|
|
|
nixGL.packages = pkgs.nixgl;
|
|
nixGL.defaultWrapper = "nvidia";
|
|
|
|
home.username = username;
|
|
|
|
home.homeDirectory = homedir;
|
|
|
|
home.stateVersion = "24.11";
|
|
|
|
home.packages = with pkgs; [
|
|
android-tools
|
|
android-udev-rules
|
|
# TODO: Move from system to nix
|
|
# awscli2
|
|
# kubectl
|
|
# Terminal image viewer
|
|
tcpdump
|
|
];
|
|
|
|
xdg.configFile = lib.mkMerge [
|
|
{
|
|
"ghostty/config" = {
|
|
text = ''
|
|
${builtins.readFile ./shared/ghostty.config}
|
|
|
|
font-size = 11
|
|
|
|
keybind = super+c=copy_to_clipboard
|
|
keybind = super+v=paste_from_clipboard
|
|
keybind = super+t=new_tab
|
|
'';
|
|
};
|
|
}
|
|
];
|
|
|
|
# TODO: Manual ghostty injection
|
|
programs.bat.syntaxes.ghostty = {
|
|
src = pkgs.ghostty;
|
|
file = "share/bat/syntaxes/ghostty.sublime-syntax";
|
|
};
|
|
|
|
programs.vim.plugins = [ pkgs.ghostty.vim ];
|
|
|
|
programs.git = {
|
|
enable = true;
|
|
userName = "Arnie";
|
|
userEmail = "i@cechis.cz";
|
|
ignores = [
|
|
".vscode"
|
|
".direnv"
|
|
".devenv"
|
|
".envrc"
|
|
];
|
|
extraConfig = {
|
|
core = {
|
|
autocrlf = "input";
|
|
# TODO: Provide through nix
|
|
hooksPath = "~/.git/hooks";
|
|
editor = "vim";
|
|
};
|
|
|
|
pull.rebase = false;
|
|
|
|
init.defaultBranch = "main";
|
|
};
|
|
};
|
|
|
|
# Can't use the nixgl wrapper due to GTK libraries
|
|
#
|
|
# programs.ghostty = {
|
|
# enable = true;
|
|
|
|
# installBatSyntax = true;
|
|
# installVimSyntax = true;
|
|
# enableZshIntegration = true;
|
|
|
|
# package = config.lib.nixGL.wrap pkgs.ghostty;
|
|
|
|
# settings = {
|
|
# theme = "catppuccin-mocha";
|
|
# font-size = 10;
|
|
# window-width = 9999;
|
|
# window-height = 9999;
|
|
# keybind = [ ];
|
|
# };
|
|
# };
|
|
|
|
programs.lsd = {
|
|
enable = true;
|
|
enableAliases = true;
|
|
settings = {
|
|
blocks = [
|
|
"permission"
|
|
"user"
|
|
"group"
|
|
"size"
|
|
"date"
|
|
"git"
|
|
"name"
|
|
];
|
|
sorting = {
|
|
dir-grouping = "first";
|
|
};
|
|
};
|
|
};
|
|
|
|
programs.pay-respects = {
|
|
enable = true;
|
|
enableZshIntegration = true;
|
|
};
|
|
|
|
# https://github.com/nix-community/plasma-manager
|
|
# https://nix-community.github.io/plasma-manager/options.xhtml
|
|
#https://github.com/HeitorAugustoLN/nix-config/tree/main/home/heitor/features/desktop/plasma
|
|
# ~/.config/kglobalshortcutsrc
|
|
programs.plasma = {
|
|
enable = true;
|
|
|
|
# killall kglobalaccel5; kglobalaccel5 &; disown
|
|
shortcuts = {
|
|
"org.kde.konsole.desktop" = {
|
|
_launch = "none";
|
|
};
|
|
|
|
"com.mitchellh.ghostty.desktop" = {
|
|
_launch = "Ctrl+Alt+T";
|
|
};
|
|
|
|
"KDE Keyboard Layout Switcher" = {
|
|
"Switch to Next Keyboard Layout" = "none";
|
|
};
|
|
|
|
kded5 = {
|
|
display = [
|
|
"none"
|
|
"none"
|
|
"Switch Display"
|
|
];
|
|
};
|
|
|
|
ksmserver = {
|
|
"Lock Session" = "Meta+Ctrl+Q";
|
|
};
|
|
|
|
kwin = {
|
|
"Window Maximize" = "Meta+Ctrl+Alt+M";
|
|
"Window Quick Tile Bottom" = "Meta+Ctrl+Alt+Down";
|
|
"Window Quick Tile Left" = "Meta+Ctrl+Alt+Left";
|
|
"Window Quick Tile Right" = "Meta+Ctrl+Alt+Right";
|
|
"Window Quick Tile Top" = "Meta+Ctrl+Alt+Up";
|
|
|
|
"Walk Through Windows" = "Meta+Tab";
|
|
"Walk Through Windows (Reverse)" = "Meta+Shift+Tab";
|
|
"Walk Through Windows of Current Application" = "Meta+`";
|
|
"Walk Through Windows of Current Application (Reverse)" = "Meta+Shift+`";
|
|
|
|
"Window Close" = "Meta+W";
|
|
|
|
"Overview" = "Ctrl+Meta+Tab";
|
|
|
|
"Switch One Desktop to the Right" = "none";
|
|
"Switch One Desktop to the Left" = "none";
|
|
|
|
"Edit Tiles" = "none";
|
|
};
|
|
|
|
plasmashell = {
|
|
"next activity" = "Meta+Ctrl+Right";
|
|
"previous activity" = "Meta+Ctrl+Left";
|
|
};
|
|
};
|
|
};
|
|
|
|
# TODO: Configure
|
|
# programs.ssh = {
|
|
# enable = true;
|
|
# };
|
|
|
|
programs.zsh = {
|
|
enable = true;
|
|
|
|
shellAliases = {
|
|
configure-ssh-terminfo = "${pkgs.writeShellScript "configure-ssh-terminfo" "infocmp -x | ssh \"$@\" -- tic -x -"}";
|
|
|
|
aws-ecr-login-skoda = "aws --profile skoda-prod --region eu-central-1 ecr get-login-password | sudo docker login 943160431142.dkr.ecr.eu-central-1.amazonaws.com -u AWS --password-stdin";
|
|
aws-ecr-login-scholaris = "aws --profile skoda-sch-dev --region eu-central-1 ecr get-login-password | sudo docker login 442913623981.dkr.ecr.eu-central-1.amazonaws.com -u AWS --password-stdin";
|
|
aws-ecr-login-yp = "aws-vault exec yp aws --region eu-central-1 ecr get-login-password | sudo docker login 060714730522.dkr.ecr.eu-central-1.amazonaws.com -u AWS --password-stdin";
|
|
aws-ecr-login-investbay = "aws-vault exec InvestBay-AccountManagement aws --region eu-central-1 ecr get-login-password | sudo docker login 297503416491.dkr.ecr.eu-central-1.amazonaws.com -u AWS --password-stdin";
|
|
|
|
};
|
|
dirHashes = {
|
|
mac = "${homedir}/storage/.macshare";
|
|
nix = "${homedir}/.config/nix";
|
|
circuitry = "${homedir}/storage/.circuitry";
|
|
dev = "${homedir}/storage/.devstack";
|
|
ai = "${homedir}/storage/.devstack/ai";
|
|
life = "${homedir}/storage/.life";
|
|
vysokyujezd = "${homedir}/storage/.life/stavby/vysoky-ujezd";
|
|
work = "/mnt/yosuke/share/arnie/work";
|
|
smarthome = "/mnt/yosuke/share/arnie/smarthome";
|
|
|
|
# Hardware
|
|
v2-red = "${homedir}/storage/.hardware/3d-print/v2-red-V2-2201270017";
|
|
"3dprint" = "${homedir}/storage/.hardware/3d-print";
|
|
|
|
# Development
|
|
projects = "${homedir}/storage/.devstack/projects";
|
|
yp = "${homedir}/storage/.devstack/projects/yp";
|
|
ys = "${homedir}/storage/.devstack/projects/ys";
|
|
investbay = "${homedir}/storage/.devstack/projects/investbay";
|
|
resource = "${homedir}/storage/.devstack/resource";
|
|
cechis = "${homedir}/storage/.devstack/projects/dev.cechis.cz";
|
|
gh = "${homedir}/storage/.devstack/projects/github/Sharsie";
|
|
rpi = "${homedir}/storage/.devstack/projects/hardware/rpi";
|
|
c4 = "/mnt/yosuke/share/arnie/smarthome/control4/drivers";
|
|
};
|
|
|
|
initExtra = ''
|
|
${builtins.concatStringsSep "\n" (
|
|
builtins.map (dir: ''
|
|
for file in ${dir}/*.zsh; do
|
|
source "$file"
|
|
done
|
|
'') zshSourceDirs
|
|
)}
|
|
|
|
autoload -U +X bashcompinit && bashcompinit
|
|
|
|
source <(${pkgs.kubectl}/bin/kubectl completion zsh)
|
|
complete -C '${pkgs.awscli2}/bin/aws_completer' aws
|
|
|
|
# Manual ghostty injection
|
|
if [[ -n $GHOSTTY_RESOURCES_DIR ]]; then
|
|
source "$GHOSTTY_RESOURCES_DIR"/shell-integration/zsh/ghostty-integration
|
|
fi
|
|
'';
|
|
};
|
|
|
|
systemd.user.services.keepass-sync = {
|
|
Unit.Description = "Sync KeePass database";
|
|
|
|
Service = {
|
|
Type = "oneshot";
|
|
ExecStart = toString (
|
|
pkgs.writeShellScript "keepass-sync" ''
|
|
${pkgs.coreutils}/bin/cp "/mnt/storage/.circuitry/.secret/default.kdbx" "/mnt/storage/.macshare/.secret/arnie.kdbx"
|
|
''
|
|
);
|
|
};
|
|
|
|
Install.WantedBy = [ "default.target" ];
|
|
};
|
|
|
|
systemd.user.services.voron2-red-sync = {
|
|
Unit.Description = "Sync Voron2 red gcodes";
|
|
|
|
Service = {
|
|
Type = "simple";
|
|
ExecStart = toString (
|
|
pkgs.writeShellScript "voron2-red-sync" ''
|
|
echo "Starting sync"
|
|
${pkgs.inotify-tools}/bin/inotifywait --monitor --recursive --quiet -e modify -e moved_to -e moved_from -e create -e delete /mnt/storage/.hardware/3d-print/v2-red-V2-2201270017/files | ${pkgs.writeShellScript "voron2-red-sync" ''
|
|
function sync() {
|
|
rsync -avz -e "ssh -i /home/becky/.ssh/voron2-red" --delete --exclude='.thumbs' /mnt/storage/.hardware/3d-print/v2-red-V2-2201270017/files/ pi@voron2-red:~/printer_data/gcodes/
|
|
if [[ $? -ne 0 ]]; then
|
|
echo "Sync failed"
|
|
fi
|
|
}
|
|
|
|
sync_pid=0
|
|
|
|
while read -r event; do
|
|
# Throttle syncing
|
|
if [ $sync_pid -ne 0 ]; then
|
|
kill $sync_pid 2>/dev/null || true
|
|
fi
|
|
|
|
# Schedule new sync
|
|
{ sleep 1; sync; } &
|
|
sync_pid=$!
|
|
done
|
|
''}
|
|
''
|
|
);
|
|
Restart = "always";
|
|
RestartSec = 1;
|
|
|
|
};
|
|
|
|
Install.WantedBy = [ "default.target" ];
|
|
};
|
|
|
|
systemd.user.timers.keepass-sync = {
|
|
Unit.Description = "Timer for KeePass sync";
|
|
|
|
Timer = {
|
|
OnBootSec = "1m";
|
|
OnUnitActiveSec = "10m";
|
|
};
|
|
|
|
Install.WantedBy = [ "timers.target" ];
|
|
};
|
|
|
|
# Total hack, not what HM is for
|
|
# Manually remove files if deleted here
|
|
home.activation.nfsRoute = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
|
/usr/bin/sudo ${pkgs.coreutils}/bin/ln -fs ${pkgs.writeShellScript "nfs-route" ''
|
|
if [ "$IFACE" = "enp4s0" ]; then
|
|
if [ "$(ip route list exact 10.125.248.55 | grep enp4s0 | wc -l)" == "0" ]; then
|
|
ip route add 10.125.248.55 via 10.124.248.248 dev enp4s0 metric 1
|
|
fi
|
|
|
|
if [ "$(ip route list exact 10.125.248.33 | grep enp4s0 | wc -l)" == "0" ]; then
|
|
ip route add 10.125.248.33 via 10.124.248.248 dev enp4s0 metric 1
|
|
fi
|
|
fi
|
|
''} /etc/network/if-up.d/nfs-route
|
|
|
|
/usr/bin/sudo ${pkgs.coreutils}/bin/mkdir -p /etc/network/if-post-down.d
|
|
|
|
/usr/bin/sudo ${pkgs.coreutils}/bin/ln -fs ${pkgs.writeShellScript "nfs-route" ''
|
|
if [ "$IFACE" = "enp4s0" ]; then
|
|
if [ "$(ip route list exact 10.125.248.55 | grep enp4s0 | wc -l)" != "0" ]; then
|
|
ip route del 10.125.248.55 via 10.124.248.248 dev enp4s0 metric 1
|
|
fi
|
|
|
|
if [ "$(ip route list exact 10.125.248.33 | grep enp4s0 | wc -l)" != "0" ]; then
|
|
ip route del 10.125.248.33 via 10.124.248.248 dev enp4s0 metric 1
|
|
fi
|
|
fi
|
|
''} /etc/network/if-post-down.d/nfs-route
|
|
'';
|
|
|
|
home.sessionVariables = {
|
|
EDITOR = "vim";
|
|
GO111MODULE = "on";
|
|
TERMINAL = "ghostty";
|
|
AWS_VAULT_BACKEND = "secret-service";
|
|
AWS_VAULT_SECRET_SERVICE_COLLECTION_NAME = "default";
|
|
};
|
|
}
|