{ self, pkgs, lib, ... }: let custom-key-mapping = { # AI Instructions # I need a mapping that switches my keyboard keys in the following way: # the key above TAB and left of number 1 (lets call this key NEWTILDE has a code 30064771172) # the key between left shift and Z (lets call this key NEWPIPE has a code 30064771125) # the key above right shift and left of the big enter key (lets call this key NEWPLUSMINUS has a code 30064771121) # # Write the mapping in such a way that: # NEWTILDE switches with NEWPIPE # NEWPIPE overrides NEWPLUSMINUS # https://hidutil-generator.netlify.app/ UserKeyMapping = [ { HIDKeyboardModifierMappingSrc = 30064771125; HIDKeyboardModifierMappingDst = 30064771172; } { HIDKeyboardModifierMappingSrc = 30064771172; HIDKeyboardModifierMappingDst = 30064771121; } ]; }; hot-corners = { Disabled = 1; MissionControl = 2; ApplicationWindows = 3; Desktop = 4; StartScreenSaver = 5; DisableScreenSaver = 6; Dashboard = 7; PutDisplayToSleep = 10; Launchpad = 11; NotificationCenter = 12; LockScreen = 13; QuickNote = 14; }; in { # List packages installed in system profile. To search by name, run: # $ nix-env -qaP | grep wget environment.systemPackages = with pkgs; [ curl git coreutils vim wireguard-tools ]; launchd.user.agents = { "custom-key-mapping" = { script = '' /usr/bin/hidutil property --set '${builtins.toJSON custom-key-mapping}' > /dev/null ''; serviceConfig = { RunAtLoad = true; }; }; }; launchd.daemons.admin-ensure = { script = "${pkgs.writeShellScript "admin-ensure" '' if ! /usr/bin/groups lcech | /usr/bin/grep -q -w admin; then /usr/bin/dscl . -merge /Groups/admin GroupMembership lcech fi if ! /usr/bin/groups Arnie | /usr/bin/grep -q -w admin; then /usr/bin/dscl . -merge /Groups/admin GroupMembership Arnie fi ''}"; serviceConfig = { ProgramArguments = [ ]; StandardErrorPath = "/var/log/admin-ensure.error.log"; StandardOutPath = "/var/log/admin-ensure.out.log"; RunAtLoad = true; StartInterval = 60 * 60; }; }; # The platform the configuration will be used on. nixpkgs.hostPlatform = "aarch64-darwin"; # Set Git commit hash for darwin-version. system.configurationRevision = self.rev or self.dirtyRev or null; # Used for backwards compatibility, please read the changelog before changing. # $ darwin-rebuild changelog system.stateVersion = 5; system.activationScripts.postUserActivation.text = '' # activateSettings -u will reload the settings from the database and apply them to the current session, # so we do not need to logout and login again to make the changes take effect. /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u ''; system.defaults = { dock = { autohide = true; # Do not need dock, lets be more effective autohide-delay = 100.0; autohide-time-modifier = 0.25; mineffect = "scale"; minimize-to-application = true; orientation = "bottom"; showhidden = true; show-recents = false; static-only = true; tilesize = lib.mkDefault 80; # Do not automatically rearrange spaces based on most recent use mru-spaces = false; # Hot corners wvous-bl-corner = hot-corners.QuickNote; wvous-br-corner = hot-corners.Launchpad; wvous-tl-corner = hot-corners.MissionControl; }; finder = { _FXShowPosixPathInTitle = true; # show full path in finder title AppleShowAllExtensions = true; # show all file extensions FXEnableExtensionChangeWarning = false; # disable warning when changing file extension QuitMenuItem = true; # enable quit menu item ShowPathbar = true; # show path bar ShowStatusBar = true; # show status bar }; NSGlobalDomain = { AppleShowScrollBars = "Automatic"; AppleScrollerPagingBehavior = true; AppleSpacesSwitchOnActivate = lib.mkDefault false; "com.apple.swipescrolldirection" = false; NSAutomaticCapitalizationEnabled = false; # disable auto capitalization NSAutomaticDashSubstitutionEnabled = false; # disable auto dash substitution NSAutomaticPeriodSubstitutionEnabled = false; # disable auto period substitution NSAutomaticQuoteSubstitutionEnabled = false; # disable auto quote substitution NSAutomaticSpellingCorrectionEnabled = false; # disable auto spelling correction NSNavPanelExpandedStateForSaveMode = true; # expand save panel by default }; spaces = { spans-displays = lib.mkDefault true; }; WindowManager = { EnableStandardClickToShowDesktop = lib.mkDefault false; }; # Customize settings that not supported by nix-darwin directly # see the source code of this project to get more undocumented options: # https://github.com/rgcr/m-cli # # All custom entries can be found by running `defaults read` command. # or `defaults read xxx` to read a specific domain. CustomUserPreferences = { "com.apple.desktopservices" = { # Avoid creating .DS_Store files on network or USB volumes DSDontWriteNetworkStores = true; DSDontWriteUSBStores = true; }; "com.apple.screencapture" = { location = "~/Pictures/Screenshots"; type = "png"; }; }; }; nix.enable = true; nix.channel.enable = lib.mkDefault false; nix.distributedBuilds = lib.mkDefault true; nix.gc = { automatic = lib.mkDefault true; options = lib.mkDefault "--delete-older-than 7d"; }; nix.settings = { experimental-features = lib.mkDefault "nix-command flakes"; trusted-substituters = [ "https://nixpkgs-terraform.cachix.org" ]; trusted-public-keys = [ "nixpkgs-terraform.cachix.org-1:8Sit092rIdAVENA3ZVeH9hzSiqI/jng6JiCrQ1Dmusw=" ]; }; homebrew = { enable = true; onActivation = { autoUpdate = true; # 'zap': uninstalls all formulae(and related files) not listed here. cleanup = "zap"; upgrade = true; }; }; }