>This project is a heavy WIP and not ready to be used. The name is also very WIP, please give me recommendations. # ezshell Standalone semi-implementation of devenv's `languages` feature. ## Install (flake) ```nix inputs.ezshell.url = "git+https://tangled.org/poacher.dev/ezshell"; inputs.ezshell.inputs.nixpkgs.follows = "nixpkgs"; ``` ## Basic usage `ezshell.lib.withLangs` determines `system`/`pkgs` itself from whatever systems appear in `languages`: ```nix { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; ezshell.url = "git+https://tangled.org/poacher.dev/ezshell"; }; outputs = {nixpkgs, ezshell, ...}: let system = "x86_64-linux"; in ezshell.lib.withLangs { languages.${system} = { rust.enable = true; python = { enable = true; version = "3.11"; # -> python311 }; }; }; } ``` ``` $ nix develop $ python --version $ cargo --version ``` ## Composing with an existing devShell `withLangs` takes any flake-outputs-shaped attrset and merges into it. Your existing devShells are preserved via. ```nix ezshell.lib.withLangs { devShells.${system}.default = pkgs.mkShellNoCC { packages = [pkgs.postgresql]; }; languages.${system}.python.enable = true; } ``` ## Git hooks (optional) `withLangs` always generates a `nixhooks.hooks.${system}` attrset as part of its output in the shape expected by [nixhooks](https://tangled.org/poacher.dev/nixhooks), so you can compose it with ezshell: ```nix { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; ezshell.url = "git+https://tangled.org/poacher.dev/ezshell"; nixhooks.url = "git+https://tangled.org/poacher.dev/nixhooks"; }; outputs = {nixpkgs, ezshell, nixhooks, ...}: let system = "x86_64-linux"; in nixhooks.lib.withHooks (ezshell.lib.withLangs { languages.${system}.rust.enable = true; }); } ``` ``` $ nix develop # git hooks install automatically $ nix run .#run-hooks # manually install hooks ``` ## Reaching into resolved options Both `withLangs` and `mkLangs` always include every language's fully resolved options in their result under `languages`. In a flake, you may reach it through `self`: ```nix { outputs = {self, nixpkgs, ezshell, ...}: ezshell.lib.withLangs { languages.${system}.nix.enable = true; checks.${system}.fmt-check = pkgs.runCommand "fmt-check" {} '' ${pkgs.lib.getExe self.languages.${system}.nix.formatter.package} --check ${./.} touch $out ''; }; } ``` ## Manual, single-system use `ezshell.lib.${system}.mkLangs` is also available directly, for lower-level per-system control: ```nix let result = ezshell.lib.${system}.mkLangs { languages.python.enable = true; }; in result.languages.python.package ``` ## Non-flake usage Vendor your own `nixpkgs` and `adios`, then use `mkLangs`: Non-flake usage only gets `mkLangs`, so you need to build the devShell yourself: ```nix let pkgs = import {}; adios = import (import ./npins).lladios; ezshell = import (fetchTarball "https://tangled.org/poacher.dev/ezshell/archive/main.tar.gz") { inherit pkgs adios; }; result = ezshell.mkLangs { languages.python.enable = true; }; in pkgs.mkShellNoCC {packages = result.packages;} ```