Covers four methods: system-wide, per-user nix profile, per-project devShell, and external flakes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
126 lines
2.2 KiB
Markdown
126 lines
2.2 KiB
Markdown
# Adding Dev Tools
|
|
|
|
How to add development tools to the ops-jrz1 server.
|
|
|
|
## Options
|
|
|
|
### 1. System-wide (all users)
|
|
|
|
Best for: common tools everyone needs (git, vim, htop, curl)
|
|
|
|
```nix
|
|
# configuration.nix
|
|
environment.systemPackages = with pkgs; [
|
|
tldr
|
|
bat
|
|
fd
|
|
];
|
|
```
|
|
|
|
Then deploy:
|
|
```bash
|
|
nix flake check
|
|
nixos-rebuild switch --flake .#ops-jrz1 --target-host root@ops-jrz1
|
|
```
|
|
|
|
### 2. Per-user (nix profile)
|
|
|
|
Best for: personal preferences (editor configs, shell tools)
|
|
|
|
```bash
|
|
# User runs on server:
|
|
nix profile install nixpkgs#tldr
|
|
nix profile install nixpkgs#bat
|
|
|
|
# List installed:
|
|
nix profile list
|
|
|
|
# Update all:
|
|
nix profile upgrade '.*'
|
|
|
|
# Remove:
|
|
nix profile remove tldr
|
|
```
|
|
|
|
Survives reboots, user-managed, not in git.
|
|
|
|
### 3. Per-project (flake devShell)
|
|
|
|
Best for: project-specific dependencies
|
|
|
|
```nix
|
|
# flake.nix in project directory
|
|
{
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
outputs = { nixpkgs, ... }:
|
|
let
|
|
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
|
in {
|
|
devShells.x86_64-linux.default = pkgs.mkShell {
|
|
packages = with pkgs; [
|
|
python3
|
|
uv
|
|
ruff
|
|
];
|
|
};
|
|
};
|
|
}
|
|
```
|
|
|
|
Then:
|
|
```bash
|
|
nix develop # Enter shell
|
|
# or with direnv:
|
|
echo "use flake" > .envrc
|
|
direnv allow
|
|
```
|
|
|
|
### 4. External flake (not in nixpkgs)
|
|
|
|
For tools packaged as flakes (like opencode, beads):
|
|
|
|
```nix
|
|
# flake.nix inputs
|
|
inputs.sometool.url = "github:org/sometool";
|
|
|
|
# Pass to NixOS
|
|
specialArgs = {
|
|
sometool = inputs.sometool.packages.x86_64-linux.default;
|
|
};
|
|
|
|
# configuration.nix
|
|
environment.systemPackages = [ sometool ];
|
|
```
|
|
|
|
## Finding Packages
|
|
|
|
```bash
|
|
# Search nixpkgs
|
|
nix search nixpkgs tldr
|
|
|
|
# Check if package exists
|
|
nix eval nixpkgs#tldr.meta.description
|
|
```
|
|
|
|
## Recommendations
|
|
|
|
| Tool Type | Method |
|
|
|-----------|--------|
|
|
| Core utils (git, curl, vim) | System-wide |
|
|
| Build tools (go, rust, node) | System-wide |
|
|
| Personal prefs (tldr, bat, eza) | Per-user |
|
|
| Project deps (linters, formatters) | Per-project |
|
|
| AI tools with auth (claude, gemini) | Per-user |
|
|
|
|
## Updating
|
|
|
|
```bash
|
|
# Update flake inputs (external tools)
|
|
nix flake update
|
|
nixos-rebuild switch ...
|
|
|
|
# Update user profile
|
|
nix profile upgrade '.*'
|
|
```
|