1
0

devshells.nix 1.4 KB

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