Applications Directory Fix
This commit is contained in:
29
machines/universeair/app-fix.nix
Normal file
29
machines/universeair/app-fix.nix
Normal file
@@ -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
|
||||||
|
'';
|
||||||
|
}
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
{ config, pkgs, inputs, ... }: let
|
{ config, pkgs, inputs, ... }: let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
imports = [
|
||||||
|
./app-fix.nix
|
||||||
|
];
|
||||||
nix.registry.nixpkgs.flake = inputs.nixpkgs;
|
nix.registry.nixpkgs.flake = inputs.nixpkgs;
|
||||||
|
|
||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
@@ -15,17 +18,6 @@ in
|
|||||||
programs.bash.enable = true;
|
programs.bash.enable = true;
|
||||||
programs.zsh = {
|
programs.zsh = {
|
||||||
enable = true;
|
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 = {
|
shellAliases = {
|
||||||
ssh = "kitty +kitten ssh";
|
ssh = "kitty +kitten ssh";
|
||||||
sshu = "ssh universe";
|
sshu = "ssh universe";
|
||||||
@@ -54,9 +46,6 @@ flakify() {
|
|||||||
btop
|
btop
|
||||||
|
|
||||||
cbqn-replxx
|
cbqn-replxx
|
||||||
|
|
||||||
podman
|
|
||||||
qemu
|
|
||||||
]);
|
]);
|
||||||
# Or any other shell you're using. };
|
# Or any other shell you're using. };
|
||||||
# Auto upgrade nix package and the daemon service.
|
# Auto upgrade nix package and the daemon service.
|
||||||
|
|||||||
Reference in New Issue
Block a user