update nix-darwin to be flake-based

This commit is contained in:
Haak Saxberg 2026-03-25 15:36:37 -07:00
parent ddc8c7ec80
commit 659a4f29bc
4 changed files with 144 additions and 17 deletions

View file

@ -62,8 +62,8 @@ let
};
in
{
imports = [ <home-manager/nix-darwin> ];
nixpkgs.hostPlatform = "aarch64-darwin";
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
@ -73,10 +73,10 @@ in
pkgs.obsidian
pkgs.syncthing
pkgs.slack
pkgs._1password
# pkgs._1password-gui
pkgs._1password-cli
pkgs._1password-gui
pkgs.tailscale
whatsapp
#whatsapp
obs-studio
vlc
keycastr
@ -99,16 +99,9 @@ in
# have to do this to play nicely with home-manager:
# https://github.com/nix-community/home-manager/issues/4026
users.users.haak.home = "/Users/haak/";
home-manager.users.haak.imports = [
../../home/commandline.nix
../../home/programs/alacritty
];
# nix.package = pkgs.nix;
# Create /etc/bashrc that loads the nix-darwin environment.
programs.zsh.enable = true; # default shell on catalina
# programs.fish.enable = true;
system.primaryUser = "haak";
@ -116,12 +109,14 @@ in
# by nix-darwin
system.activationScripts.applications.text = pkgs.lib.mkForce (
''
userDir="$HOME/Applications/Nix Apps"
userDir="${config.users.users.haak.home}Applications/Nix Apps"
echo "setting up $userDir"
rm -rf $userDir
mkdir -p $userDir
chown haak $userDir
for app in $(find ${config.system.build.applications}/Applications -maxdepth 1 -type l); do
rm -rf "$userDir"
mkdir -p "$userDir"
chown haak "$userDir"
find ${config.system.build.applications}/Applications -maxdepth 1 -type l -exec sh -c '
userDir="${config.users.users.haak.home}Applications/Nix Apps"
app=$1
src="$(/usr/bin/stat -f%Y "$app")"
dst="$userDir/$(basename $src)"
echo "app: $app, src: $src, dst: $dst"
@ -129,7 +124,7 @@ in
echo "Linking $app"
ln -s "$app" "$dst"
fi
done
' sh {} \;
''
);
@ -262,4 +257,7 @@ in
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = 4;
# something odd about the migration from 4 to 5, or to Lix?
ids.gids.nixbld = 350;
}