devenv.nix 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. packages = with pkgs; [
  24. git
  25. nodejs_22
  26. nodePackages_latest.typescript-language-server
  27. nodePackages_latest.vue-language-server
  28. cargo-edit
  29. ] ++ lib.optionals pkgs.stdenv.isDarwin darwinPackages
  30. ++ lib.optionals pkgs.stdenv.isLinux linuxPackages;
  31. env = {
  32. APP_GREET = "Hi!";
  33. } // lib.optionalAttrs pkgs.stdenv.isLinux {
  34. LD_LIBRARY_PATH = lib.makeLibraryPath [
  35. pkgs.libappindicator
  36. pkgs.libayatana-appindicator
  37. ];
  38. } // lib.optionalAttrs pkgs.stdenv.isDarwin {
  39. # Place to put macOS-specific environment variables
  40. };
  41. scripts = {
  42. hello.exec = "echo hello from $APP_GREET";
  43. e.exec = "emacs";
  44. };
  45. enterShell = ''
  46. git --version
  47. ${lib.optionalString pkgs.stdenv.isDarwin ''
  48. # Place to put macOS-specific shell initialization
  49. ''}
  50. ${lib.optionalString pkgs.stdenv.isLinux ''
  51. # Place to put Linux-specific shell initialization
  52. ''}
  53. '';
  54. enterTest = ''
  55. echo "Running tests"
  56. '';
  57. dotenv.enable = true;
  58. languages = {
  59. typescript.enable = true;
  60. javascript = {
  61. enable = true;
  62. pnpm.enable = true;
  63. npm.enable = true;
  64. };
  65. rust = {
  66. enable = true;
  67. channel = "nightly";
  68. components = [
  69. "rustc"
  70. "cargo"
  71. "clippy"
  72. "rustfmt"
  73. "rust-analyzer"
  74. "llvm-tools-preview"
  75. "rust-src"
  76. "rustc-codegen-cranelift-preview"
  77. ];
  78. };
  79. };
  80. }