Compare commits

...

9 Commits

3 changed files with 87 additions and 35 deletions

View File

@@ -60,7 +60,7 @@
sops-nix.nixosModules.sops
];
};
darwinConfigurations."Universe-Air" = nix-darwin.lib.darwinSystem {
darwinConfigurations."Universe-MacBook-Air" = nix-darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs = {
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
in
{
imports = [
./app-fix.nix
];
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 = {
name = "universelaptop";
home = "/Users/universelaptop";
};
home-manager.users.universelaptop = { pkgs, ... }: {
programs.direnv.enable = true;
programs.direnv.nix-direnv.enable = true;
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@syzygial.cc -p 7000";
tailscale =
"/Applications/Tailscale.app/Contents/MacOS/Tailscale";
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.universelaptop = { pkgs, ... }: {
programs.direnv.enable = true;
programs.direnv.nix-direnv.enable = true;
programs.bash.enable = true;
programs.zsh = {
enable = true;
initExtra = ''
if [[ $(uname -m) == 'arm64' ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
'';
shellAliases = {
ssh = "kitty +kitten ssh";
sshu = "ssh universe";
};
};
home.stateVersion = "22.05";
};
home.stateVersion = "22.05";
};
environment.variables = {
EDITOR = "emacs";
};
nixpkgs.config.allowUnfree = true;
environment.systemPackages = (with pkgs; [
mac-emacs
@@ -57,14 +59,35 @@ flakify() {
cbqn-replxx
podman
qemu
]);
# Or any other shell you're using. };
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
nix.package = pkgs.nixUnstable;
nix.settings.auto-optimise-store = false;
# Graphical Apps:
rectangle
tailscale
discord
slack
# TODO: Consider using Yabai??
]);
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.
programs.bash.enable = true; # default shell on catalina
programs.zsh.enable = true; # default shell on catalina