diff --git a/flake.lock b/flake.lock index 34c2d57..885c6b0 100644 --- a/flake.lock +++ b/flake.lock @@ -458,11 +458,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1679262748, - "narHash": "sha256-DQCrrAFrkxijC6haUzOC5ZoFqpcv/tg2WxnyW3np1Cc=", + "lastModified": 1679437018, + "narHash": "sha256-vOuiDPLHSEo/7NkiWtxpHpHgoXoNmrm+wkXZ6a072Fc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "60c1d71f2ba4c80178ec84523c2ca0801522e0a6", + "rev": "19cf008bb18e47b6e3b4e16e32a9a4bdd4b45f7e", "type": "github" }, "original": { diff --git a/nix-conf/home-manager/base/darwin-spotlight.nix b/nix-conf/home-manager/base/darwin-spotlight.nix new file mode 100644 index 0000000..4101528 --- /dev/null +++ b/nix-conf/home-manager/base/darwin-spotlight.nix @@ -0,0 +1,28 @@ +{ lib, pkgs, config, ... }: +{ + # Copy GUI apps to "~/Applications/Home Manager Apps" + # Based on this comment: https://github.com/nix-community/home-manager/issues/1341#issuecomment-778820334 + home.activation.darwinApps = + if pkgs.stdenv.isDarwin then + let + apps = pkgs.buildEnv { + name = "home-manager-applications"; + paths = config.home.packages; + pathsToLink = "/Applications"; + }; + in + lib.hm.dag.entryAfter [ "writeBoundary" ] '' + # Install MacOS applications to the user environment. + HM_APPS="$HOME/Applications/Home Manager Apps" + # Reset current state + [ -e "$HM_APPS" ] && $DRY_RUN_CMD rm -r "$HM_APPS" + $DRY_RUN_CMD mkdir -p "$HM_APPS" + # .app dirs need to be actual directories for Finder to detect them as Apps. + # In the env of Apps we build, the .apps are symlinks. We pass all of them as + # arguments to cp and make it dereference those using -H + $DRY_RUN_CMD cp --archive -H --dereference ${apps}/Applications/* "$HM_APPS" + $DRY_RUN_CMD chmod +w -R "$HM_APPS" + '' + else + ""; +} diff --git a/nix-conf/home-manager/flake.nix b/nix-conf/home-manager/flake.nix index 4f922b5..c2f4a73 100644 --- a/nix-conf/home-manager/flake.nix +++ b/nix-conf/home-manager/flake.nix @@ -179,6 +179,7 @@ modules = base.modules ++ [ ./home.nix ./base/productive_desktop.nix + ./base/darwin-spotlight.nix { base.private_chromium.enable = false; }