{ 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 ''; }; } ]; # 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"; }; 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"; }; plasmashell = { "next activity" = "Meta+Ctrl+Right"; "previous activity" = "Meta+Ctrl+Left"; }; }; }; # TODO: Configure # programs.ssh = { # enable = true; # }; programs.zsh = { enable = true; shellAliases = { hm-switch = "home-manager switch --impure --flake ~/.config/nix"; configure-ssh-terminfo = "f(){ infocmp -x | ssh \"$@\" -- tic -x -; unset -f f; }; f"; }; 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.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.writeTextFile { name = "nfs-route"; text = '' # NFS 200 nfsroute ''; } } /etc/iproute2/rt_tables.d/20-nfs.conf /usr/bin/sudo ${pkgs.coreutils}/bin/ln -fs ${pkgs.writeShellScript "nfs-route" '' if [ "$IFACE" = "enp4s0" ]; then if [ "$(ip route list table nfsroute 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 table nfsroute fi if [ "$(ip route list table nfsroute 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 table nfsroute fi if [ "$(ip rule list from 10.124.248.5 | ${pkgs.gnugrep}/bin/grep nfsroute | ${pkgs.coreutils}/bin/wc -l)" == "0" ]; then ip rule add from 10.124.248.5 lookup nfsroute 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 table nfsroute 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 table nfsroute fi if [ "$(ip route list table nfsroute 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 table nfsroute fi if [ "$(ip rule list from 10.124.248.5 | ${pkgs.gnugrep}/bin/grep nfsroute | ${pkgs.coreutils}/bin/wc -l)" != "0" ]; then ip rule del from 10.124.248.5 lookup nfsroute fi fi ''} /etc/network/if-post-down.d/nfs-route ''; home.sessionVariables = { EDITOR = "vim"; GO111MODULE = "on"; TERMINAL = "ghostty"; }; }