feat: add NixOS support, Go, and Ruby on Rails; remove Rust
- Add nixos/ directory with declarative flake.nix and home.nix for NixOS - Make all setup scripts NixOS-aware with proper detection and early exit - Update bashrc, zshrc, and aliases with Go, Ruby on Rails, and Nix profile paths - Replace Rust/Cargo references in shell configs with rbenv/Ruby on Rails - Update README with NixOS quick start and full documentation
This commit is contained in:
167
nixos/flake.nix
Normal file
167
nixos/flake.nix
Normal file
@@ -0,0 +1,167 @@
|
||||
{
|
||||
description = "Blake's NixOS configuration with dev tooling";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, home-manager, ... }@inputs:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
in {
|
||||
# ── System-level configuration ──────────────────────────
|
||||
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [
|
||||
({ pkgs, ... }: {
|
||||
# ---- Core system ----
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
networking.hostName = "nixos";
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
time.timeZone = "America/Chicago";
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
# ── Users ──────────────────────────────────────────
|
||||
users.users.blake = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "wheel" "networkmanager" "docker" "libvirtd" ];
|
||||
shell = pkgs.zsh;
|
||||
};
|
||||
|
||||
# ── System packages ────────────────────────────────
|
||||
environment.systemPackages = with pkgs; [
|
||||
# Shell & terminal
|
||||
zsh
|
||||
zsh-completions
|
||||
tmux
|
||||
oh-my-posh
|
||||
nushell
|
||||
eza
|
||||
bat
|
||||
fzf
|
||||
zoxide
|
||||
ripgrep
|
||||
fd
|
||||
jq
|
||||
tldr
|
||||
unzip
|
||||
wget
|
||||
curl
|
||||
|
||||
# Development - Go
|
||||
go
|
||||
gopls
|
||||
delve
|
||||
|
||||
# Development - Ruby on Rails
|
||||
ruby
|
||||
bundler
|
||||
nodejs
|
||||
yarn
|
||||
rbenv
|
||||
|
||||
# Development - Python
|
||||
python3
|
||||
python3Packages.pip
|
||||
python3Packages.virtualenv
|
||||
|
||||
# Cloud / DevOps
|
||||
kubectl
|
||||
k9s
|
||||
minikube
|
||||
terraform
|
||||
helm
|
||||
kubectx
|
||||
stern
|
||||
dive
|
||||
trivy
|
||||
ansible
|
||||
awscli2
|
||||
direnv
|
||||
|
||||
# Networking
|
||||
nmap
|
||||
mtr
|
||||
tcpdump
|
||||
socat
|
||||
whois
|
||||
iperf3
|
||||
traceroute
|
||||
bind
|
||||
|
||||
# System
|
||||
btop
|
||||
fastfetch
|
||||
virt-manager
|
||||
flatpak
|
||||
docker
|
||||
docker-compose
|
||||
|
||||
# HTTP
|
||||
httpie
|
||||
|
||||
# Git
|
||||
git
|
||||
gh
|
||||
|
||||
# Neovim
|
||||
neovim
|
||||
];
|
||||
|
||||
# ── Flatpak ────────────────────────────────────────
|
||||
services.flatpak.enable = true;
|
||||
|
||||
# ── Docker ─────────────────────────────────────────
|
||||
virtualisation.docker.enable = true;
|
||||
|
||||
# ── Virtualisation (virt-manager) ──────────────────
|
||||
virtualisation.libvirtd.enable = true;
|
||||
|
||||
# ── Fonts ──────────────────────────────────────────
|
||||
fonts.packages = with pkgs; [
|
||||
nerd-fonts.hack
|
||||
nerd-fonts.fira-code
|
||||
];
|
||||
|
||||
# ── Programs ───────────────────────────────────────
|
||||
programs.fish.enable = true; # some scripts may need /bin/fish
|
||||
programs.zsh.enable = true;
|
||||
programs.direnv.enable = true;
|
||||
|
||||
# ── Nix settings ───────────────────────────────────
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
|
||||
# ── Security ───────────────────────────────────────
|
||||
services.openssh.enable = true;
|
||||
|
||||
# ── Neovim default editor ──────────────────────────
|
||||
environment.variables.EDITOR = "nvim";
|
||||
|
||||
system.stateVersion = "24.11";
|
||||
})
|
||||
];
|
||||
};
|
||||
|
||||
# ── Home-manager user configuration ────────────────────
|
||||
homeConfigurations.blake = home-manager.lib.homeManagerConfiguration {
|
||||
inherit pkgs;
|
||||
modules = [
|
||||
./home.nix
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
267
nixos/home.nix
Normal file
267
nixos/home.nix
Normal file
@@ -0,0 +1,267 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# ── Home-manager: user-level packages & config ──────────
|
||||
|
||||
home.username = "blake";
|
||||
home.homeDirectory = "/home/blake";
|
||||
home.stateVersion = "24.11";
|
||||
|
||||
# ── User packages (installed via home-manager) ──────────
|
||||
home.packages = with pkgs; [
|
||||
# Development - Go tooling
|
||||
go
|
||||
gopls
|
||||
delve
|
||||
golangci-lint
|
||||
|
||||
# Development - Ruby on Rails
|
||||
ruby
|
||||
bundler
|
||||
nodejs
|
||||
yarn
|
||||
rbenv
|
||||
rubyPackages.rails
|
||||
|
||||
# Development - Python
|
||||
python3
|
||||
python3Packages.pip
|
||||
python3Packages.virtualenv
|
||||
python3Packages.pynvim
|
||||
|
||||
# Shell tools
|
||||
oh-my-posh
|
||||
eza
|
||||
bat
|
||||
fzf
|
||||
ripgrep
|
||||
fd
|
||||
jq
|
||||
zoxide
|
||||
tldr
|
||||
unzip
|
||||
wget
|
||||
curl
|
||||
|
||||
# Cloud / DevOps
|
||||
kubectl
|
||||
k9s
|
||||
terraform
|
||||
helm
|
||||
kubectx
|
||||
stern
|
||||
dive
|
||||
trivy
|
||||
ansible
|
||||
awscli2
|
||||
direnv
|
||||
|
||||
# Networking
|
||||
nmap
|
||||
mtr
|
||||
tcpdump
|
||||
socat
|
||||
whois
|
||||
iperf3
|
||||
traceroute
|
||||
|
||||
# System
|
||||
btop
|
||||
fastfetch
|
||||
httpie
|
||||
gh
|
||||
git
|
||||
tmux
|
||||
|
||||
# Neovim
|
||||
neovim
|
||||
];
|
||||
|
||||
# ── Git configuration ────────────────────────────────────
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = "Blake Ridgway";
|
||||
userEmail = "blake@blakeridgway.com";
|
||||
signing = {
|
||||
# signByDefault = true;
|
||||
# key = "...";
|
||||
};
|
||||
extraConfig = {
|
||||
init.defaultBranch = "main";
|
||||
core.editor = "nvim";
|
||||
pull.rebase = true;
|
||||
commit.template = "~/dotfiles/commit-conventions.txt";
|
||||
};
|
||||
includes = [
|
||||
{ path = "~/dotfiles/.gitconfig-advancedmetrics"; condition = "gitdir:~/dev/AdvancedMetrics/"; }
|
||||
];
|
||||
};
|
||||
|
||||
# ── Shell: Zsh ───────────────────────────────────────────
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
autosuggestion.enable = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
|
||||
shellAliases = {
|
||||
# Unix
|
||||
ll = "ls -la";
|
||||
ln = "ln -v";
|
||||
mkdir = "mkdir -p";
|
||||
e = "nvim";
|
||||
v = "nvim";
|
||||
|
||||
# System
|
||||
cpu = "btop";
|
||||
mem = "btop";
|
||||
|
||||
# Git
|
||||
ga = "git add";
|
||||
gaa = "git add .";
|
||||
gc = "git commit";
|
||||
gp = "git push -u origin \"$(git symbolic-ref --short HEAD)\"";
|
||||
gs = "git status";
|
||||
nah = "git reset --hard; git clean -df;";
|
||||
grr = "git remote remove origin";
|
||||
gra = "git remote add origin";
|
||||
|
||||
# Python
|
||||
initvenv = "python3 -m venv venv";
|
||||
startvenv = "source venv/bin/activate";
|
||||
stopvenv = "deactivate";
|
||||
pyinstall = "python3 -m pip install -r requirements.txt";
|
||||
py = "python3";
|
||||
py3 = "python3";
|
||||
python = "python3";
|
||||
pip = "pip3";
|
||||
|
||||
# Go
|
||||
gorun = "go run";
|
||||
gobuild = "go build";
|
||||
gotest = "go test ./...";
|
||||
gotidy = "go mod tidy";
|
||||
gofmt = "go fmt ./...";
|
||||
|
||||
# Ruby on Rails
|
||||
rails = "rails";
|
||||
rake = "rake";
|
||||
bundle = "bundle";
|
||||
be = "bundle exec";
|
||||
bi = "bundle install";
|
||||
bu = "bundle update";
|
||||
rdm = "rails db:migrate";
|
||||
rdr = "rails db:rollback";
|
||||
rds = "rails db:seed";
|
||||
rrg = "rails generate";
|
||||
rrc = "rails console";
|
||||
rrs = "rails server";
|
||||
rroutes = "rails routes";
|
||||
|
||||
# Kubernetes
|
||||
k = "kubectl";
|
||||
kg = "kubectl get";
|
||||
kgp = "kubectl get pods";
|
||||
kgs = "kubectl get svc";
|
||||
kgd = "kubectl get deployments";
|
||||
kgn = "kubectl get nodes";
|
||||
kd = "kubectl describe";
|
||||
kl = "kubectl logs";
|
||||
klf = "kubectl logs -f";
|
||||
kx = "kubectx";
|
||||
kn = "kubens";
|
||||
|
||||
# Terraform
|
||||
tf = "terraform";
|
||||
tfi = "terraform init";
|
||||
tfa = "terraform apply";
|
||||
tfp = "terraform plan";
|
||||
tfd = "terraform destroy";
|
||||
tff = "terraform fmt -recursive";
|
||||
tfv = "terraform validate";
|
||||
tfo = "terraform output";
|
||||
|
||||
# AWS
|
||||
awsl = "aws ec2 describe-instances --query \"Reservations[*].Instances[*].[InstanceId,State.Name,Tags[?Key=='Name'].Value|[0]]\" --output table";
|
||||
|
||||
# Docker
|
||||
d = "docker";
|
||||
dc = "docker compose";
|
||||
dcu = "docker compose up -d";
|
||||
dcd = "docker compose down";
|
||||
dps = "docker ps --format \"table {{.ID}}\\t{{.Names}}\\t{{.Status}}\\t{{.Ports}}\"";
|
||||
|
||||
# Networking
|
||||
ports = "ss -tlnp";
|
||||
myip = "curl -4 icanhazip.com";
|
||||
listening = "ss -tlnp";
|
||||
|
||||
# Config
|
||||
vimrc = "nvim ~/.config/nvim/init.lua";
|
||||
ealias = "nvim ~/dotfiles/aliases.zsh";
|
||||
zshrc = "nvim ~/.zshrc";
|
||||
bashrc = "nvim ~/.bashrc";
|
||||
path = "echo $PATH | tr -s ':' '\\n'";
|
||||
};
|
||||
|
||||
initExtra = ''
|
||||
# Nix profile paths
|
||||
if [ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
|
||||
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
||||
fi
|
||||
|
||||
# Go
|
||||
export GOPATH="$HOME/go"
|
||||
export PATH="$PATH:/usr/local/go/bin:$GOPATH/bin"
|
||||
|
||||
# Ruby on Rails (rbenv)
|
||||
export PATH="$PATH:$HOME/.rbenv/bin"
|
||||
eval "$(rbenv init - zsh 2>/dev/null || true)"
|
||||
|
||||
# Local binaries
|
||||
export PATH="$PATH:$HOME/.local/bin:$HOME/bin"
|
||||
|
||||
# Editor
|
||||
export EDITOR="nvim"
|
||||
|
||||
# SSH agent
|
||||
if [ -z "$SSH_AGENT_PID" ]; then
|
||||
eval "$(ssh-agent -s)" >/dev/null 2>&1
|
||||
ssh-add -A 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Key timeout
|
||||
export KEYTIMEOUT=1
|
||||
|
||||
# Oh My Posh prompt
|
||||
if command -v oh-my-posh &>/dev/null; then
|
||||
eval "$(oh-my-posh init zsh --config ~/.config/oh-my-posh/theme.omp.json)"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
# ── Neovim config (managed separately via dotfiles) ──────
|
||||
# The nvim config lives in ~/dotfiles/nvim/ and is symlinked
|
||||
# by the dotfiles setup script (04-config-symlinks.sh).
|
||||
|
||||
# ── Starship / Oh My Posh theme symlink ──────────────────
|
||||
home.file.".config/oh-my-posh/theme.omp.json".source =
|
||||
../terminal/posh-theme.omp.json;
|
||||
|
||||
# ── Nushell config symlink ───────────────────────────────
|
||||
home.file.".config/nushell".source = ../terminal/nushell;
|
||||
|
||||
# ── Dotfile symlinks ─────────────────────────────────────
|
||||
home.file.".bashrc".source = ../bashrc;
|
||||
home.file.".zshrc".source = ../zshrc;
|
||||
home.file.".aliases.bash".source = ../aliases.bash;
|
||||
home.file.".aliases.zsh".source = ../aliases.zsh;
|
||||
home.file.".gitconfig".source = ../gitconfig;
|
||||
home.file.".gitignore".source = ../gitignore;
|
||||
home.file.".agignore".source = ../agignore;
|
||||
home.file.".commit-conventions.txt".source = ../commit-conventions.txt;
|
||||
|
||||
# Let home-manager manage itself
|
||||
programs.home-manager.enable = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user