/ modules / common / packages.nix
packages.nix
  1  {
  2    config,
  3    lib,
  4    pkgs,
  5    ...
  6  }:
  7  let
  8    inherit (lib) attrValues optionalAttrs;
  9  in
 10  {
 11    # Cross-platform system packages
 12    environment.systemPackages = attrValues (
 13      {
 14        inherit (pkgs)
 15          # Core tools (work everywhere)
 16          helix
 17          bat # Cat clone with syntax highlighting
 18          curlHTTP3 # HTTP/3 curl
 19          eza # Modern replacement for `ls`
 20          fastfetch # Faster, flexible neofetch
 21          fd # Rust alternative to `find`
 22          # ghostty # Modern terminal
 23          hyperfine # Command line benchmarking tool
 24          obsidian # Personal Knowledge Management Application
 25          ripgrep # Recursively regex searches w/ .gitignore respect
 26          tokei # Count your code, quickly
 27          xh # Friendly and fast tool for sending HTTP requests
 28          yazi # Command line file manager
 29          zellij # Terminal multiplexer, built in Rust
 30  
 31          # Development tools
 32          git # Distributed version control system
 33          jujutsu # Git-compatible DVCS
 34          delta # Syntax-highlighting pager for git
 35          direnv # Shell extension that manages your environment
 36  
 37          # System monitoring (cross-platform)
 38          btop # Resource monitor that shows usage and stats
 39          htop # Interactive process viewer
 40  
 41          # Nix tools
 42          nh # Modern nix helper with better UX
 43          nix-index # Quickly locate nix packages with specific files
 44          nix-output-monitor # Processes output of Nix commands to show helpful progress
 45  
 46          # Network & Privacy
 47          tor # Anonymizing overlay network
 48  
 49          # Code formatting & analysis
 50          alejandra # Uncompromising Nix Code Formatter
 51  
 52          # Rust development
 53          bacon # Background rust compiler
 54  
 55          # Git tools that should be system-wide
 56          act # Run your GitHub Actions locally
 57          ;
 58      }
 59      // optionalAttrs config.isDesktop {
 60        inherit (pkgs)
 61          # Development tools (desktop only)
 62          age # Modern encryption tool with small explicit keys
 63          deno # Secure runtime for TS
 64          go # Go Programming language
 65          nodejs # Event-driven I/O framework for the V8 engine
 66          rustup # Rust toolchain installer
 67  
 68          # Media tools
 69          ffmpeg_6 # Record, convert and stream audio and video
 70  
 71          # Applications
 72          anki-bin # Spaced repetition flashcard program
 73          ollama # LLMs locally
 74          radicle-node # P2P code collaboration
 75          ;
 76      }
 77      // optionalAttrs config.isDarwin {
 78        inherit (pkgs)
 79          # macOS-specific tools
 80          pam-reattach # Reattach to GUI session on macOS during auth
 81          ;
 82      }
 83      // optionalAttrs config.isLinux {
 84        inherit (pkgs)
 85          # Linux-specific system tools
 86          traceroute
 87          usbutils
 88          strace
 89  
 90          # Linux desktop applications
 91          brave
 92          ;
 93      }
 94      // optionalAttrs (config.isLinux && config.isDesktop) {
 95        inherit (pkgs)
 96          # Linux desktop applications
 97  
 98          # Communication
 99          zulip
100          fractal
101  
102          # Development
103          vscode # Available on Linux
104          ;
105      }
106    );
107  
108    # Platform-specific package overrides
109    nixpkgs.overlays = [
110      (final: prev: {
111        radicle-node =
112          if prev.stdenv.isDarwin then
113            prev.radicle-node.overrideAttrs (old: {
114              # Filter out Linux-specific dependencies but keep essential ones
115              buildInputs = lib.filter (
116                pkg:
117                let
118                  pname = pkg.pname or "";
119                in
120                !(lib.elem pname [
121                  "xdg-utils"
122                  "hostname-debian"
123                ])
124              ) (old.buildInputs or [ ]);
125  
126              nativeBuildInputs =
127                (lib.filter (
128                  pkg:
129                  let
130                    pname = pkg.pname or "";
131                  in
132                  !(lib.elem pname [
133                    "xdg-utils"
134                    "hostname-debian"
135                  ])
136                ) (old.nativeBuildInputs or [ ]))
137                ++ [
138                  # Add any missing build dependencies
139                  prev.asciidoctor
140                ];
141  
142              # Simplified postFixup that avoids xdg-utils on macOS
143              postFixup = ''
144                for program in $out/bin/* ; do
145                  wrapProgram "$program" \
146                    --prefix PATH : "${
147                      prev.lib.makeBinPath (
148                        lib.filter
149                          (
150                            pkg:
151                            let
152                              pname = pkg.pname or "";
153                            in
154                            !(lib.elem pname [
155                              "xdg-utils"
156                              "hostname-debian"
157                            ])
158                          )
159                          [
160                            prev.git
161                            prev.openssh
162                            prev.openssl
163                          ]
164                      )
165                    }"
166                done
167              '';
168            })
169          else
170            # On Linux, use the original package
171            prev.radicle-node;
172      })
173    ];
174  
175    # Home-manager packages (user-specific tools)
176    home-manager.sharedModules = [
177      {
178        home.packages =
179          with pkgs;
180          [
181            # Core utilities (cross-platform)
182            uutils-coreutils # Cross-platform Rust rewrite of the GNU coreutils
183            unixtools.script # Script command for recording terminal sessions
184  
185            # Development tools
186            bun # TS runtime/bundler/transpiler/package manager
187            cabal-install # Command-line interface for Cabal and Hackage
188            ghc # Glasgow Haskell Compiler
189            cachix # Command-line client for Nix binary cache hosting
190            jdk11 # Open-source Java Development Kit
191  
192            # Data & Analytics
193            dbt # SQL based ETL tooling
194  
195            # Containerization
196            docker # Lightweight container packaging
197  
198            # Text & File processing
199            figlet # Make large letters out of ordinary text
200            fselect # Find files with SQL-like queries
201            sd # Intuitive find & replace CLI (sed alternative)
202  
203            # Media processing
204            librsvg # Render SVG images to Cairo surfaces
205            libwebp # Tools and library for the WebP image format
206            optipng # PNG optimizer
207  
208            # Audio & Media (cross-platform)
209            ncspot # Spotify cli client
210  
211            # Web tools
212            openssl # Cryptographic library that implements SSL and TLS
213  
214            # Utilities
215            pastel # CLI tool to generate/analyze/convert colors
216  
217            # Database
218            redis # Open source, advanced key-value store
219  
220            # Search & Text processing
221            ripgrep-all # Ripgrep, but also search in PDFs, E-Books, + more
222            skim # Command-line fuzzy finder written in Rust
223  
224            # Security & Secrets
225            sops # Simple and flexible tool for managing secrets
226  
227            # Python tooling
228            uv # Python package installer/resolver, RIIR
229  
230            # Learning & Workshops
231            workshop-runner # CLI Runner for test driven Rust workshops
232  
233            # Cloud tools
234            awscli2 # Unified tool to manage your AWS services
235  
236            # Monitoring tools
237            hwatch # Modern (Rust) alternative to watch
238  
239            # Specialized tools
240            blast-bin # Finds similarity between biological sequences
241            bore-cli # Rust tool to create TCP tunnels
242          ]
243          ++ lib.optionals pkgs.stdenv.isDarwin [
244            # macOS-specific tools
245            monitorcontrol # Sys. ext. to control external monitors
246            skhd # Simple hotkey daemon for macOS
247            yabai # Tiling window manager for macOS
248          ]
249          ++ lib.optionals pkgs.stdenv.isLinux [
250            # Linux-specific tools
251            playerctl # Command-line utility for controlling media players
252            pavucontrol # PulseAudio Volume Control
253            xclip # Command line clipboard access
254          ];
255      }
256    ];
257  }