Trying to Package Filen-Desktop for NixOS, running into Permission Issue on Build

Hello all, this is my first post here and the second application Ive package NixOS. Running to this error when I try to package the Filen-Desktop Application.

@nix { "action": "setPhase", "phase": "unpackPhase" }
Running phase: unpackPhase
unpacking source archive /nix/store/ypa5ayxm2xw8kamy877cwchfy0vafw8k-source
source root is source
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: patchPhase
Executing npmConfigHook
Configuring npm
Validating consistency between /build/source/package-lock.json and /nix/store/v1wzi33p9k2iabm88nk1and17dz3rnaf-filen-desktop-2.0.24-npm-deps/package-lock.json
Fixing lockfile
Error: Permission denied (os error 13)

I’m not exactly sure how to give it the proper permissions.
This is my build file:

{lib, buildNpmPackage, fetchFromGitHub}:

buildNpmPackage rec {
	pname = "filen-desktop";
	version = "2.0.24";

	src = fetchFromGitHub {
		owner = "FilenCloudDienste";
		repo = "filen-desktop";
		rev = "v${version}";
		sha256 = "sha256-3OHL0cJoXPCYTyads/oDreMTelfRcm5qOsQ87CxRQLg=";
	};

	postPatch = ''
      cp ${./package-lock.json} package-lock.json
    '';

	npmDepsHash = "sha256-hDDvnLaCQRFtYA+7wUsO7M7gSc847aI6lW2xlrKlVqc=";

	meta = with lib; {
		description = "Filen Desktop Client for Linux";
		homepage = "https://filen.io";
		license = lib.licenses.agpl3Only;
		maintainers = [lib.maintainers.vtp];
	};
}

Since i’m new to this, im sure im just doing something stupid I can’t see, but some help would be greatly appreciated.

1 Like

I figured it out, just needed to add chmod +w package-lock.json in postPatch. I knew it was dumb mistake.

1 Like