Bug in inherit: does not generate .desktop files

There is a package mate.caja: https://github.com/NixOS/nixpkgs/blob/9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8/pkgs/desktops/mate/caja/default.nix#L49
It works fine.

There is a package mate.caja-with-extensions: https://github.com/NixOS/nixpkgs/blob/9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8/pkgs/desktops/mate/caja-with-extensions/default.nix#L12
He uses mate.caja and adds extensions to it. But there is a problem:

  1. I can run it globally (> caja in terminal) - this is OK
  2. Extensions work in it. - this OK
  3. But it does not create a .desktop file and other files that it should have - this BAD

Whyyy?

I have tried adding the following in mate.caja:

installPhase = ‘’
mkdir -p $out/bin
makeWrapper ./src/caja $out/bin/caja
–set CAJA_EXTENSION_DIRS ${lib.concatMapStringsSep “:” (x: “${x.outPath}/lib/caja/extensions-2.0”) extensions}
make install
‘’;

It builds without error. I get .desktop and associations, but caja still has no extensions.

nix-shell -p nix-info --run “nix-info -m”

  • system: "x86_64-linux"
  • host os: Linux 5.15.97, NixOS, 22.11 (Raccoon), 22.11.2999.a7cc81913bb
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.11.1
  • channels(q): "home-manager-22.11.tar.gz"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

The desktop file in mate.caja package contains an absolute path to the caja binary in the mate.caja package. You will need to replace the Exec

This is indeed a good decision.
I just went through all the files in /share/ and replaced all occurrences $caja on $caja-with-extensions

# mate.caja-with-extensions
installPhase = ''
    mkdir -p $out/bin
    makeWrapper $caja/bin/caja $out/bin/caja \
    --set CAJA_EXTENSION_DIRS ${lib.concatMapStringsSep ":" (x: "${x.outPath}/lib/caja/extensions-2.0") [extensions]}
 
    runHook postInstall
  '';
 
  postInstall = ''
     mkdir -p $out/share/applications
 
    for file in `find $caja/share/ -type f -name "*"`
    do
      pathToFile=$(echo $file | awk -F "/" 'OFS = "/" {$2=$3=$4=""; print substr($0, 5)}')
      pathToDir=$(echo $pathToFile | awk -F "/" 'OFS = "/" {$NF=""; print $0}')
 
      mkdir -p $out/$pathToDir
 
      cat $caja/$pathToFile > $out/$pathToFile
      sed -i "s|$caja|$out|gi" "$out/$pathToFile"
    done
  '';