{ pkgs, lib, config ? { }, ... }: let getIfHas = path: attrs: if path == [ ] then attrs else if builtins.hasAttr (builtins.head path) attrs then getIfHas (builtins.tail path) (builtins.getAttr (builtins.head path) attrs) else null; configGetIfHasOrFalse = path: lib.defaultTo false (getIfHas (lib.splitString "." path) config); user = hm_config.home.username; homedir = hm_config.home.homeDirectory; graphical = configGetIfHasOrFalse "grimmShared.graphical"; hm_config = { home = { username = "grimmauld"; stateVersion = "24.11"; homeDirectory = "/home/${user}"; preferXdgDirectories = true; packages = with pkgs; [ deskwhich # imhex # libreoffice-qt filezilla obsidian nomacs pdfarranger krita # weasis # kicad prusa-slicer freecad openscad vlc # blender ]; file.".ssh/id_ed25519_sk".source = ../../ssh/id_ed25519_sk; file.".ssh/id_ed25519_sk.pub".source = ../../ssh/id_ed25519_sk.pub; }; programs.thunderbird = { enable = graphical; profiles.default = { isDefault = true; }; }; programs.zathura.enable = graphical; programs.alacritty = { enable = graphical; settings = { font.size = 16; font.normal = { family = "Noto Sans Mono"; }; window.opacity = 0.85; }; }; systemd.user.enable = true; systemd.user.tmpfiles.rules = lib.optional (configGetIfHasOrFalse "services.printing.cups-pdf.enable") "L ${homedir}/PDF - - - - /var/spool/cups-pdf-pdf/users/${user}"; xdg.userDirs = { enable = true; createDirectories = true; extraConfig = { "3d" = "${homedir}/3d"; }; }; programs.gradle = { enable = true; settings = { "org.gradle.java.home" = "${pkgs.openjdk}/lib/openjdk"; "org.gradle.java.installations.auto-detect" = false; }; }; programs.gpg = { enable = true; mutableKeys = true; publicKeys = [ { source = ./grimmauld.gpg; trust = 5; } ]; }; services.gpg-agent = { enable = true; enableBashIntegration = true; pinentryPackage = if graphical then pkgs.pinentry-qt else pkgs.pinentry-tty; }; xdg.mimeApps.enable = true; services.ssh-agent.enable = true; }; in { home-manager.users."${user}" = hm_config; }