Files
nix-los/nixos/modules/development.nix
T

64 lines
1.7 KiB
Nix

{ config, lib, pkgs, pkgs-unstable, ... }:
{
options.custom.development = {
enable = lib.mkEnableOption "Development tools";
languages = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
description = "Programming languages to install (rust, python, nodejs, go, etc)";
};
};
config = let
cfg = config.custom.development;
languagePackages = {
rust = with pkgs; [ rustup cargo-deny cargo-edit ];
python = with pkgs; [ python3 python3Packages.pip python3Packages.virtualenv uv mypy ruff ];
nodejs = with pkgs; [ nodejs pnpm ];
go = with pkgs; [ go golangci-lint ];
ruby = with pkgs; [ ruby bundler ];
};
selectedPackages =
lib.concatMap (lang: languagePackages.${lang} or []) cfg.languages;
# C/C++ libraries needed for compiled Python packages (numpy, etc.)
pythonDevLibraries = with pkgs;
lib.optionals (lib.elem "python" cfg.languages) [
glibc
stdenv.cc.cc.lib
libxcrypt
];
in lib.mkIf cfg.enable {
# Core development tools
environment.systemPackages = with pkgs; [
git
git-lfs
gnumake
pkg-config
gcc
clang
cmake
ripgrep
jq
] ++ selectedPackages ++ pythonDevLibraries;
# Set library paths for venv compatibility with compiled packages
environment.variables = lib.mkIf (lib.elem "python" cfg.languages) {
LD_LIBRARY_PATH = lib.makeLibraryPath (with pkgs; [
glibc
stdenv.cc.cc.lib
libxcrypt
]);
};
# Enable container support (optional)
#virtualisation.docker.enable = true;
#virtualisation.docker.enableOnBoot = false;
};
}