about summary refs log tree commit diff
path: root/pkgs/tools/misc/sharedown
diff options
context:
space:
mode:
authoremilylange <git@emilylange.de>2024-02-15 01:41:11 +0100
committeremilylange <git@emilylange.de>2024-02-15 01:41:11 +0100
commitbc47f473bea509c5d55497763acd50a8de51c993 (patch)
tree47b5c176d4ef1bb2586d563a669df2a40655dcb0 /pkgs/tools/misc/sharedown
parentf36635be5f1890b7407b189d3515642fc42d9a68 (diff)
sharedown: unbreak build
This is essentially a partial revert of
c271196d42a99c038472994b0fd0bfd9028b4423 which was a successful attempt
at unbreaking this build back in November 2023.

That workaround, however, no longer, well.. works.

Instead I figured out what was wrong with the initial version and fixed
that.
Hopefully this fix lasts longer than the one before.

The important bit that was missing is that `export npm_config_nodedir`
line.

The code in question is copied from
https://nixos.org/manual/nixpkgs/unstable/#javascript-yarn2nix-pitfalls
https://github.com/NixOS/nixpkgs/blob/d176767c02cb2a048e766215078c3d231e666091/doc/languages-frameworks/javascript.section.md#pitfalls-javascript-yarn2nix-pitfalls)

I suggest following the link for even more links as to why some commands
from there are the way they are.
Diffstat (limited to 'pkgs/tools/misc/sharedown')
-rw-r--r--pkgs/tools/misc/sharedown/default.nix12
1 files changed, 10 insertions, 2 deletions
diff --git a/pkgs/tools/misc/sharedown/default.nix b/pkgs/tools/misc/sharedown/default.nix
index 5d1d31b35ac18..c3e87328c1fba 100644
--- a/pkgs/tools/misc/sharedown/default.nix
+++ b/pkgs/tools/misc/sharedown/default.nix
@@ -6,7 +6,7 @@
 , libsecret
 , python3
 , pkg-config
-, nodePackages
+, nodejs
 , electron
 , makeWrapper
 , makeDesktopItem
@@ -63,7 +63,6 @@ stdenvNoCC.mkDerivation rec {
             nativeBuildInputs = [
               python3
               pkg-config
-              nodePackages.node-gyp
             ];
             buildInputs = [
               libsecret
@@ -76,6 +75,15 @@ stdenvNoCC.mkDerivation rec {
           };
         };
 
+        # needed for node-gyp, copied from https://nixos.org/manual/nixpkgs/unstable/#javascript-yarn2nix-pitfalls
+        # permalink: https://github.com/NixOS/nixpkgs/blob/d176767c02cb2a048e766215078c3d231e666091/doc/languages-frameworks/javascript.section.md#pitfalls-javascript-yarn2nix-pitfalls
+        preBuild = ''
+          mkdir -p $HOME/.node-gyp/${nodejs.version}
+          echo 9 > $HOME/.node-gyp/${nodejs.version}/installVersion
+          ln -sfv ${nodejs}/include $HOME/.node-gyp/${nodejs.version}
+          export npm_config_nodedir=${nodejs}
+        '';
+
         packageJSON = "${src}/package.json";
         yarnLock = ./yarn.lock;