feat(modules): system package catalog and development tooling
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
1d90e18860
commit
2289f91048
2 changed files with 677 additions and 0 deletions
475
modules/development.nix
Normal file
475
modules/development.nix
Normal file
|
|
@ -0,0 +1,475 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
cfg = config.omni;
|
||||
omni = config.omni.lib;
|
||||
in
|
||||
{
|
||||
config = mkIf (config.omni.packs.development.enable or false) {
|
||||
# Development tools
|
||||
environment.systemPackages = with pkgs; [
|
||||
# Version control
|
||||
git
|
||||
git-lfs
|
||||
lazygit
|
||||
gh
|
||||
gitlab
|
||||
hub
|
||||
|
||||
# Editors and IDEs
|
||||
# neovim (configured via home-manager programs.neovim)
|
||||
claude-code
|
||||
opencode
|
||||
pi-coding-agent
|
||||
vscode
|
||||
vim
|
||||
emacs
|
||||
|
||||
# Language servers and tools
|
||||
# Nix
|
||||
nil
|
||||
nixfmt
|
||||
statix
|
||||
deadnix
|
||||
nixd
|
||||
alejandra
|
||||
|
||||
# Rust
|
||||
rustc
|
||||
cargo
|
||||
rustfmt
|
||||
rust-analyzer
|
||||
clippy
|
||||
cargo-watch
|
||||
cargo-edit
|
||||
cargo-audit
|
||||
bacon
|
||||
|
||||
# Go
|
||||
go
|
||||
gopls
|
||||
gotools
|
||||
go-tools
|
||||
golangci-lint
|
||||
delve
|
||||
gomodifytags
|
||||
gotests
|
||||
impl
|
||||
|
||||
# Python
|
||||
python3
|
||||
python3Packages.pip
|
||||
python3Packages.virtualenv
|
||||
python3Packages.black
|
||||
python3Packages.pylint
|
||||
python3Packages.pytest
|
||||
python3Packages.ipython
|
||||
pyright
|
||||
ruff
|
||||
|
||||
# Node.js
|
||||
nodejs
|
||||
pnpm
|
||||
yarn
|
||||
typescript
|
||||
typescript-language-server
|
||||
eslint
|
||||
prettier
|
||||
nodemon
|
||||
deno
|
||||
bun
|
||||
|
||||
# C/C++
|
||||
gcc
|
||||
clang
|
||||
cmake
|
||||
gnumake
|
||||
gdb
|
||||
lldb
|
||||
clang-tools
|
||||
ccls
|
||||
bear
|
||||
valgrind
|
||||
|
||||
# Java
|
||||
jdk
|
||||
maven
|
||||
gradle
|
||||
jdt-language-server
|
||||
|
||||
# Julia
|
||||
julia-bin
|
||||
|
||||
# Database tools
|
||||
postgresql
|
||||
mysql84
|
||||
sqlite
|
||||
redis
|
||||
mongodb
|
||||
dbeaver-bin
|
||||
|
||||
# Container tools
|
||||
docker
|
||||
docker-compose
|
||||
podman
|
||||
buildah
|
||||
skopeo
|
||||
dive
|
||||
lazydocker
|
||||
|
||||
# Kubernetes tools
|
||||
kubectl
|
||||
kubernetes-helm
|
||||
k9s
|
||||
kind
|
||||
minikube
|
||||
kustomize
|
||||
kubectx
|
||||
stern
|
||||
kubecolor
|
||||
|
||||
# Cloud tools
|
||||
awscli2
|
||||
google-cloud-sdk
|
||||
azure-cli
|
||||
terraform
|
||||
terragrunt
|
||||
ansible
|
||||
vagrant
|
||||
packer
|
||||
|
||||
# API development
|
||||
httpie
|
||||
curl
|
||||
postman
|
||||
insomnia
|
||||
grpcurl
|
||||
evans
|
||||
|
||||
# Build tools
|
||||
bazel
|
||||
meson
|
||||
ninja
|
||||
scons
|
||||
|
||||
# Documentation tools
|
||||
mdbook
|
||||
hugo
|
||||
mkdocs
|
||||
sphinx
|
||||
|
||||
# Performance tools
|
||||
hyperfine
|
||||
flamegraph
|
||||
perf-tools
|
||||
heaptrack
|
||||
|
||||
# Network tools
|
||||
wireshark
|
||||
tcpdump
|
||||
nmap
|
||||
netcat
|
||||
socat
|
||||
mtr
|
||||
|
||||
# Misc development utilities
|
||||
jq
|
||||
yq-go
|
||||
fx
|
||||
direnv
|
||||
watchexec
|
||||
entr
|
||||
tmux
|
||||
tmuxinator
|
||||
asciinema
|
||||
tokei
|
||||
cloc
|
||||
tree-sitter
|
||||
|
||||
# Custom development scripts
|
||||
(writeShellScriptBin "dev-postgres" ''
|
||||
#!/usr/bin/env bash
|
||||
echo "Starting PostgreSQL development container..."
|
||||
docker run --rm -d \
|
||||
--name dev-postgres \
|
||||
-e POSTGRES_PASSWORD=postgres \
|
||||
-p 5432:5432 \
|
||||
postgres:15-alpine
|
||||
echo "PostgreSQL running on localhost:5432"
|
||||
echo "Username: postgres, Password: postgres"
|
||||
echo "Stop with: docker stop dev-postgres"
|
||||
'')
|
||||
|
||||
(writeShellScriptBin "dev-redis" ''
|
||||
#!/usr/bin/env bash
|
||||
echo "Starting Redis development container..."
|
||||
docker run --rm -d \
|
||||
--name dev-redis \
|
||||
-p 6379:6379 \
|
||||
redis:alpine
|
||||
echo "Redis running on localhost:6379"
|
||||
echo "Stop with: docker stop dev-redis"
|
||||
'')
|
||||
|
||||
(writeShellScriptBin "dev-mysql" ''
|
||||
#!/usr/bin/env bash
|
||||
echo "Starting MySQL development container..."
|
||||
docker run --rm -d \
|
||||
--name dev-mysql \
|
||||
-e MYSQL_ROOT_PASSWORD=mysql \
|
||||
-p 3306:3306 \
|
||||
mysql:8
|
||||
echo "MySQL running on localhost:3306"
|
||||
echo "Username: root, Password: mysql"
|
||||
echo "Stop with: docker stop dev-mysql"
|
||||
'')
|
||||
|
||||
(writeShellScriptBin "dev-mongodb" ''
|
||||
#!/usr/bin/env bash
|
||||
echo "Starting MongoDB development container..."
|
||||
docker run --rm -d \
|
||||
--name dev-mongodb \
|
||||
-p 27017:27017 \
|
||||
mongo:latest
|
||||
echo "MongoDB running on localhost:27017"
|
||||
echo "Stop with: docker stop dev-mongodb"
|
||||
'')
|
||||
|
||||
(writeShellScriptBin "dev-env" ''
|
||||
#!/usr/bin/env bash
|
||||
# Create a development shell for a specific language
|
||||
|
||||
case "$1" in
|
||||
rust)
|
||||
nix-shell -p rustc cargo rustfmt rust-analyzer clippy
|
||||
;;
|
||||
go)
|
||||
nix-shell -p go gopls gotools
|
||||
;;
|
||||
python)
|
||||
nix-shell -p python3 python3Packages.pip python3Packages.virtualenv
|
||||
;;
|
||||
node)
|
||||
nix-shell -p nodejs pnpm
|
||||
;;
|
||||
c|cpp)
|
||||
nix-shell -p gcc cmake gnumake gdb
|
||||
;;
|
||||
julia)
|
||||
nix-shell -p julia-bin
|
||||
;;
|
||||
*)
|
||||
echo "Usage: dev-env <language>"
|
||||
echo "Supported languages: rust, go, python, node, c, cpp, julia"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
'')
|
||||
|
||||
(writeShellScriptBin "dev-project" ''
|
||||
#!/usr/bin/env bash
|
||||
# Initialize a new development project
|
||||
|
||||
PROJECT_NAME="$1"
|
||||
PROJECT_TYPE="$2"
|
||||
|
||||
if [ -z "$PROJECT_NAME" ] || [ -z "$PROJECT_TYPE" ]; then
|
||||
echo "Usage: dev-project <name> <type>"
|
||||
echo "Types: rust, go, python, node, nix"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$PROJECT_NAME"
|
||||
cd "$PROJECT_NAME"
|
||||
|
||||
case "$PROJECT_TYPE" in
|
||||
rust)
|
||||
cargo init
|
||||
echo "use flake" > .envrc
|
||||
cat > flake.nix << 'EOF'
|
||||
{
|
||||
description = "Rust development environment";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
outputs = { self, nixpkgs }:
|
||||
let pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
in {
|
||||
devShells.x86_64-linux.default = pkgs.mkShell {
|
||||
packages = with pkgs; [ rustc cargo rustfmt rust-analyzer clippy ];
|
||||
};
|
||||
};
|
||||
}
|
||||
EOF
|
||||
;;
|
||||
|
||||
go)
|
||||
go mod init "$PROJECT_NAME"
|
||||
echo "use flake" > .envrc
|
||||
cat > flake.nix << 'EOF'
|
||||
{
|
||||
description = "Go development environment";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
outputs = { self, nixpkgs }:
|
||||
let pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
in {
|
||||
devShells.x86_64-linux.default = pkgs.mkShell {
|
||||
packages = with pkgs; [ go gopls gotools ];
|
||||
};
|
||||
};
|
||||
}
|
||||
EOF
|
||||
;;
|
||||
|
||||
python)
|
||||
echo "use flake" > .envrc
|
||||
cat > flake.nix << 'EOF'
|
||||
{
|
||||
description = "Python development environment";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
outputs = { self, nixpkgs }:
|
||||
let pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
in {
|
||||
devShells.x86_64-linux.default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
python3 python3Packages.pip python3Packages.virtualenv
|
||||
];
|
||||
shellHook = "python -m venv .venv && source .venv/bin/activate";
|
||||
};
|
||||
};
|
||||
}
|
||||
EOF
|
||||
;;
|
||||
|
||||
node)
|
||||
npm init -y
|
||||
echo "use flake" > .envrc
|
||||
cat > flake.nix << 'EOF'
|
||||
{
|
||||
description = "Node.js development environment";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
outputs = { self, nixpkgs }:
|
||||
let pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
in {
|
||||
devShells.x86_64-linux.default = pkgs.mkShell {
|
||||
packages = with pkgs; [ nodejs pnpm ];
|
||||
};
|
||||
};
|
||||
}
|
||||
EOF
|
||||
;;
|
||||
|
||||
nix)
|
||||
echo "use flake" > .envrc
|
||||
cat > flake.nix << 'EOF'
|
||||
{
|
||||
description = "Nix development environment";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
outputs = { self, nixpkgs }:
|
||||
let pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
in {
|
||||
packages.x86_64-linux.default = pkgs.hello;
|
||||
devShells.x86_64-linux.default = pkgs.mkShell {
|
||||
packages = with pkgs; [ nixfmt nil ];
|
||||
};
|
||||
};
|
||||
}
|
||||
EOF
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown project type: $PROJECT_TYPE"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
git init
|
||||
direnv allow
|
||||
|
||||
echo "Project '$PROJECT_NAME' created with $PROJECT_TYPE template"
|
||||
echo "Run 'direnv allow' to activate the development environment"
|
||||
'')
|
||||
];
|
||||
|
||||
# Development services
|
||||
services = {
|
||||
# PostgreSQL
|
||||
postgresql = {
|
||||
enable = false; # Set to true to enable
|
||||
package = pkgs.postgresql_15;
|
||||
dataDir = "/var/lib/postgresql/15";
|
||||
authentication = ''
|
||||
local all all trust
|
||||
host all all 127.0.0.1/32 trust
|
||||
host all all ::1/128 trust
|
||||
'';
|
||||
};
|
||||
|
||||
# Redis
|
||||
redis.servers."" = {
|
||||
enable = false; # Set to true to enable
|
||||
port = 6379;
|
||||
bind = "127.0.0.1";
|
||||
};
|
||||
|
||||
# MySQL/MariaDB
|
||||
mysql = {
|
||||
enable = false; # Set to true to enable
|
||||
package = pkgs.mariadb;
|
||||
settings = {
|
||||
mysqld = {
|
||||
bind-address = "127.0.0.1";
|
||||
port = 3306;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# VSCode settings
|
||||
environment.variables = {
|
||||
# Enable VSCode to use Wayland
|
||||
NIXOS_OZONE_WL = "1";
|
||||
};
|
||||
|
||||
# Development shell environments
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
|
||||
# Git configuration
|
||||
programs.git = {
|
||||
enable = true;
|
||||
lfs.enable = true;
|
||||
config = {
|
||||
init.defaultBranch = "main";
|
||||
core = {
|
||||
editor = "nvim";
|
||||
autocrlf = "input";
|
||||
};
|
||||
pull.rebase = false;
|
||||
push.autoSetupRemote = true;
|
||||
};
|
||||
};
|
||||
|
||||
# Enable lorri for automatic nix-shell
|
||||
services.lorri.enable = true;
|
||||
|
||||
# nix-ld: lets unpatched binaries (Julia native deps like Makie/CUDA/MKL,
|
||||
# vendor SDKs, etc.) dlopen shared libraries at runtime. Libraries listed
|
||||
# here become available via $NIX_LD_LIBRARY_PATH.
|
||||
programs.nix-ld = {
|
||||
enable = true;
|
||||
libraries = with pkgs; [
|
||||
libGL
|
||||
libglvnd
|
||||
libx11
|
||||
];
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
202
modules/packages.nix
Normal file
202
modules/packages.nix
Normal file
|
|
@ -0,0 +1,202 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (lib)
|
||||
mkEnableOption
|
||||
mkOption
|
||||
mkIf
|
||||
types
|
||||
optionals
|
||||
;
|
||||
cfg = config.omni;
|
||||
omni = config.omni.lib;
|
||||
in
|
||||
{
|
||||
options.omni.packages = {
|
||||
enable = mkEnableOption "Omnixient packages";
|
||||
|
||||
exclude = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [
|
||||
"discord"
|
||||
"spotify"
|
||||
"steam"
|
||||
];
|
||||
description = "List of package names to exclude from installation";
|
||||
};
|
||||
|
||||
categories = {
|
||||
base = mkEnableOption "Base system packages" // {
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (cfg.enable or true) {
|
||||
# Wire package categories to feature flags via mkDefault (overridable)
|
||||
omni.packages.categories = {
|
||||
};
|
||||
|
||||
environment.systemPackages =
|
||||
with pkgs;
|
||||
omni.filterPackages (
|
||||
# Base system packages (always installed)
|
||||
[
|
||||
# Core utilities
|
||||
coreutils
|
||||
util-linux
|
||||
binutils
|
||||
pciutils
|
||||
usbutils
|
||||
lshw
|
||||
|
||||
# File management
|
||||
file
|
||||
tree
|
||||
ncdu
|
||||
duf
|
||||
dust
|
||||
|
||||
# Networking
|
||||
iproute2
|
||||
iputils
|
||||
dnsutils
|
||||
nettools
|
||||
nmap
|
||||
wget
|
||||
curl
|
||||
aria2
|
||||
|
||||
# Archives
|
||||
zip
|
||||
unzip
|
||||
p7zip
|
||||
rar
|
||||
unrar
|
||||
xz
|
||||
|
||||
# System monitoring
|
||||
btop
|
||||
htop
|
||||
iotop
|
||||
iftop
|
||||
nethogs
|
||||
lsof
|
||||
sysstat
|
||||
|
||||
# Text processing
|
||||
vim
|
||||
gnused
|
||||
gawk
|
||||
jq
|
||||
yq-go
|
||||
ripgrep
|
||||
fd
|
||||
bat
|
||||
eza
|
||||
fzf
|
||||
zoxide
|
||||
|
||||
# Version control
|
||||
git
|
||||
git-lfs
|
||||
lazygit
|
||||
gh
|
||||
|
||||
# Terminal multiplexers
|
||||
tmux
|
||||
screen
|
||||
|
||||
# System tools
|
||||
rsync
|
||||
rclone
|
||||
age
|
||||
sops
|
||||
gnupg
|
||||
pass
|
||||
pwgen
|
||||
|
||||
# Shell and prompts
|
||||
bash
|
||||
zsh
|
||||
fish
|
||||
starship
|
||||
oh-my-posh
|
||||
|
||||
# Package management helpers
|
||||
nix-index
|
||||
nix-tree
|
||||
nix-diff
|
||||
nixfmt
|
||||
nil
|
||||
statix
|
||||
deadnix
|
||||
cachix
|
||||
lorri
|
||||
direnv
|
||||
]
|
||||
); # End of filterPackages
|
||||
|
||||
# Font packages
|
||||
fonts.packages = with pkgs; [
|
||||
# Nerd fonts (for icons in terminal)
|
||||
nerd-fonts.jetbrains-mono
|
||||
nerd-fonts.fira-code
|
||||
nerd-fonts.hack
|
||||
nerd-fonts.iosevka
|
||||
nerd-fonts.meslo-lg
|
||||
nerd-fonts.sauce-code-pro
|
||||
nerd-fonts.ubuntu-mono
|
||||
nerd-fonts.droid-sans-mono
|
||||
nerd-fonts.roboto-mono
|
||||
nerd-fonts.inconsolata
|
||||
|
||||
# System fonts
|
||||
noto-fonts
|
||||
noto-fonts-cjk-sans
|
||||
noto-fonts-color-emoji
|
||||
liberation_ttf
|
||||
ubuntu-classic
|
||||
roboto
|
||||
open-sans
|
||||
lato
|
||||
|
||||
# Programming fonts
|
||||
jetbrains-mono
|
||||
fira-code
|
||||
hasklig
|
||||
victor-mono
|
||||
|
||||
# Icon fonts
|
||||
font-awesome
|
||||
material-icons
|
||||
material-design-icons
|
||||
];
|
||||
|
||||
# Enable font configuration
|
||||
fonts.fontconfig = {
|
||||
enable = true;
|
||||
defaultFonts = {
|
||||
serif = [
|
||||
"Noto Serif"
|
||||
"Liberation Serif"
|
||||
];
|
||||
sansSerif = [
|
||||
"Noto Sans"
|
||||
"Liberation Sans"
|
||||
];
|
||||
monospace = [
|
||||
"JetBrainsMono Nerd Font"
|
||||
"Noto Sans Mono"
|
||||
];
|
||||
emoji = [ "Noto Color Emoji" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue