diff --git a/common/tooling/default.nix b/common/tooling/default.nix index 8528569..0057a4d 100644 --- a/common/tooling/default.nix +++ b/common/tooling/default.nix @@ -21,7 +21,6 @@ in ./python.nix ./rust.nix ./lsp.nix - ./helix.nix ./git.nix # ./wine.nix ./c.nix @@ -75,23 +74,6 @@ in bottles ]; - environment.shellAliases = { - ":q" = "exit"; - "ls" = "eza"; - "lix" = "nix"; - "l" = "eza -hla"; - "vi" = "hx"; - "bat" = "bat --theme=Dracula"; - }; - - programs.tmux = { - enable = true; - historyLimit = 42000; - #keyMode = "vi"; - }; - - programs.fzf.fuzzyCompletion = true; - environment.sessionVariables = { MANPAGER = "sh -c 'col -bx | ${getExe pkgs.bat} -l man -p'"; MANROFFOPT = "-c"; @@ -105,29 +87,6 @@ in boot.tmp.cleanOnBoot = true; zramSwap.enable = false; - - #programs.ssh = { - # # startAgent = true; - # enableAskPassword = graphical; - # askPassword = mkIf graphical (getExe pkgs.lxqt.lxqt-openssh-askpass); - #}; - programs.thefuck.enable = true; - - programs.starship = { - enable = true; - settings = { - format = "$all$directory$character"; - nodejs.disabled = true; - cmake.symbol = "cmake "; - custom.shell = { - command = "basename $SHELL"; - when = "test -v SHELL"; - format = " in [$output]($style)"; - # ignore_timeout = true; - }; - # env_var.SHELL = {variable = "SHELL"; default = ""; }; - }; - }; }; options.grimmShared.tooling = { diff --git a/hm/common/default.nix b/hm/common/default.nix new file mode 100644 index 0000000..7cb00a0 --- /dev/null +++ b/hm/common/default.nix @@ -0,0 +1,160 @@ +{ + pkgs, + config, + osConfig, + lib, + ... +}: +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; + + osConfigGetIfHasOrFalse = path: lib.defaultTo false (getIfHas (lib.splitString "." path) osConfig); + + user = config.home.username; + homedir = config.home.homeDirectory; + graphical = osConfigGetIfHasOrFalse "grimmShared.graphical"; +in +{ + home.preferXdgDirectories = true; + + home.packages = with pkgs; [ + deskwhich + ] ++ lib.optionals graphical [ + # imhex + # libreoffice-qt + filezilla + obsidian + nomacs + pdfarranger + krita + # weasis + + # kicad + prusa-slicer + freecad + openscad + + vlc + # blender + ]; + + home.shellAliases = { + ":q" = "exit"; + "ls" = "eza"; + "lix" = "nix"; + "l" = "eza -hla"; + "vi" = "hx"; + "bat" = "bat --theme=Dracula"; + }; + programs.thunderbird = { + enable = graphical; + profiles.default = { + isDefault = true; + }; + }; + + programs.zathura.enable = graphical; + programs.bash = { + enable = true; + enableCompletion = true; + }; + + programs.alacritty = { + enable = graphical; + settings = { + font.size = 16; + font.normal = { + family = "Noto Sans Mono"; + }; + window.opacity = 0.85; + }; + }; + + programs.starship = { + enable = true; + enableBashIntegration = true; + settings = { + format = "$all$directory$character"; + nodejs.disabled = true; + cmake.symbol = "cmake "; + custom.shell = { + command = "basename $SHELL"; + when = "test -v SHELL"; + format = " in [$output]($style)"; + # ignore_timeout = true; + }; + # env_var.SHELL = {variable = "SHELL"; default = ""; }; + }; + }; + + programs.fzf.enable = true; + programs.fzf.tmux.enableShellIntegration = true; + + programs.thefuck = { + enable = true; + enableBashIntegration = true; + }; + + programs.helix = { + enable = true; + defaultEditor = true; + settings = { + editor.cursor-shape.insert = "bar"; + theme = "base16_transparent"; + }; + extraPackages = with pkgs; [ + marksman + nixd + ]; + }; + + programs.tmux = { + enable = true; + clock24 = true; + historyLimit = 50000; + newSession = true; + }; + + systemd.user.enable = true; + systemd.user.tmpfiles.rules = lib.optional (osConfigGetIfHasOrFalse "services.printing.cups-pdf.enable") "L ${homedir}/PDF - - - - /var/spool/cups-pdf-pdf/users/${user}"; + + xdg.userDirs = { + enable = true; + createDirectories = true; + }; + + 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; +} diff --git a/hm/grimmauld/grimmauld.gpg b/hm/common/grimmauld.gpg similarity index 100% rename from hm/grimmauld/grimmauld.gpg rename to hm/common/grimmauld.gpg diff --git a/hm/default.nix b/hm/default.nix index 7940627..b3a76ed 100644 --- a/hm/default.nix +++ b/hm/default.nix @@ -1,5 +1,12 @@ { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + + sharedModules = [ + { home.stateVersion = "24.11"; } + ./common + ]; + }; imports = [ ./grimmauld ]; } diff --git a/hm/grimmauld/default.nix b/hm/grimmauld/default.nix index c376617..3854686 100644 --- a/hm/grimmauld/default.nix +++ b/hm/grimmauld/default.nix @@ -1,118 +1,14 @@ -{ - 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 = { + username = "grimmauld"; +in +{ + home-manager.users."${username}" = { 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 - ]; + inherit username; + homeDirectory = "/home/${username}"; 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; }