Packaging problem

Hi,
I am trying to make package for Croatian mapproxy cache, currently I can install and run package, but cache is tying to write in install location and its unable to. Write location can be changed but I couldn’t find a way to point to location outside nix store. Is there a way to do it?

default.nix I made with help of nix-init and chatGPT:

{ lib
, stdenv
, fetchFromGitHub
, makeWrapper
}:

stdenv.mkDerivation rec {
  pname = "mapproxy-hr";
  version = "unstable-2023-06-12";

  src = fetchFromGitHub {
    owner = "osm-hr";
    repo = "mapproxy-hr";
    rev = "8800e4ad2da7f6473eb8cf96460698206aa67e0d";
    hash = "sha256-xl0/VMDaNBvASBgBfqS44MHi0kod8EdS27X5YdxDybg=";
  };

  nativeBuildInputs = [ makeWrapper ];

  installPhase = ''
    mkdir -p $out/bin
    cp -r * $out/bin/
    substituteInPlace $out/bin/runme.sh --replace "mapproxy.yaml" "$out/bin/mapproxy.yaml"
    '';

  postFixup = ''
    makeWrapper $out/bin/runme.sh $out/bin/mapproxy-hr
  '';

  meta = with lib; {
    description = "Caching mapproxy za Hrvatsku (za brži geoportal.dgu.hr WMS";
    homepage = "https://github.com/osm-hr/mapproxy-hr";
    license = licenses.unfree; # FIXME: nix-init did not found a license
    maintainers = with maintainers; [ ];
    mainProgram = "mapproxy-hr";
    platforms = platforms.all;
  };
}

Do you really need it “packaged” ?
The “executable” part of that repo is 4 lines of bash and your current .nix expression does not change binaries to absolute paths to store there either.
So it just copies files to store and then makes a wrapper that does not do much (just wraps runme.sh without changes).

If you still want to do that, you probably want to patch these lines to something else (with either proper patch or substituteInPlace inside postPatch):

Hi,
no I don’t need it packaged. I wanted to learn about nix and I read about packaging so I tried to make package of something I use. I picked that cache because it only needs copying. I see now that I don’t know enough to do something like this. Thanks for reply.