diff --git a/machines/universeair/app-fix.nix b/machines/universeair/app-fix.nix new file mode 100644 index 0000000..7f7d887 --- /dev/null +++ b/machines/universeair/app-fix.nix @@ -0,0 +1,29 @@ +{config, pkgs, lib, ...}: { + # Nix-darwin does not link installed applications to the user environment. This means apps will not show up + # in spotlight, and when launched through the dock they come with a terminal window. This is a workaround. + # Upstream issue: https://github.com/LnL7/nix-darwin/issues/214 + system.activationScripts.applications.text = lib.mkForce '' + echo "setting up /Applications..." >&2 + applications="/Applications" + nix_apps="$applications/Nix Apps" + + # Delete the directory to remove old links + rm -rf "$nix_apps" + mkdir -p "$nix_apps" + find ${config.system.build.applications}/Applications -maxdepth 1 -type l -exec readlink '{}' + | + while read src; do + # Spotlight does not recognize symlinks, it will ignore directory we link to the applications folder. + # It does understand MacOS aliases though, a unique filesystem feature. Sadly they cannot be created + # from bash (as far as I know), so we use the oh-so-great Apple Script instead. + /usr/bin/osascript -e " + set fileToAlias to POSIX file \"$src\" + set applicationsFolder to POSIX file \"$nix_apps\" + tell application \"Finder\" + make new alias at applicationsFolder to fileToAlias + # This renames the alias; 'mpv.app alias' -> 'mpv.app' + set name of result to \"$(rev <<< "$src" | cut -d'/' -f1 | rev)\" + end tell + " 1>/dev/null + done + ''; +} diff --git a/machines/universeair/configuration.nix b/machines/universeair/configuration.nix index 313c9e1..1c49327 100644 --- a/machines/universeair/configuration.nix +++ b/machines/universeair/configuration.nix @@ -1,6 +1,9 @@ { config, pkgs, inputs, ... }: let in { + imports = [ + ./app-fix.nix + ]; nix.registry.nixpkgs.flake = inputs.nixpkgs; home-manager.useGlobalPkgs = true; @@ -15,17 +18,6 @@ in programs.bash.enable = true; programs.zsh = { enable = true; - initExtra = '' -PATH=$HOME/flutter/bin:$PATH -DYLD_LIBRARY_PATH=MR/v99/runtime/maci64:MR/v99/sys/os/maci64:MR/v99/bin/maci64:$DYLD_LIBRARY_PATH -flakify() { - eval "$(direnv hook bash)" - if [ ! -e flake.nix ]; then - nix flake new -t github:nix-community/nix-direnv . - fi - $EDITOR flake.nix -} - ''; shellAliases = { ssh = "kitty +kitten ssh"; sshu = "ssh universe"; @@ -54,9 +46,6 @@ flakify() { btop cbqn-replxx - - podman - qemu ]); # Or any other shell you're using. }; # Auto upgrade nix package and the daemon service.