From bfc9af382f40c0c2eff3f304d3480eefce67e145 Mon Sep 17 00:00:00 2001 From: Christoph Schmatzler Date: Sun, 8 Mar 2026 19:08:15 +0000 Subject: [PATCH] refactor: distribute packages from _lib/packages.nix into aspect modules --- modules/_lib/packages.nix | 66 --------------------------------------- modules/ai-tools.nix | 2 +- modules/core.nix | 12 ++++++- modules/darwin.nix | 7 +++++ modules/defaults.nix | 1 + modules/desktop.nix | 12 ++++++- modules/dev-tools.nix | 38 +++++++++++++++++++++- modules/finance.nix | 5 +++ modules/network.nix | 15 +++++++++ modules/secrets.nix | 9 ++++++ modules/shell.nix | 5 +++ modules/ssh-client.nix | 2 ++ modules/terminal.nix | 26 ++++++++++++++- modules/user.nix | 3 -- 14 files changed, 129 insertions(+), 74 deletions(-) delete mode 100644 modules/_lib/packages.nix create mode 100644 modules/finance.nix diff --git a/modules/_lib/packages.nix b/modules/_lib/packages.nix deleted file mode 100644 index 941d0c4..0000000 --- a/modules/_lib/packages.nix +++ /dev/null @@ -1,66 +0,0 @@ -{ - inputs, - lib, - pkgs, - ... -}: -with pkgs; - [ - (callPackage ./open-project.nix {}) - age - alejandra - ast-grep - bun - delta - devenv - dig - docker - docker-compose - dust - fastfetch - fd - gh - git - glow - gnumake - gnupg - hledger - htop - hyperfine - jj-ryu - jj-starship - jq - killall - lsof - nodejs_24 - nurl - openssh - ouch - ov - pnpm - postgresql_17 - sd - serie - sops - sqlite - tea - tokei - tree - tree-sitter - tuicr - vivid - ] - ++ lib.optionals stdenv.isDarwin [ - _1password-gui - alcove - dockutil - mas - raycast - tailscale - xcodes - ] - ++ lib.optionals stdenv.isLinux [ - gcc15 - ghostty.terminfo - lm_sensors - ] diff --git a/modules/ai-tools.nix b/modules/ai-tools.nix index e8723f2..b639f44 100644 --- a/modules/ai-tools.nix +++ b/modules/ai-tools.nix @@ -1,4 +1,4 @@ -{inputs, ...}: { +{ den.aspects.ai-tools.homeManager = { pkgs, inputs', diff --git a/modules/core.nix b/modules/core.nix index 08f0e70..3368df0 100644 --- a/modules/core.nix +++ b/modules/core.nix @@ -1,5 +1,9 @@ {...}: { - den.aspects.core.os = {pkgs, ...}: { + den.aspects.core.os = { + pkgs, + lib, + ... + }: { programs.fish.enable = true; environment.shells = [pkgs.nushell]; @@ -29,5 +33,11 @@ experimental-features = nix-command flakes ''; }; + + # System utilities + environment.systemPackages = + lib.optionals pkgs.stdenv.isLinux [ + pkgs.lm_sensors + ]; }; } diff --git a/modules/darwin.nix b/modules/darwin.nix index 548201d..73422d9 100644 --- a/modules/darwin.nix +++ b/modules/darwin.nix @@ -137,5 +137,12 @@ "tidal" ]; }; + + # Darwin system utilities + environment.systemPackages = with pkgs; [ + alcove + dockutil + mas + ]; }; } diff --git a/modules/defaults.nix b/modules/defaults.nix index 6381990..5a952ca 100644 --- a/modules/defaults.nix +++ b/modules/defaults.nix @@ -29,6 +29,7 @@ desktop = ./desktop.nix; dev-tools = ./dev-tools.nix; email = ./email.nix; + finance = ./finance.nix; neovim = ./neovim.nix; network = ./network.nix; nixos-system = ./nixos-system.nix; diff --git a/modules/desktop.nix b/modules/desktop.nix index b683364..109e27d 100644 --- a/modules/desktop.nix +++ b/modules/desktop.nix @@ -1,5 +1,9 @@ {...}: { - den.aspects.desktop.homeManager = {...}: { + den.aspects.desktop.homeManager = { + pkgs, + lib, + ... + }: { programs.aerospace = { enable = true; launchd.enable = true; @@ -140,5 +144,11 @@ }; }; }; + + home.packages = with pkgs; + lib.optionals stdenv.isDarwin [ + _1password-gui + raycast + ]; }; } diff --git a/modules/dev-tools.nix b/modules/dev-tools.nix index f26f188..a392e98 100644 --- a/modules/dev-tools.nix +++ b/modules/dev-tools.nix @@ -1,5 +1,9 @@ {...}: { - den.aspects.dev-tools.homeManager = {...}: let + den.aspects.dev-tools.homeManager = { + pkgs, + lib, + ... + }: let name = "Christoph Schmatzler"; in { # Git configuration @@ -367,5 +371,37 @@ auto_install = false; }; }; + + home.packages = with pkgs; + [ + alejandra + ast-grep + bun + delta + devenv + docker + docker-compose + gh + git + gnumake + hyperfine + jj-ryu + jj-starship + nodejs_24 + nurl + pnpm + postgresql_17 + serie + sqlite + tea + tokei + tree-sitter + ] + ++ lib.optionals stdenv.isDarwin [ + xcodes + ] + ++ lib.optionals stdenv.isLinux [ + gcc15 + ]; }; } diff --git a/modules/finance.nix b/modules/finance.nix new file mode 100644 index 0000000..fe90b58 --- /dev/null +++ b/modules/finance.nix @@ -0,0 +1,5 @@ +{...}: { + den.aspects.finance.homeManager = {pkgs, ...}: { + home.packages = [pkgs.hledger]; + }; +} diff --git a/modules/network.nix b/modules/network.nix index e7c2406..9fd73fb 100644 --- a/modules/network.nix +++ b/modules/network.nix @@ -64,4 +64,19 @@ enable = true; }; }; + + # Network tools + den.aspects.network.homeManager = { + pkgs, + lib, + ... + }: { + home.packages = with pkgs; + [ + dig + ] + ++ lib.optionals stdenv.isDarwin [ + tailscale + ]; + }; } diff --git a/modules/secrets.nix b/modules/secrets.nix index e75da23..3482b93 100644 --- a/modules/secrets.nix +++ b/modules/secrets.nix @@ -12,4 +12,13 @@ sops.age.sshKeyPaths = []; sops.gnupg.sshKeyPaths = []; }; + + # Encryption/secrets tools + den.aspects.secrets.homeManager = {pkgs, ...}: { + home.packages = with pkgs; [ + age + gnupg + sops + ]; + }; } diff --git a/modules/shell.nix b/modules/shell.nix index 7b15cbd..42a5899 100644 --- a/modules/shell.nix +++ b/modules/shell.nix @@ -281,5 +281,10 @@ }; }; }; + + home.packages = with pkgs; [ + vivid + (callPackage ./_lib/open-project.nix {}) + ]; }; } diff --git a/modules/ssh-client.nix b/modules/ssh-client.nix index 5dd41cf..db14d60 100644 --- a/modules/ssh-client.nix +++ b/modules/ssh-client.nix @@ -23,5 +23,7 @@ }; }; }; + + home.packages = [pkgs.openssh]; }; } diff --git a/modules/terminal.nix b/modules/terminal.nix index 126c32b..62ad570 100644 --- a/modules/terminal.nix +++ b/modules/terminal.nix @@ -1,5 +1,9 @@ {...}: { - den.aspects.terminal.homeManager = {pkgs, ...}: { + den.aspects.terminal.homeManager = { + pkgs, + lib, + ... + }: { xdg.configFile."ghostty/config".text = '' command = ${pkgs.nushell}/bin/nu theme = Catppuccin Latte @@ -125,5 +129,25 @@ }; }; }; + + home.packages = with pkgs; + [ + dust + fastfetch + fd + glow + htop + jq + killall + lsof + ouch + ov + sd + tree + tuicr + ] + ++ lib.optionals stdenv.isLinux [ + ghostty.terminfo + ]; }; } diff --git a/modules/user.nix b/modules/user.nix index 80bffda..082b86e 100644 --- a/modules/user.nix +++ b/modules/user.nix @@ -8,13 +8,10 @@ den.aspects.cschmatzler.homeManager = { lib, pkgs, - inputs', ... }: { programs.home-manager.enable = true; - home.packages = pkgs.callPackage ./_lib/packages.nix {inputs = inputs';}; - home.activation = lib.mkIf pkgs.stdenv.isDarwin { "setWallpaper" =