devenv.nix 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. { pkgs, lib, config, inputs, ... }:
  2. let
  3. rosettaPkgs =
  4. if pkgs.stdenv.isDarwin && pkgs.stdenv.isAarch64
  5. then pkgs.pkgsx86_64Darwin
  6. else pkgs;
  7. darwinPackages = with pkgs; [
  8. darwin.apple_sdk.frameworks.Security
  9. darwin.apple_sdk.frameworks.CoreServices
  10. darwin.apple_sdk.frameworks.CoreFoundation
  11. darwin.apple_sdk.frameworks.Foundation
  12. darwin.apple_sdk.frameworks.AppKit
  13. darwin.apple_sdk.frameworks.WebKit
  14. ];
  15. linuxPackages = with pkgs; [
  16. libsoup_3
  17. webkitgtk_4_1
  18. librsvg
  19. libappindicator
  20. libayatana-appindicator
  21. ];
  22. in {
  23. # https://devenv.sh/packages/
  24. packages = with pkgs; [
  25. git
  26. postgresql_16
  27. # FE and Node stuff
  28. nodejs_22
  29. nodePackages_latest.typescript-language-server
  30. nodePackages_latest.vls
  31. nodePackages_latest.prisma
  32. prisma-engines
  33. # Cargo
  34. cargo-edit
  35. ] ++ lib.optionals pkgs.stdenv.isDarwin darwinPackages
  36. ++ lib.optionals pkgs.stdenv.isLinux linuxPackages;
  37. # https://devenv.sh/basics/
  38. env = {
  39. APP_GREET = "Hoppscotch";
  40. } // lib.optionalAttrs pkgs.stdenv.isLinux {
  41. # NOTE: Setting these `PRISMA_*` environment variable fixes
  42. # Error: Failed to fetch sha256 checksum at https://binaries.prisma.sh/all_commits/<hash>/linux-nixos/libquery_engine.so.node.gz.sha256 - 404 Not Found
  43. # See: https://github.com/prisma/prisma/discussions/3120
  44. PRISMA_QUERY_ENGINE_LIBRARY = "${pkgs.prisma-engines}/lib/libquery_engine.node";
  45. PRISMA_QUERY_ENGINE_BINARY = "${pkgs.prisma-engines}/bin/query-engine";
  46. PRISMA_SCHEMA_ENGINE_BINARY = "${pkgs.prisma-engines}/bin/schema-engine";
  47. LD_LIBRARY_PATH = lib.makeLibraryPath [
  48. pkgs.libappindicator
  49. pkgs.libayatana-appindicator
  50. ];
  51. } // lib.optionalAttrs pkgs.stdenv.isDarwin {
  52. # Place to put macOS-specific environment variables
  53. };
  54. # https://devenv.sh/scripts/
  55. scripts = {
  56. hello.exec = "echo hello from $APP_GREET";
  57. e.exec = "emacs";
  58. };
  59. enterShell = ''
  60. git --version
  61. ${lib.optionalString pkgs.stdenv.isDarwin ''
  62. # Place to put macOS-specific shell initialization
  63. ''}
  64. ${lib.optionalString pkgs.stdenv.isLinux ''
  65. # Place to put Linux-specific shell initialization
  66. ''}
  67. '';
  68. # https://devenv.sh/tests/
  69. enterTest = ''
  70. echo "Running tests"
  71. '';
  72. # https://devenv.sh/integrations/dotenv/
  73. dotenv.enable = true;
  74. # https://devenv.sh/languages/
  75. languages = {
  76. typescript.enable = true;
  77. javascript = {
  78. enable = true;
  79. pnpm.enable = true;
  80. npm.enable = true;
  81. };
  82. rust = {
  83. enable = true;
  84. channel = "nightly";
  85. components = [
  86. "rustc"
  87. "cargo"
  88. "clippy"
  89. "rustfmt"
  90. "rust-analyzer"
  91. "llvm-tools-preview"
  92. "rust-src"
  93. "rustc-codegen-cranelift-preview"
  94. ];
  95. };
  96. };
  97. # https://devenv.sh/pre-commit-hooks/
  98. # pre-commit.hooks.shellcheck.enable = true;
  99. # https://devenv.sh/processes/
  100. # processes.ping.exec = "ping example.com";
  101. # See full reference at https://devenv.sh/reference/options/
  102. }