about summary refs log tree commit diff
path: root/lib/mk_home.nix
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2022-09-09 17:49:03 +0900
committersefidel <contact@sefidel.net>2022-09-09 21:32:31 +0900
commit9e6145c031b47fc37398b80dec1b4dfc0cfb5183 (patch)
treef27e3c50a0c25223931e7057616e456432007de9 /lib/mk_home.nix
parent9e311725d4f6c68284e3999c01735ebe3665a14d (diff)
downloadnixrc-9e6145c031b47fc37398b80dec1b4dfc0cfb5183.tar.gz
nixrc-9e6145c031b47fc37398b80dec1b4dfc0cfb5183.zip
milestone: darwin!
feat(darwin/kompakt)!: support darwin

chore: reformat

feat(home/o32): manage neovim

feat(home/development): fix haskell lsp version mismatch

feat(darwin/*): stabilise
Diffstat (limited to 'lib/mk_home.nix')
-rw-r--r--lib/mk_home.nix28
1 files changed, 26 insertions, 2 deletions
diff --git a/lib/mk_home.nix b/lib/mk_home.nix
index b2f87dc..a1466ba 100644
--- a/lib/mk_home.nix
+++ b/lib/mk_home.nix
@@ -3,7 +3,7 @@
 { username, hostname, pkgs, version, extraModules ? null }:
 let
   entrypoint = "${self}/home/${hostname}/${username}.nix";
-  defaultModule = { lib, ... }: {
+  defaultModule = { lib, config, ... }: {
     _module.args.inputs = self.inputs;
     _module.args.self = self;
 
@@ -15,9 +15,33 @@ let
 
     home = {
       inherit username;
-      homeDirectory = "/home/${username}";
+      homeDirectory = if pkgs.stdenv.isDarwin then "/Users/${username}" else "/home/${username}";
       stateVersion = version;
     };
+
+   # Make applications pop up in finder/spotlight
+    home.activation = lib.mkIf pkgs.stdenv.isDarwin {
+      copyApplications =
+        let
+          apps = pkgs.buildEnv {
+            name = "home-manager-applications";
+            paths = config.home.packages;
+            pathsToLink = "/Applications";
+          };
+        in
+        lib.hm.dag.entryAfter [ "writeBoundary" ] ''
+          baseDir="$HOME/Applications/Home Manager Apps"
+          if [ -d "$baseDir" ]; then
+            rm -rf "$baseDir"
+          fi
+          mkdir -p "$baseDir"
+          for appFile in ${apps}/Applications/*; do
+            target="$baseDir/$(basename "$appFile")"
+            $DRY_RUN_CMD cp ''${VERBOSE_ARG:+-v} -fHRL "$appFile" "$baseDir"
+            $DRY_RUN_CMD chmod ''${VERBOSE_ARG:+-v} -R +w "$target"
+          done
+        '';
+    };
   };
 in
 home-manager.lib.homeManagerConfiguration {