Cannot build package of rust application: ln: failed to create symbolic link: Permission denied

Hi, I’m trying to package HopToDesk for Nix which is written in Rust. However, when running nix-build -E 'with import <nixpkgs> {}; callPackage ./default.nix {}',
I always get this error which I don’t really understand:

ln: failed to create symbolic link '/nix/store/qs3mfgd9m6lm8wmh3zlfwa6kgz9sm796-cargo-vendor-dir/core-foundation-sys-0.8.6/g6jsg92jj9hyg3gjpad3wpchsh1sj3aj-core-foundation-sys-0.8.6': Permission denied
error: builder for '/nix/store/w8zf45pcf2qlbhir2a9jrnwwjp39lmd3-cargo-vendor-dir.drv' failed with exit code 1
error: 1 dependencies of derivation '/nix/store/fw3c7kicdd79q0wk3h3kmivibvjv13k7-hoptodesk-1.42.1.drv' failed to build

I don’t really understand, what has no permission here?
This is not my first Nix package (I already successfully submitted a package once) but my first one with Rust

This is my package:

  lib,
  fetchFromGitLab,
  rustPlatform,
  fetchurl
}:

rustPlatform.buildRustPackage rec {
  pname = "hoptodesk";
  version = "1.42.1";

  src = fetchFromGitLab {
    owner = "hoptodesk";
    repo = "hoptodesk";
    rev = "1.42.1";
    hash = "sha256-F+gA+Z4gZoNJYdy28uIjqiJcwcNsyUzl6BXsiIZO0gE=";
  };

  cargoLock = {
    lockFile = ./Cargo.lock;
    allowBuiltinFetchGit = true;
  };

  #postPatch = ''
  #  ln -s ${./Cargo.lock} Cargo.lock
  #'';

  cargoHash = lib.fakeHash;

  meta = with lib; {
    description = "Free Remote Desktop Software. Easily access remote devices securely with end-to-end encryption.";
    homepage = "https://www.hoptodesk.com/";
    license = licenses.agpl3Only;
    maintainers = with maintainers; [ NIS ];
  };

}

You ran into this bug basically

which would be fixed by the below, potentially

3 Likes

Ah thank’s for the reply!

So should I just wait until that gets merged or is there a workaround you can suggest in the meantime?

1 Like