nixos-dots

nixos dots
git clone git://popovic.xyz/nixos-dots.git
Log | Files | Refs

mac.nix (7693B)


      1 {
      2   pkgs,
      3   hostName,
      4   systemName,
      5   ...
      6 }:
      7 {
      8   # nix-darwin setup
      9   nixpkgs.hostPlatform = systemName;
     10   system.stateVersion = 6;
     11   networking.hostName = hostName;
     12 
     13   imports = [
     14     ../../users/root.nix
     15     ../../modules/nix_settings.nix
     16   ];
     17 
     18   environment.variables = {
     19     __ETC_ZSHRC_SOURCED = "1";
     20     __ETC_ZSHENV_SOURCED = "1";
     21   };
     22 
     23   # programs
     24   programs = {
     25     zsh.enable = true;
     26     gnupg.agent = {
     27       enable = true;
     28       enableSSHSupport = true;
     29     };
     30   };
     31 
     32   # users
     33   users = {
     34     users = {
     35       mika = {
     36         shell = pkgs.zsh;
     37         home = "/Users/mika";
     38       };
     39       root = {
     40         shell = pkgs.zsh;
     41         home = "/var/root";
     42       };
     43     };
     44   };
     45 
     46   system = {
     47     primaryUser = "mika";
     48     defaults = {
     49       controlcenter = {
     50         BatteryShowPercentage = true;
     51         NowPlaying = false;
     52       };
     53       CustomUserPreferences = {
     54         "com.apple.symbolichotkeys" = {
     55           "64" = {
     56             # Disable 'Cmd + Space' for Spotlight Search
     57             enabled = false;
     58           };
     59           "65" = {
     60             # Disable 'Cmd + Alt + Space' for Finder search window
     61             enabled = false;
     62           };
     63           "238" = {
     64             # Set 'Control + Command + C' to center focused window
     65             enabled = true;
     66             value = {
     67               parameters = [
     68                 99
     69                 8
     70                 1310720
     71               ];
     72               type = "standard";
     73             };
     74           };
     75           "98" = {
     76             # Disable 'Show Help menu'
     77             enabled = false;
     78             value = {
     79               parameters = [
     80                 47
     81                 44
     82                 1179648
     83               ];
     84               type = "standard";
     85             };
     86           };
     87         };
     88       };
     89       NSGlobalDomain = {
     90         "com.apple.sound.beep.volume" = 0.000;
     91         AppleInterfaceStyleSwitchesAutomatically = true;
     92         ApplePressAndHoldEnabled = false;
     93         AppleShowAllExtensions = true;
     94         AppleMetricUnits = 1;
     95         InitialKeyRepeat = 20;
     96         KeyRepeat = 2;
     97         NSAutomaticCapitalizationEnabled = false;
     98         NSAutomaticDashSubstitutionEnabled = false;
     99         NSAutomaticQuoteSubstitutionEnabled = false;
    100         NSAutomaticSpellingCorrectionEnabled = false;
    101         NSAutomaticWindowAnimationsEnabled = false;
    102         NSDocumentSaveNewDocumentsToCloud = false;
    103         NSNavPanelExpandedStateForSaveMode = true;
    104         PMPrintingExpandedStateForPrint = true;
    105       };
    106       trackpad = {
    107         TrackpadRightClick = true;
    108         TrackpadThreeFingerDrag = true;
    109         Clicking = true;
    110       };
    111       finder = {
    112         AppleShowAllFiles = true;
    113         CreateDesktop = false;
    114         FXDefaultSearchScope = "SCcf";
    115         FXEnableExtensionChangeWarning = false;
    116         FXPreferredViewStyle = "Nlsv";
    117         QuitMenuItem = true;
    118         ShowPathbar = true;
    119         ShowStatusBar = true;
    120         _FXShowPosixPathInTitle = true;
    121         _FXSortFoldersFirst = true;
    122       };
    123       dock = {
    124         autohide = true;
    125         expose-animation-duration = 0.15;
    126         show-recents = false;
    127         showhidden = true;
    128         persistent-apps = [ ];
    129         tilesize = 50;
    130         wvous-bl-corner = 1;
    131         wvous-br-corner = 1;
    132         wvous-tl-corner = 1;
    133         wvous-tr-corner = 1;
    134       };
    135     };
    136     keyboard = {
    137       enableKeyMapping = true;
    138       swapLeftCtrlAndFn = true;
    139       nonUS.remapTilde = true;
    140       userKeyMapping = [
    141         {
    142           HIDKeyboardModifierMappingSrc = 30064771172;
    143           HIDKeyboardModifierMappingDst = 30064771125;
    144         }
    145       ];
    146     };
    147   };
    148 
    149   nixpkgs.config.allowUnfree = true;
    150   environment.systemPackages = with pkgs; [
    151     neovim
    152     wget
    153     git
    154     nix
    155     curl
    156     tree
    157     coreutils
    158     stdenv
    159     pciutils
    160     util-linux
    161     pstree
    162     wireguard-tools
    163     darwin.xcode_26
    164   ];
    165 
    166   services.aerospace = {
    167     enable = true;
    168     settings = {
    169       after-startup-command = [ ];
    170       enable-normalization-flatten-containers = true;
    171       enable-normalization-opposite-orientation-for-nested-containers = true;
    172       accordion-padding = 30;
    173       default-root-container-layout = "tiles";
    174       default-root-container-orientation = "auto";
    175       on-focused-monitor-changed = [ "move-mouse monitor-lazy-center" ];
    176       automatically-unhide-macos-hidden-apps = false;
    177       on-mode-changed = [ ];
    178 
    179       key-mapping = {
    180         preset = "qwerty";
    181       };
    182 
    183       gaps = {
    184         inner = {
    185           horizontal = 10;
    186           vertical = 10;
    187         };
    188         outer = {
    189           left = 10;
    190           bottom = 10;
    191           top = 10;
    192           right = 10;
    193         };
    194       };
    195 
    196       mode.main.binding = {
    197         alt-slash = "layout tiles horizontal vertical";
    198         alt-comma = "layout accordion horizontal vertical";
    199 
    200         # Focus
    201         alt-h = "focus left";
    202         alt-j = "focus down";
    203         alt-k = "focus up";
    204         alt-l = "focus right";
    205 
    206         # Move
    207         alt-shift-h = "move left";
    208         alt-shift-j = "move down";
    209         alt-shift-k = "move up";
    210         alt-shift-l = "move right";
    211 
    212         # Resize
    213         alt-minus = "resize smart -50";
    214         alt-equal = "resize smart +50";
    215 
    216         # Workspace
    217         alt-1 = "workspace 1";
    218         alt-2 = "workspace 2";
    219         alt-3 = "workspace 3";
    220         alt-4 = "workspace 4";
    221         alt-5 = "workspace 5";
    222         alt-6 = "workspace 6";
    223         alt-7 = "workspace 7";
    224         alt-8 = "workspace 8";
    225         alt-9 = "workspace 9";
    226 
    227         # Move node to workspace
    228         alt-shift-1 = "move-node-to-workspace 1";
    229         alt-shift-2 = "move-node-to-workspace 2";
    230         alt-shift-3 = "move-node-to-workspace 3";
    231         alt-shift-4 = "move-node-to-workspace 4";
    232         alt-shift-5 = "move-node-to-workspace 5";
    233         alt-shift-6 = "move-node-to-workspace 6";
    234         alt-shift-7 = "move-node-to-workspace 7";
    235         alt-shift-8 = "move-node-to-workspace 8";
    236         alt-shift-9 = "move-node-to-workspace 9";
    237 
    238         alt-enter = "exec-and-forget open -n /Users/mika/Applications/kitty.app";
    239         alt-c = "exec-and-forget open -n /Users/mika/Applications/Firefox.app";
    240         alt-shift-w = "exec-and-forget open -n /Users/mika/Applications/Spotify.app";
    241         alt-shift-q = "close --quit-if-last-window";
    242         alt-m = "exec-and-forget /Users/mika/Applications/kitty.app/Contents/MacOS/kitty neomutt";
    243         alt-f = "fullscreen";
    244 
    245         # Workspace navigation
    246         alt-tab = "workspace-back-and-forth";
    247         alt-shift-tab = "move-workspace-to-monitor --wrap-around next";
    248 
    249         # Mode
    250         alt-shift-semicolon = "mode service";
    251       };
    252 
    253       mode.service.binding = {
    254         esc = [
    255           "reload-config"
    256           "mode main"
    257         ];
    258         r = [
    259           "flatten-workspace-tree"
    260           "mode main"
    261         ];
    262         f = [
    263           "layout floating tiling"
    264           "mode main"
    265         ];
    266         backspace = [
    267           "close-all-windows-but-current"
    268           "mode main"
    269         ];
    270         alt-shift-h = [
    271           "join-with left"
    272           "mode main"
    273         ];
    274         alt-shift-j = [
    275           "join-with down"
    276           "mode main"
    277         ];
    278         alt-shift-k = [
    279           "join-with up"
    280           "mode main"
    281         ];
    282         alt-shift-l = [
    283           "join-with right"
    284           "mode main"
    285         ];
    286       };
    287     };
    288   };
    289 
    290   homebrew = {
    291     enable = true;
    292     user = "mika";
    293     prefix = "/opt/homebrew";
    294     brews = [
    295       "cocoapods"
    296       "fastlane"
    297       "watchman"
    298     ];
    299     casks = [ ];
    300     onActivation = {
    301       autoUpdate = true;
    302       upgrade = true;
    303       cleanup = "zap";
    304     };
    305   };
    306 
    307   fonts.packages = with pkgs; [
    308     nerd-fonts.terminess-ttf
    309     terminus_font
    310   ];
    311 }