From ac862dfc1fdf23b9c47f80889a5fc3be3252ee2e Mon Sep 17 00:00:00 2001 From: Maaz Khokhar Date: Sun, 12 Jul 2026 12:55:40 -0500 Subject: [PATCH] made development into an option added it to configuration --- hosts/pc/configuration.nix | 7 ++++++ modules/development/basic.nix | 37 ++++++++++++++++++++++++++++ modules/development/clang.nix | 23 ++++++++++++------ modules/development/claude.nix | 19 +++++++++++---- modules/development/default.nix | 31 ++++++------------------ modules/development/go.nix | 39 ++++++++++++++++++------------ modules/development/options.nix | 30 +++++++++++++++++++++++ modules/development/python.nix | 39 ++++++++++++++++++------------ modules/development/rust.nix | 29 ++++++++++++++-------- modules/development/typescript.nix | 33 ++++++++++++++++--------- 10 files changed, 200 insertions(+), 87 deletions(-) create mode 100644 modules/development/basic.nix create mode 100644 modules/development/options.nix diff --git a/hosts/pc/configuration.nix b/hosts/pc/configuration.nix index 7f5ecee..a8d4977 100755 --- a/hosts/pc/configuration.nix +++ b/hosts/pc/configuration.nix @@ -130,6 +130,13 @@ lima.enable = true; }; + + development = { + enable = true; + rust.enable = true; + typescript.enable = true; + go.enable = true; + }; }; programs.nix-ld.libraries = with pkgs; [ diff --git a/modules/development/basic.nix b/modules/development/basic.nix new file mode 100644 index 0000000..0daf55a --- /dev/null +++ b/modules/development/basic.nix @@ -0,0 +1,37 @@ +{ + inputs, + config, + lib, + pkgs, + ... +}: +let + cfg = config.workstation.development; +in +{ + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + gitFull + neovim + nixfmt + nixd + kubectl + jq + tmux + vscode + devenv + xh + nodejs + obsidian + ]; + + # Nix LSP + nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; + + fonts.packages = with pkgs; [ + nerd-fonts.fira-code + nerd-fonts.jetbrains-mono + ]; + + }; +} diff --git a/modules/development/clang.nix b/modules/development/clang.nix index eb9c9e4..586536b 100644 --- a/modules/development/clang.nix +++ b/modules/development/clang.nix @@ -1,9 +1,18 @@ -{ pkgs, ... }: - { - environment.systemPackages = with pkgs; [ - gcc - cmake - clang - ]; + lib, + config, + pkgs, + ... +}: +let + cfg = config.workstation.development.clang; +in +{ + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + gcc + cmake + clang + ]; + }; } diff --git a/modules/development/claude.nix b/modules/development/claude.nix index c1b1097..972d5f8 100644 --- a/modules/development/claude.nix +++ b/modules/development/claude.nix @@ -1,7 +1,16 @@ -{ pkgs, ... }: - { - environment.systemPackages = with pkgs; [ - claude-code - ]; + config, + lib, + pkgs, + ... +}: +let + cfg = config.workstation.development.claude; +in +{ + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + claude-code + ]; + }; } diff --git a/modules/development/default.nix b/modules/development/default.nix index 39af601..8b19614 100644 --- a/modules/development/default.nix +++ b/modules/development/default.nix @@ -1,30 +1,15 @@ -{ inputs, pkgs, ... }: +{ ... }: { imports = [ + ./basic.nix ./rust.nix + ./clang.nix + ./claude.nix + ./go.nix + ./options.nix + ./python.nix + ./typescript.nix ]; - environment.systemPackages = with pkgs; [ - git - neovim - nixfmt - nixd - kubectl - jq - tmux - vscode - devenv - xh - nodejs - obsidian - ]; - - # Nix LSP - nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; - - fonts.packages = with pkgs; [ - nerd-fonts.fira-code - nerd-fonts.jetbrains-mono - ]; } diff --git a/modules/development/go.nix b/modules/development/go.nix index 434d78a..765bb69 100644 --- a/modules/development/go.nix +++ b/modules/development/go.nix @@ -1,22 +1,31 @@ -{ pkgs, ... }: - { - environment.systemPackages = with pkgs; [ - go + config, + lib, + pkgs, + ... +}: +let + cfg = config.workstation.development.go; +in +{ + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + go - # Language server - gopls + # Language server + gopls - # Formatter with automatic import management - gotools + # Formatter with automatic import management + gotools - # Linting - golangci-lint + # Linting + golangci-lint - # Debugger - delve + # Debugger + delve - # Useful extras - air # Live reload for web apps - ]; + # Useful extras + air # Live reload for web apps + ]; + }; } diff --git a/modules/development/options.nix b/modules/development/options.nix new file mode 100644 index 0000000..0b06e66 --- /dev/null +++ b/modules/development/options.nix @@ -0,0 +1,30 @@ +{ lib, ... }: +{ + options.workstation.development = { + enable = lib.mkEnableOption "the basic development toolkit"; + + clang = { + enable = lib.mkEnableOption "the clang toolkit"; + }; + + claude = { + enable = lib.mkEnableOption "the AI harness"; + }; + + go = { + enable = lib.mkEnableOption "the go toolkit"; + }; + + python = { + enable = lib.mkEnableOption "the python toolkit"; + }; + + rust = { + enable = lib.mkEnableOption "the rust toolkit"; + }; + + typescript = { + enable = lib.mkEnableOption "the typescript toolkit"; + }; + }; +} diff --git a/modules/development/python.nix b/modules/development/python.nix index e72d19f..9c3ecf7 100644 --- a/modules/development/python.nix +++ b/modules/development/python.nix @@ -1,20 +1,29 @@ -{ pkgs, ... }: - { - environment.systemPackages = with pkgs; [ - python313 + config, + lib, + pkgs, + ... +}: +let + cfg = config.workstation.development.python; +in +{ + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + python313 - # package tooling - python313Packages.uv - python313Packages.virtualenv + # package tooling + python313Packages.uv + python313Packages.virtualenv - # dev tools - ruff - black - mypy + # dev tools + ruff + black + mypy - # optional data science base tools - python313Packages.numpy - python313Packages.pandas - ]; + # optional data science base tools + python313Packages.numpy + python313Packages.pandas + ]; + }; } diff --git a/modules/development/rust.nix b/modules/development/rust.nix index b493370..61ff6a8 100644 --- a/modules/development/rust.nix +++ b/modules/development/rust.nix @@ -1,14 +1,23 @@ -{ pkgs, ... }: - { - environment.systemPackages = with pkgs; [ - cargo - rustc - rustfmt - clippy - ]; + config, + lib, + pkgs, + ... +}: +let + cfg = config.workstation.development.rust; +in +{ + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + cargo + rustc + rustfmt + clippy + ]; - environment.variables = { - RUST_BACKTRACE = "1"; + environment.variables = { + RUST_BACKTRACE = "1"; + }; }; } diff --git a/modules/development/typescript.nix b/modules/development/typescript.nix index b6f79a4..0ed38d3 100644 --- a/modules/development/typescript.nix +++ b/modules/development/typescript.nix @@ -1,17 +1,26 @@ -{ pkgs, ... }: - { - environment.systemPackages = with pkgs; [ - bun + config, + lib, + pkgs, + ... +}: +let + cfg = config.workstation.development.typescript; +in +{ + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + bun + prettier + eslint + typescript-language-server - # TS tooling (optional but common) - typescript - nodePackages.typescript-language-server - nodePackages.eslint - nodePackages.prettier - ]; + # TS tooling (optional but common) + typescript + ]; - environment.variables = { - NODE_OPTIONS = "--max-old-space-size=4096"; + environment.variables = { + NODE_OPTIONS = "--max-old-space-size=4096"; + }; }; }