Open OmnipotentEntity opened 1 week ago
Flake for reproduction:
# Inspired by pkgs/applications/editors/uivonim/default.nix
# and pkgs/by-name/in/indiepass-desktop/package.nix
{ lib, buildNpmPackage, fetchFromGitHub, electron }:
buildNpmPackage rec {
pname = "ogatak";
version = "2.0.7";
src = fetchFromGitHub {
owner = "rooklift";
repo = "ogatak";
rev = "v${version}";
sha256 = "sha256-hBNfr620bI9snomEhTWsJEBXmqu4ihkA1bqzpq8fIHw=";
};
npmDepsHash = "sha256-bO8BbID9TyObs88ubY0yfjUi2zV3wvBTmOC3/90UDSM=";
# Useful for debugging, just run "nix-shell" and then "electron ."
nativeBuildInputs = [
electron
];
# Otherwise it will try to run a build phase (via npm build) that we don't have or need, with an error:
# Missing script: "build"
# This method is used in pkgs/by-name/in/indiepass-desktop/package.nix
dontNpmBuild = true;
# Needed, otherwise you will get an error:
# RequestError: getaddrinfo EAI_AGAIN github.com
env = {
ELECTRON_SKIP_BINARY_DOWNLOAD = 1;
};
postPatch = ''
mv src/{*,.*} .
rmdir src/
export RUST_BACKTRACE=1
'';
forceEmptyCache = true;
postInstall = ''
makeWrapper ${electron}/bin/electron $out/bin/${pname} \
--add-flags $out/lib/node_modules/${pname}/main.js
'';
}
The cause is a bare unwrap here.
https://github.com/NixOS/nixpkgs/blob/efdfa300eeb8b1bc21dad55a845a673821f903da/pkgs/build-support/node/fetch-npm-deps/src/main.rs#L53
Discovered in attempting to package ogatak, (lock)