{ config, lib, pkgs, ... }: { # auto upgrade nix package and the daemon service. services.nix-daemon.enable = true; # enable the linux builder nix.linux-builder = { enable = true; package = pkgs.darwin.linux-builder-x86_64; ephemeral = true; maxJobs = 4; config = { virtualisation = { darwin-builder = { diskSize = 40 * 1024; memorySize = 8 * 1024; }; cores = 6; }; }; }; # enable trusted users nix.settings.trusted-users = [ "@admin" ]; # nix auto garbage collection nix.gc = { automatic = true; interval = { Weekday = 0; Hour = 0; Minute = 0; }; options = "--delete-older-than 7d"; }; # make nix applications use alias instead of symlinks for compatability system.activationScripts.applications.text = let env = pkgs.buildEnv { name = "system-applications"; paths = config.environment.systemPackages; pathsToLink = "/Applications"; }; in pkgs.lib.mkForce '' # Set up applications. echo "setting up /Applications..." >&2 rm -rf /Applications/Nix\ Apps mkdir -p /Applications/Nix\ Apps find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + | while read -r src; do app_name=$(basename "$src") echo "copying $src" >&2 ${pkgs.mkalias}/bin/mkalias "$src" "/Applications/Nix Apps/$app_name" done ''; # changing this might break system.stateVersion = 5; }