{ description = "Kucinako — Wordbook of Arzhanai languages"; 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 = nixpkgs.legacyPackages.${system}; node-modules = pkgs.mkYarnPackage { name = "node-modules"; src = ./.; packageJSON = ./package.json; yarnLock = ./yarn.lock; }; frontend = pkgs.stdenv.mkDerivation { name = "frontend"; src = ./.; buildInputs = [ pkgs.yarn node-modules pkgs.nodejs pkgs.nodePackages.typescript ]; buildPhase = '' # Set HOME to a writable directory export HOME=$TMPDIR # Link the node_modules ln -sf ${node-modules}/libexec/kucinako/node_modules node_modules # Build the project ${pkgs.yarn}/bin/yarn build ''; installPhase = '' mkdir -p $out cp -r dist/* $out/ # Create a bin directory with a wrapper script mkdir -p $out/bin cat > $out/bin/frontend <