devshells.nix
1 { inputs, ... }: 2 3 { 4 perSystem = 5 { 6 config, 7 lib, 8 system, 9 ... 10 }: 11 { 12 devShells = 13 let 14 pkgs = import inputs.nixpkgs { inherit system; }; 15 stdenv = pkgs.stdenv; 16 scripts = config.packages.python-scripts; 17 in 18 lib.pipe (config.packages) [ 19 (lib.concatMapAttrs ( 20 name: package: { 21 ${name} = pkgs.mkShell { 22 name = "${name}"; 23 inputsFrom = [ package ]; 24 shellHook = '' 25 echo "Entering ${name} devShell" 26 ''; 27 }; 28 "${name}-extra" = 29 if (name == "python-scripts") then 30 null 31 else 32 pkgs.mkShell { 33 name = "${name}-extra"; 34 inputsFrom = [ 35 package 36 scripts 37 ]; 38 # Extra packages that *may* be used by some scripts 39 packages = [ 40 pkgs.python3Packages.tiktoken 41 ]; 42 shellHook = '' 43 echo "Entering ${name} devShell" 44 addToSearchPath "LD_LIBRARY_PATH" "${lib.getLib stdenv.cc.cc}/lib" 45 ''; 46 }; 47 } 48 )) 49 (lib.filterAttrs (name: value: value != null)) 50 ]; 51 }; 52 }