Compare commits

...

9 Commits

3 changed files with 87 additions and 35 deletions

View File

@@ -60,7 +60,7 @@
sops-nix.nixosModules.sops sops-nix.nixosModules.sops
]; ];
}; };
darwinConfigurations."Universe-Air" = nix-darwin.lib.darwinSystem { darwinConfigurations."Universe-MacBook-Air" = nix-darwin.lib.darwinSystem {
system = "aarch64-darwin"; system = "aarch64-darwin";
specialArgs = { specialArgs = {
inputs = attrs; inputs = attrs;

View 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
'';
}

View File

@@ -1,44 +1,46 @@
{ 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;
nixpkgs.config.allowUnfree = true;
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
nix.package = pkgs.nixUnstable;
nix.settings.auto-optimise-store = false;
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
users.users.universelaptop = { users.users.universelaptop = {
name = "universelaptop"; name = "universelaptop";
home = "/Users/universelaptop"; home = "/Users/universelaptop";
}; };
home-manager.users.universelaptop = { pkgs, ... }: { home-manager = {
programs.direnv.enable = true; useGlobalPkgs = true;
programs.direnv.nix-direnv.enable = true; useUserPackages = true;
programs.bash.enable = true; users.universelaptop = { pkgs, ... }: {
programs.zsh = { programs.direnv.enable = true;
enable = true; programs.direnv.nix-direnv.enable = true;
initExtra = '' programs.bash.enable = true;
PATH=$HOME/flutter/bin:$PATH programs.zsh = {
DYLD_LIBRARY_PATH=MR/v99/runtime/maci64:MR/v99/sys/os/maci64:MR/v99/bin/maci64:$DYLD_LIBRARY_PATH enable = true;
flakify() { initExtra = ''
eval "$(direnv hook bash)" if [[ $(uname -m) == 'arm64' ]]; then
if [ ! -e flake.nix ]; then eval "$(/opt/homebrew/bin/brew shellenv)"
nix flake new -t github:nix-community/nix-direnv . fi
fi '';
$EDITOR flake.nix shellAliases = {
} ssh = "kitty +kitten ssh";
''; sshu = "ssh universe";
shellAliases = { };
ssh = "kitty +kitten ssh";
sshu = "ssh universe@syzygial.cc -p 7000";
tailscale =
"/Applications/Tailscale.app/Contents/MacOS/Tailscale";
}; };
home.stateVersion = "22.05";
}; };
home.stateVersion = "22.05";
}; };
environment.variables = { environment.variables = {
EDITOR = "emacs"; EDITOR = "emacs";
}; };
nixpkgs.config.allowUnfree = true;
environment.systemPackages = (with pkgs; [ environment.systemPackages = (with pkgs; [
mac-emacs mac-emacs
@@ -57,14 +59,35 @@ flakify() {
cbqn-replxx cbqn-replxx
podman # Graphical Apps:
qemu rectangle
]); tailscale
# Or any other shell you're using. }; discord
# Auto upgrade nix package and the daemon service. slack
services.nix-daemon.enable = true; # TODO: Consider using Yabai??
nix.package = pkgs.nixUnstable; ]);
nix.settings.auto-optimise-store = false;
homebrew = {
# It is not installed by nix, for now, so manually install:
# https://brew.sh/
enable = true;
onActivation = {
cleanup = "uninstall";
};
# Graphical apps to install through homebrew instead of nixpkgs
casks = [
"firefox"
"nextcloud"
"tidal"
];
# Apps to install outside of nix for when wanting to test/run
# things that... aren't used by other people who use nix, like
# python apps (which is why poetry is there)
brews = [
"poetry"
];
};
# Create /etc/zshrc that loads the nix-darwin environment. # Create /etc/zshrc that loads the nix-darwin environment.
programs.bash.enable = true; # default shell on catalina programs.bash.enable = true; # default shell on catalina
programs.zsh.enable = true; # default shell on catalina programs.zsh.enable = true; # default shell on catalina