{ description = "Development environment for impro and impro-sample-plugin"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; }; outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; config.allowUnfree = true;}; nodeVersion = pkgs.nodejs_24.version; # Runtime shared libraries for the prebuilt `canvas` npm package # (used by tests/unit/specs/components/image-cropper.test.js). canvasRuntimeLibs = with pkgs; [ cairo pango libjpeg giflib librsvg pixman util-linux # provides libuuid.so.1 ]; in { devShells.default = pkgs.mkShell { name = "impro-dev"; packages = with pkgs; [ # Runtime + package manager nodejs_24 # Language servers (LSP) and formatters typescript-language-server typescript vscode-langservers-extracted prettier # End-to-end test driver + bundled browsers playwright-driver # VCS git claude-code # make sure we have latest version # Build toolchain for rebuilding `canvas` from source against # the libs below (nixpkgs' cairo isn't ABI-compatible with # canvas's prebuilt binary, so the download-a-binary path # from `npm install` doesn't work here): run # `npm rebuild canvas --build-from-source` once after installing. pkg-config python3 gnumake ] ++ canvasRuntimeLibs; buildInputs = canvasRuntimeLibs; shellHook = '' echo "" echo "impro dev shell (node ${nodeVersion})" echo " impro: cd impro && npm install && npm run start" echo " impro-sample-plugin: cd impro-sample-plugin && npm install && npm run watch" echo " unit tests: npm run test:unit (in impro/)" echo " e2e tests: npm run test:e2e (in impro/)" echo " debug: node --inspect-brk (attach via chrome://inspect or your editor)" echo "" # Point Playwright at the nix-installed browser bundle so it does not # try to re-download into ~/.cache/ms-playwright on every run. export PLAYWRIGHT_BROWSERS_PATH=${pkgs.playwright-driver.browsers} # The prebuilt `canvas` npm package dlopen()s these at runtime; # nix doesn't put them on the loader path by default. export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath canvasRuntimeLibs}''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH ''; }; } ); }