34 lines
899 B
Nix
34 lines
899 B
Nix
|
{ pkgs ? import <nixpkgs> { } }:
|
||
|
|
||
|
pkgs.buildNpmPackage {
|
||
|
pname = "my-node-app"; # Name of your package
|
||
|
version = "1.0.0"; # Your app version
|
||
|
|
||
|
# Source files (usually the current directory)
|
||
|
src = pkgs.lib.cleanSource ../frontend;
|
||
|
|
||
|
# Optionally, you can provide a package-lock.json or yarn.lock file
|
||
|
# This ensures dependencies are installed reproducibly.
|
||
|
packageLock = ./package-lock.json; # Use this for npm
|
||
|
|
||
|
# Node.js version (optional, defaults to pkgs.nodejs)
|
||
|
nodejs = pkgs.nodejs-18_x;
|
||
|
npmDepsHash = "sha256-n9SpPPRvu92RwNPDKZ3f1Splbux2IVGhSazJ4DM2IrA=";
|
||
|
|
||
|
|
||
|
# Add any additional arguments for the build process
|
||
|
buildInputs = [ ];
|
||
|
|
||
|
# Specify the build phase, if needed
|
||
|
buildPhase = ''
|
||
|
echo "Building the app..."
|
||
|
npm run build
|
||
|
'';
|
||
|
|
||
|
# Specify the install phase (what to copy to the output)
|
||
|
installPhase = ''
|
||
|
mkdir -p $out
|
||
|
cp -r dist/* $out/
|
||
|
'';
|
||
|
}
|