From 285779868b28868ddc9d1017b8f30548bfbc92ce Mon Sep 17 00:00:00 2001 From: Tyler Mac Date: Wed, 19 Aug 2026 18:07:44 -0400 Subject: [PATCH] initial state --- README.md | 85 +++++++++++++ flake.nix | 57 +++++++++ home-manager/home.nix | 276 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 418 insertions(+) create mode 100644 README.md create mode 100644 flake.nix create mode 100644 home-manager/home.nix diff --git a/README.md b/README.md new file mode 100644 index 0000000..470954e --- /dev/null +++ b/README.md @@ -0,0 +1,85 @@ +# Home Manager Nix Configuration + +This repository contains a Nix flake configuration for setting up a development environment with: + +## Supported Platforms +- Windows via WSL +- Linux (non-NixOS) +- macOS with M1 chips + +## Installed Tools +- **tmux** - Terminal multiplexer (using jakehamilton/tmux package) +- **helix** - Modern editor with language server support +- **zsh** - Enhanced shell +- **starship** - Minimal, fast prompt +- **alacritty** - Fast terminal emulator +- **git** - Version control system +- **ssh** - Secure shell client +- **htop** - Interactive process viewer + +## Programming Languages & Language Servers +- **Odin** - With OLS (Odin Language Server) - *always included* +- **Harper** - With Harper Language Server - *always included* +- **Rust** - With rust-analyzer - *optional* +- **Python** - With Pyright - *optional* +- **JavaScript/TypeScript** - With TypeScript Language Server - *optional* +- **Go** - With gopls - *optional* +- **Java** - With JDT Language Server - *optional* + +## Docker Support +- **Docker Client** - For container management +- **Docker Compose** - For multi-container applications + +## Usage + +To use this configuration with Home Manager: + +1. Make sure you have Nix installed +2. Run `home-manager switch` to apply the configuration + +The configuration will set up: +- Default shell to zsh +- Editor to helix +- Prompt to use starship +- Terminal to use alacritty +- All language servers properly configured +- Docker support for containerized development + +## Customization + +To enable additional programming languages: + +1. Edit `home-manager/home.nix` +2. Change `enable = false;` to `enable = true;` for desired languages +3. Run `home-manager switch` to apply changes + +Example: +```nix +rust = { + enable = true; + package = pkgs.rustc; + languageServer = pkgs.rust-analyzer; + lspName = "rust-analyzer"; +}; +``` + +## Available Optional Languages +- Rust: For systems programming +- Python: For data science and scripting +- JavaScript/TypeScript: For web development +- Go: For backend services +- Java: For enterprise applications + +## Development Features + +### Docker Integration +Docker client and compose support are included for containerized development workflows. + +### Language Server Protocol +All supported languages include their respective language servers for enhanced IDE-like experience in Helix. + +### System Monitoring +htop is included for process monitoring and system resource tracking. + +### tmux Integration +Uses the tmux package from jakehamilton/tmux repository for enhanced tmux functionality. \ No newline at end of file diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7f1e0ed --- /dev/null +++ b/flake.nix @@ -0,0 +1,57 @@ +{ + description = "Home Manager configuration with tmux, helix, zsh, starship, alacritty, git, ssh for WSL, Linux, and Mac M1 with Docker and conditional language support"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager/release-23.11"; + }; + flake-utils.url = "github:numtide/flake-utils"; + tmux = { + url = "github:jakehamilton/tmux"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, home-manager, flake-utils, tmux }: + flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-darwin" "x86_64-windows" ] (system: let + pkgs = import nixpkgs { + inherit system; + config = { + allowUnfree = true; + }; + }; + in { + # Development shell with all our tools + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + tmux + helix + zsh + git + openssh + alacritty + starship + htop + docker-client + docker-compose + odin + ols + harper + gcc + gnumake + ]; + }; + + # Home Manager configuration + homeConfigurations."tylerbohrer" = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + modules = [ + (import ./home-manager/home.nix { + inherit pkgs; + tmuxPackage = tmux.packages.${system}.tmux; + }) + ]; + }; + }); +} \ No newline at end of file diff --git a/home-manager/home.nix b/home-manager/home.nix new file mode 100644 index 0000000..150cf10 --- /dev/null +++ b/home-manager/home.nix @@ -0,0 +1,276 @@ +{ pkgs, tmuxPackage ? null, ... }: + +let + # Define programming language support options with comprehensive configuration + supportedLanguages = { + # Default languages that are always included for basic functionality + odin = { + enable = true; + package = pkgs.odin; + languageServer = pkgs.ols; + lspName = "ols"; + description = "Odin programming language with OLS"; + }; + harper = { + enable = true; + package = pkgs.harper; + languageServer = pkgs.harper; + lspName = "harper"; + description = "Harper language with Harper Language Server"; + }; + + # Optional languages that can be conditionally enabled + rust = { + enable = false; + package = pkgs.rustc; + languageServer = pkgs.rust-analyzer; + lspName = "rust-analyzer"; + description = "Rust programming language with rust-analyzer"; + }; + python = { + enable = false; + package = pkgs.python3; + languageServer = pkgs.python3Packages.pyright; + lspName = "pyright"; + description = "Python programming language with Pyright"; + }; + javascript = { + enable = false; + package = pkgs.nodejs; + languageServer = pkgs.nodePackages.typescript-language-server; + lspName = "typescript-language-server"; + description = "JavaScript/TypeScript with TypeScript Language Server"; + }; + go = { + enable = false; + package = pkgs.go; + languageServer = pkgs.gopls; + lspName = "gopls"; + description = "Go programming language with gopls"; + }; + java = { + enable = false; + package = pkgs.openjdk; + languageServer = pkgs.jdt.ls; + lspName = "jdt.ls"; + description = "Java programming language with JDT Language Server"; + }; + }; + + # Helper function to get activated language packages + getActivatedLanguages = + builtins.filter (name: supportedLanguages.${name}.enable) (builtins.attrNames supportedLanguages); + + # Helper function to get all language packages for activation + getAllLanguagePackages = + (builtins.map (lang: supportedLanguages.${lang}.package) (getActivatedLanguages)) + ++ (builtins.map (lang: supportedLanguages.${lang}.languageServer) (getActivatedLanguages)); + + # Helper function to generate language server configuration sections + generateLanguageServerConfig = + (builtins.concatMap (lang: + if supportedLanguages.${lang}.enable then + [ + ''[[languages.${lang}]]'' + ''language-server = { name = "${supportedLanguages.${lang}.lspName}", command = "${supportedLanguages.${lang}.lspName}" }'' + ] + else + [] + ) (getActivatedLanguages)); + + # Get all activated language servers for PATH + getLanguageServerPaths = + (builtins.map (lang: "${supportedLanguages.${lang}.languageServer}/bin") (getActivatedLanguages)); + +in +{ + # Home Manager configuration for cross-platform use (WSL, Linux, Mac M1) + + # Enable Home Manager + programs.home-manager.enable = true; + + # Package configuration - these will work across all platforms + home.packages = with pkgs; [ + # Core tools + tmux + helix + zsh + git + openssh + + # Terminal applications + alacritty + starship + htop + + # Docker support + docker-client + docker-compose + + # Programming languages and language servers (default always included) + # These are the core tools that are always enabled + odin + ols # Odin Language Server + harper # Harper Language Server + + # Additional dev tools + gcc + gnumake + curl + wget + jq + ripgrep + findutils + ] ++ getAllLanguagePackages; + + # Zsh configuration + programs.zsh = { + enable = true; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + oh-my-zsh = { + enable = true; + theme = "agnoster"; + }; + # Zshrc configuration + shellAliases = { + "ls" = "eza"; + "g" = "git"; + "docker" = "docker"; + "h" = "htop"; + }; + }; + + # Tmux configuration - base settings + programs.tmux = { + enable = true; + clock24 = true; + historyLimit = 10000; + mouse = true; + keyBinding = "vi"; + # Basic tmux configuration file + shell = "zsh"; + # Use the tmux package from jakehamilton/tmux + package = tmuxPackage; + }; + + # Git configuration + programs.git = { + enable = true; + userName = "Your Name"; + userEmail = "your.email@example.com"; + extraConfig = { + core.editor = "hx"; + push.default = "current"; + }; + }; + + # SSH configuration + programs.ssh = { + enable = true; + }; + + # Alacritty configuration - simple but functional + programs.alacritty = { + enable = true; + settings = { + font = { + normal.family = "JetBrainsMono Nerd Font"; + size = 12.0; + }; + colors = { + primary = { + background = "0x1e1e2e"; + foreground = "0xf8f8f2"; + }; + cursor = { + text = "0x1e1e2e"; + cursor = "0xf8f8f2"; + }; + normal = { + black = "0x1e1e2e"; + red = "0xf84a50"; + green = "0x7ab872"; + yellow = "0xf59850"; + blue = "0x5192db"; + magenta = "0xb775d9"; + cyan = "0x54cecd"; + white = "0xf8f8f2"; + }; + bright = { + black = "0x1e1e2e"; + red = "0xf84a50"; + green = "0x7ab872"; + yellow = "0xf59850"; + blue = "0x5192db"; + magenta = "0xb775d9"; + cyan = "0x54cecd"; + white = "0xf8f8f2"; + }; + }; + }; + }; + + # Starship configuration - modern prompt + programs.starship = { + enable = true; + settings = { + add_newline = false; + command_timeout = 1000; + format = "$all"; + right_format = "$time"; + time = { + format = "%T"; + disabled = false; + }; + }; + }; + + # Helix - main editor with language server support + programs.helix = { + enable = true; + }; + + # Create Helix config with language servers for all activated languages + home.file.".config/helix/config.toml".text = '' + # Helix Configuration with Language Servers + + [editor] + theme = "onedark" + + [editor.lsp] + enable = true + auto-start = true + + # Default language servers (always active) + [[languages.odin]] + language-server = { name = "ols", command = "ols" } + + [[languages.harper]] + language-server = { name = "harper", command = "harper-ls" } + + # Dynamically added language servers based on user selection + ${builtins.concatStringsSep "\n" (generateLanguageServerConfig)} + ''; + + # Environment variables + home.sessionVariables = { + EDITOR = "hx"; + VISUAL = "hx"; + }; + + # Ensure proper PATH for language servers + home.sessionPath = [ + "${pkgs.odin}/bin" + "${pkgs.ols}/bin" + "${pkgs.harper}/bin" + "${pkgs.docker-client}/bin" + ] ++ getLanguageServerPaths; + + # Create directory structure for configs + home.activation = { + createDirs = '' + mkdir -p $HOME/.config/helix + ''; + }; +} \ No newline at end of file