Can not move or copy file during derivation phase

Permission denied when mv or cp run on phases for derivation.
I’ve tried file creation in buildPhase and postUnpack, both failed.

The command I wanted to run in phase:

cp $src/docs/developer/platyPS/platyPS.schema.md $src

Error:

cp: cannot create regular file '/nix/store/jql4igq2yfxyc16l8rvf9yd0nf0rgqmq-source/platyPS.schema.md': Permission denied
full derivation
{ pkgs }:#buildDotnetModule, powershell, dotnetCorePackages, lib, fetchFromGitHub, stdenvNoCC, ... }:

let
  # pkgs = import <nixpkgs> {};
in 
  pkgs.buildDotnetModule rec {
    pname = "platy-ps";
    version = "0.14.2";

    src = pkgs.fetchFromGitHub {
      owner = "PowerShell";
      repo = "platyPS";
      rev = version;
      hash = "sha256-RTbXCsGFGgbgmzBHjxRROsY4d5AbHJ1Jq3fQNa+SZAM=";
    };

    nugetDeps = ./deps.nix;
    projectFile = "Markdown.MAML.sln";

    buildInputs = [pkgs.powershell pkgs.dotnetCorePackages.sdk_8_0_1xx];

    postUnpack = ''
      cp $src/docs/developer/platyPS/platyPS.schema.md $src
    '';
    preBuild = ''
      [[ -d $src/out ]] && rm -rf $src/out
    '';
    buildPhase = ''
      runHook preBuild
      pwsh -noprofile -f $src/build.ps1
      runHook postBuild
    '';
    installPhase = ''
      pwsh -noprofile -c "cpi -rec $src/out -dest (''$env:PSModulePath -split ':' | select -first 1)"
    '';

    meta = with pkgs.lib; {
      description = "Write PowerShell External Help in Markdown";
      homepage = "https://github.com/PowerShell/platyPS";
      license = with licenses; [
        mit
      ];
      maintainers = with maintainers; [ sharpchen ];
      platforms = [ "x86_64-linux" ];
    };
  }

Remove the $src/ prefix on front of every command, it’s already in the current dir

Thanks, this fixes on buildPhase.