Good morning.
I’m writing this post because I’m facing a strange error with buildNpmPackage
that doesn’t seem to be documented anywhere.
When trying to build the attached flake, in fact, NPM fails with the following error:
npm ERR! path /nix/store/lygyvacyjpmfsji3ym4n4d2wi4fxc0h5-antares-v0.7.9-npm-deps/_cacache/tmp
npm ERR! errno -13
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 1000:100 "/nix/store/lygyvacyjpmfsji3ym4n4d2wi4fxc0h5-antares-v0.7.9-npm-deps"
npm ERR! Log files were not written due to an error writing to the directory: /nix/store/lygyvacyjpmfsji3ym4n4d2wi4fxc0h5-antares-v0.7.9-npm-deps/_logs
npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
Personally, I find this pretty puzzling, as (citing the nixpkgs manual) "buildNpmPackage
allows you to package npm-based projects in Nixpkgs without the use of an auto-generated dependencies files […] by […] creating a reproducible cache that contains the dependencies of a project, and pointing npm to it", which makes links to the root-owned Nix Store expected.
Can someone point me to what I’ve done wrong in writing the derivation? Thank you very much in advance!
My flake.nix
:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = import nixpkgs { inherit system; };
antaressql = pkgs.buildNpmPackage {
pname = "antares";
version = "v0.7.9";
src = pkgs.fetchFromGitHub {
owner = "antares-sql";
repo = "antares";
rev = "v0.7.9";
sha256 = "sha256-QCXQFRW/lLMELQLclRmCZnXorWJrAQaXKHIGsKNLZuI=";
};
npmDepsHash = "sha256-0Jb2WnUDXv6SjtnUx3854YKz4XEcRNpDH3KYQb3o1pw=";
ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
};
in
{
defaultPackage = antaressql;
}
);
}