diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..5e1a81c --- /dev/null +++ b/default.nix @@ -0,0 +1,21 @@ +{ pkgs ? import {} }: + +pkgs.stdenv.mkDerivation { + name = "pnpm-project"; + src = ./.; + + buildInputs = [ + pkgs.nodejs + pkgs.nodePackages.pnpm + ]; + + buildPhase = '' + pnpm install + pnpm build + ''; + + installPhase = '' + mkdir -p $out + cp -r dist/* $out/ + ''; +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..f4304a8 --- /dev/null +++ b/flake.nix @@ -0,0 +1,24 @@ +{ + description = "Flake for building pnpm project"; + + 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}; + in { + defaultPackage = pkgs.callPackage ./default.nix {}; + + devShell = pkgs.mkShell { + buildInputs = [ + pkgs.nodejs + pkgs.nodePackages.pnpm + ]; + }; + } + ); +}