nix-darwin icon indicating copy to clipboard operation
nix-darwin copied to clipboard

Disable taking control of ~/Applications folder

Open berbiche opened this issue 4 years ago • 14 comments

Programs like Steam add applications to ~/Applications and such.

This PR disables linking ~/Applications to nix-darwin applications in the /nix/store and makes nix-darwin use a subfolder within ~/Applications.

See https://github.com/rycee/home-manager/issues/1341#issuecomment-687286866

berbiche avatar Sep 05 '20 22:09 berbiche

The feature is practical when using Alfred or any other launchers. My solution would require users to remove the ~/Applications folder manually if it points to the nix store.

berbiche avatar Sep 14 '20 00:09 berbiche

I don't have any particular input but if the Applications directory symlinks into a nix-darwin generation, wouldn't it be safe to delete it before the mkdir line?

rycee avatar Sep 15 '20 22:09 rycee

Is there any interest in this PR or should I close it?

berbiche avatar May 09 '21 04:05 berbiche

Should this PR be finally merged? I had this problem recently and spent a significant amount of time to get to this PR. Merging this PR should also unblock this: https://github.com/nix-community/home-manager/blob/master/modules/targets/darwin/linkapps.nix

AlexeyRaga avatar May 10 '21 11:05 AlexeyRaga

@berbiche Is this working with Spotlight? I was under the impression that you have to copy the apps into ~/Applications to get Spotlight to recognize them. Like

  system = {
    # Copy applications into ~/Applications/Nix Apps. This workaround allows us
    # to find applications installed by nix through spotlight.
    activationScripts.applications.text = pkgs.lib.mkForce (
      ''
        rm -rf ~/Applications/Nix\ Apps
        mkdir -p ~/Applications/Nix\ Apps
        for app in $(find ${config.system.build.applications}/Applications -maxdepth 1 -type l); do
          src="$(/usr/bin/stat -f%Y "$app")"
          cp -rL "$src" ~/Applications/Nix\ Apps
        done
      ''
    );
  };

hardselius avatar May 18 '21 20:05 hardselius

This solution does not resolve the problem you highlighted @hardselius. It only makes nix-darwin interoperate with other tools and software by not taking ownership of the ~/Applications folder (it becomes unwritable).

berbiche avatar May 18 '21 22:05 berbiche

@LnL7 Would love to get this merged, so we can fix the home-manager option too :)

winterqt avatar Jul 16 '21 21:07 winterqt

@LnL7 this would be a welcome change on my side as well, and my understanding is that the mkdir -p ~/Applications line satisfies all needs and requirements regarding that directory.

ggPeti avatar Aug 24 '21 10:08 ggPeti

@LnL7 Any movement on this? I'm looking at making Darwin launchers more commonplace in nixpkgs with Nixos/nixpkgs#131891. It'd be a shame for none of those launchers to be accessible.

hexagonal-sun avatar Feb 03 '22 10:02 hexagonal-sun

Unfortunately, this issue is the major blocker for me adopting Nix & nix-darwin on my new Mac. I'd love to see this PR merged so the related issues in home-manager could be closed.

@LnL7 @berbiche It looks like the code has been reviewed but not approved. Is there a timeline for the approval and merge?

chriselsner avatar Jun 05 '22 15:06 chriselsner

@LnL7 please take five minutes to review and merge. Don't make the community make a fork for a one liner change.

ggPeti avatar Jun 06 '22 07:06 ggPeti

Is this ever going anywhere? I really want this feature.

Sciencentistguy avatar Jun 23 '22 21:06 Sciencentistguy

@berbiche, this issue was discussed in the macOS room on Matrix. Consensus seems to be that apps managed my Nix-Darwin would actually be a better fit in /Applications. Could you change the subfolder to be there rather than ~/Applications? Might make this move forward again.

toonn avatar Jun 24 '22 17:06 toonn

@berbiche, [...]. Could you change the subfolder to be there rather than ~/Applications? Might make this move forward again.

Hi,

I am currently away from my computer and will not make this change for at least one week if not more.

I recommend submitting a new PR if you wish to see the issue resolved sooner or committing directly to my branch (if you are a contributor on this repository).

berbiche avatar Jun 24 '22 19:06 berbiche

This can be closed since #470 was merged

supermarin avatar Nov 01 '22 17:11 supermarin