Files
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

72 lines
1.5 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
nodejs,
python3,
removeReferencesTo,
pkg-config,
libsecret,
xcbuild,
fetchNpmDeps,
npmHooks,
electron,
}:
let
pinData = lib.importJSON ./pin.json;
in
stdenv.mkDerivation rec {
pname = "keytar-forked";
inherit (pinData) version;
src = fetchFromGitHub {
owner = "shiftkey";
repo = "node-keytar";
rev = "v${version}";
hash = pinData.srcHash;
};
nativeBuildInputs = [
nodejs
python3
pkg-config
npmHooks.npmConfigHook
]
++ lib.optional stdenv.hostPlatform.isDarwin xcbuild;
buildInputs = lib.optionals (!stdenv.hostPlatform.isDarwin) [ libsecret ];
npmDeps = fetchNpmDeps {
inherit src;
hash = pinData.npmHash;
};
doCheck = false;
postPatch = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
pkg-config() { "''${PKG_CONFIG}" "$@"; }
export -f pkg-config
'';
npmFlags = [
# Make sure the native modules are built against electron's ABI
"--nodedir=${electron.headers}"
# https://nodejs.org/api/os.html#osarch
"--arch=${stdenv.hostPlatform.node.arch}"
];
installPhase = ''
runHook preInstall
shopt -s extglob
rm -rf node_modules
mkdir -p $out
cp -r ./!(build) $out
install -D -t $out/build/Release build/Release/keytar.node
${removeReferencesTo}/bin/remove-references-to -t ${stdenv.cc.cc} $out/build/Release/keytar.node
runHook postInstall
'';
disallowedReferences = [ stdenv.cc.cc ];
}