Repository: railwayapp/nixpacks
Pull request #613 (2022-10-12 20:14:07)

Revert "Install additional packages when node-gyp or node-pre-gyp packages are present (#605)"
This reverts commit 7a0aea96b2d2a2934156241f490c83d12553cdf6.

<!-- Thanks for sending a pull request! -->
<!-- Please add a useful description explaining what this PR does -->

This PR reverts the canvas PR

<!-- PR Checklist  -->
<!-- - [ ] Tests are added/updated if needed  -->
<!-- - [ ] Docs are updated if needed  -->



Patch:
diff --git a/.cargo/config b/.cargo/config
deleted file mode 100644
index 0d4bc40..0000000
--- a/.cargo/config
+++ /dev/null
@@ -1,2 +0,0 @@
-[alias]
-generate_plan_test = "test --package nixpacks --lib --test generate_plan_tests"
\ No newline at end of file
diff --git a/examples/node-canvas/index.js b/examples/node-canvas/index.js
index 4e96657..e8e31fe 100644
--- a/examples/node-canvas/index.js
+++ b/examples/node-canvas/index.js
@@ -1,11 +1,2 @@
-const canvas = require('canvas');
-
-const box = canvas.createCanvas(100, 100);
-
-const fs = require('fs')
-const out = fs.createWriteStream(__dirname + '/test.png')
-const stream = box.createPNGStream()
-stream.pipe(out)
-out.on('finish', () =>  console.log('The PNG file was created.'))
-
-console.log("Hello from Node canvas")
\ No newline at end of file
+require("canvas");
+console.log("Hello from Node canvas");
diff --git a/src/providers/node/mod.rs b/src/providers/node/mod.rs
index 7464209..3bd24f2 100644
--- a/src/providers/node/mod.rs
+++ b/src/providers/node/mod.rs
@@ -73,24 +73,8 @@ impl Provider for NodeProvider {
                 "libxshmfence1".to_string(),
                 "libglu1".to_string(),
             ]);
-        }
-
-        if NodeProvider::uses_node_dependency(app, "canvas") {
+        } else if NodeProvider::uses_node_dependency(app, "canvas") {
             setup.add_pkgs_libs(vec!["libuuid".to_string(), "libGL".to_string()]);
-            setup.add_apt_pkgs(vec![
-                "build-essential".into(),
-                "libcairo2-dev".into(),
-                "libpango1.0-dev".into(),
-                "libjpeg-dev".into(),
-                "libgif-dev".into(),
-                "librsvg2-dev".into(),
-            ]);
-        }
-
-        if NodeProvider::uses_node_dependency(app, "node-gyp")
-            || NodeProvider::uses_node_dependency(app, "node-pre-gyp")
-        {
-            setup.add_nix_pkgs(&[Pkg::new("python39"), Pkg::new("gccStdenv")]);
         }
 
         // Install


Test patch:
diff --git a/tests/snapshots/generate_plan_tests__node_canvas.snap b/tests/snapshots/generate_plan_tests__node_canvas.snap
index 981f5b3..ca61444 100644
--- a/tests/snapshots/generate_plan_tests__node_canvas.snap
+++ b/tests/snapshots/generate_plan_tests__node_canvas.snap
@@ -40,9 +40,7 @@ expression: plan
       "name": "setup",
       "nixPkgs": [
         "nodejs-16_x",
-        "npm-8_x",
-        "python39",
-        "gccStdenv"
+        "npm-8_x"
       ],
       "nixLibs": [
         "libuuid",
@@ -51,15 +49,7 @@ expression: plan
       "nixOverlays": [
         "https://github.com/railwayapp/nix-npm-overlay/archive/main.tar.gz"
       ],
-      "nixpkgsArchive": "[archive]",
-      "aptPkgs": [
-        "build-essential",
-        "libcairo2-dev",
-        "libpango1.0-dev",
-        "libjpeg-dev",
-        "libgif-dev",
-        "librsvg2-dev"
-      ]
+      "nixpkgsArchive": "[archive]"
     }
   },
   "start": {
diff --git a/tests/snapshots/generate_plan_tests__node_nx.snap b/tests/snapshots/generate_plan_tests__node_nx.snap
index 3b4c6b1..48768ed 100644
--- a/tests/snapshots/generate_plan_tests__node_nx.snap
+++ b/tests/snapshots/generate_plan_tests__node_nx.snap
@@ -45,9 +45,7 @@ expression: plan
       "name": "setup",
       "nixPkgs": [
         "nodejs-16_x",
-        "npm-8_x",
-        "python39",
-        "gccStdenv"
+        "npm-8_x"
       ],
       "nixLibs": [
         "libuuid",
@@ -56,15 +54,7 @@ expression: plan
       "nixOverlays": [
         "https://github.com/railwayapp/nix-npm-overlay/archive/main.tar.gz"
       ],
-      "nixpkgsArchive": "[archive]",
-      "aptPkgs": [
-        "build-essential",
-        "libcairo2-dev",
-        "libpango1.0-dev",
-        "libjpeg-dev",
-        "libgif-dev",
-        "librsvg2-dev"
-      ]
+      "nixpkgsArchive": "[archive]"
     }
   },
   "start": {
diff --git a/tests/snapshots/generate_plan_tests__node_yarn_berry.snap b/tests/snapshots/generate_plan_tests__node_yarn_berry.snap
index 99adcda..0838564 100644
--- a/tests/snapshots/generate_plan_tests__node_yarn_berry.snap
+++ b/tests/snapshots/generate_plan_tests__node_yarn_berry.snap
@@ -43,9 +43,7 @@ expression: plan
       "name": "setup",
       "nixPkgs": [
         "nodejs-16_x",
-        "yarn-1_x",
-        "python39",
-        "gccStdenv"
+        "yarn-1_x"
       ],
       "nixOverlays": [
         "https://github.com/railwayapp/nix-npm-overlay/archive/main.tar.gz"