Skip to content

Rework how desktop files are patched #24

Open

Description

@Henry-Hiles
error: builder for '/nix/store/l18xarwymyj2c1hgj41qbdypvzdmdwk5-steam.drv' failed with exit code 1;
       last 4 log lines:
       > Wrapping /nix/store/n5flhj17ksb4sh8yk9lljlkv44vlg4cp-steam/bin/steam
       > Detected nested symlink, fixing
       > '/nix/store/n5flhj17ksb4sh8yk9lljlkv44vlg4cp-steam/share/applications/steam.desktop' -> '/build/tmp.9xArYj9Rdb/steam.desktop'
       > rm: cannot remove '/nix/store/n5flhj17ksb4sh8yk9lljlkv44vlg4cp-steam/share/applications': Is a directory
       For full logs, run 'nix log /nix/store/l18xarwymyj2c1hgj41qbdypvzdmdwk5-steam.drv'.
error: 1 dependencies of derivation '/nix/store/k84b38nxhdaflb14iinfmkwn1y8q467l-wrapper-manager.drv' failed to build
error: 1 dependencies of derivation '/nix/store/449gkrshcxb04cij19i97rmlbq4a4gdh-man-paths.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ssd4iqgc6cjrl1jfpp34cgcv2zqm2vyf-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/msdgbvr0rikj7dafl23hpvnbz1y1h70k-wrapper-manager_fish-completions.drv' failed to build
error: 1 dependencies of derivation '/nix/store/p45s5qqq8f10msfag1vh2nwh99f1n7zc-nixos-system-quadraticpc-25.05.20250226.5135c59.drv' failed to build

Activity

  1. viperML commented on Mar 3, 2025

    @viperML
    Owner

    This happens because WM tries to modify symlinks in-place. To make things simpler, I should probably create a new derivation, create the new destkop files there, and then merge the result with symlinkJoin.

  2. Henry-Hiles commented on Mar 3, 2025

    @Henry-Hiles
    Author

    Okay! If i can test anything, do let me know.

  3. changed the title [-]Can't wrap steam[/-] [+]Rework how desktop files are patched[/+] on Jul 10, 2025
  4. azuwis commented on Jul 14, 2025

    @azuwis

    I have the same problem when wrapping yazi:

    wrappers.yazi = {
      basePackage = pkgs.yazi;
    };
    

    Log:

    ::: Wrapping explicit .programs ...
    ::: Wrapping packages in out/bin ...
    :: (ya skipped: no wrapper configuration)
    :: (yazi skipped: no wrapper configuration)
    Detected nested symlink, fixing
    '/nix/store/y2i6xk4x2pi26kc8g49k1zq3wlf059bg-yazi-25.5.28/share/applications/yazi.desktop' -> '/build/tmp.62oEWZDGU4/yazi.desktop'
    rm: cannot remove '/nix/store/y2i6xk4x2pi26kc8g49k1zq3wlf059bg-yazi-25.5.28/share/applications': Is a directory
    
  5. viperML commented on Jul 14, 2025

    @viperML
    Owner

    Now that I look into it, using buildEnv instead of symlinkJoin could solve these issues, as it unrolls all the symlinks...

  6. viperML commented on Jul 14, 2025

    @viperML
    Owner

    At the point that I'm fighting against symlinkJoin/lndir/buildEnv, I might as well write my own symlinker (#27)

  7. StarryReverie commented on Nov 15, 2025

    @StarryReverie

    Recently I also encountered the same problem when trying to wrap yazi. I managed to work it around using the following code snippet:

    {
      wrappers.yazi.basePackage =
        pkgs.runCommand "yazi-without-desktop-item" { nativeBuildInputs = [ pkgs.yazi-unwrapped ]; }
          ''
            mkdir -p $out
            (cd ${pkgs.yazi-unwrapped} && tar -chf - --exclude="share/applications/yazi.desktop" .) \
                | (cd $out && tar -xf -)
          '';
    
      wrappers.yazi.postBuild = ''
        mkdir -p $out/share/applications
        sed -E -e "s#Exec=((/.*)*/)?yazi#Exec=$out/bin/yazi#" \
            ${pkgs.yazi}/share/applications/yazi.desktop \
            > $out/share/applications/yazi.desktop
      '';
    
      # ...
    }

    It simply creates a new derivation by copying anything but the original desktop item to avoid wrapper-manager from deleting the $out/share/applications directory. A patched desktop item is added at the postBuild phase, which will not trigger the above error.

  8. viperML commented on Nov 17, 2025

    @viperML
    Owner

    Recently I also encountered the same problem when trying to wrap yazi. I managed to work it around using the following code snippet:

    Nixpkgs already provides configuration through a wrapper for yazi, so wrapper-manager is unnecessary: https://github.com/NixOS/nixpkgs/blob/50a96edd8d0db6cc8db57dab6bb6d6ee1f3dc49a/pkgs/by-name/ya/yazi/package.nix#L39-L42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions