aboutsummaryrefslogtreecommitdiff
path: root/nix/machines/darwin-shared.nix
blob: 2f0ceb981b5af4d21d9a5f1eeb99bb1c06207521 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
{ pkgs, ... }:
{
  nix = {
    package = pkgs.nixVersions.stable;
    settings = {
      trusted-users = [
        "@admin"
        "fcuny"
      ];
      experimental-features = [
        "nix-command"
        "flakes"
      ];
    };
  };

  system.defaults = {
    dock = {
      autohide = true;
      dashboard-in-overlay = false;
      launchanim = false; # Don't animate opening applications.
      mru-spaces = false; # don’t rearrange spaces based on the most recent use
      orientation = "left";
      show-recents = false;
      showhidden = false;
      tilesize = 60; # Default is 64.
      wvous-br-corner = 1; # Disable Notes hot corner.
    };
    finder.AppleShowAllExtensions = true;

    CustomUserPreferences = {
      "com.apple.desktopservices" = {
        # Avoid creating .DS_Store files on network or USB volumes
        DSDontWriteNetworkStores = true;
        DSDontWriteUSBStores = true;
      };
    };

    # Requires the directory to already exist.
    # See system.activationScripts.postUserActivation
    screencapture.location = "~/Documents/screenshots";
    SoftwareUpdate.AutomaticallyInstallMacOSUpdates = true;
  };

  system.activationScripts.postUserActivation.text = ''
    mkdir -p ~/Documents/screenshots
  '';

  fonts.packages = with pkgs; [
    source-code-pro
    monaspace
  ];

  system.keyboard = {
    enableKeyMapping = true;
    remapCapsLockToControl = true;
  };

  # Touch ID for sudo auth
  security.pam.enableSudoTouchIdAuth = true;

  services.nix-daemon.enable = true;

  programs.fish.enable = true;
  programs.fish.shellInit = ''
    # Nix
    if test -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.fish'
      source '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.fish'
    end
    # End Nix
  '';

  # Required for homebrew on aarch64
  environment.systemPath = [
    "/opt/homebrew/bin"
    "/opt/homebrew/sbin"
  ];

  environment.variables = {
    HOMEBREW_NO_ANALYTICS = "1";
    HOMEBREW_NO_INSECURE_REDIRECT = "1";
    HOMEBREW_NO_EMOJI = "1";
    HOMEBREW_NO_AUTO_UPDATE = "1";
  };

  homebrew = {
    enable = true;

    onActivation = {
      autoUpdate = true;
      cleanup = "uninstall";
      upgrade = true;
    };

    casks = [
      "1password-cli"
      "docker"
      "element"
      "transmission"
      "vlc"
      "wireshark"
    ];
  };

  programs.ssh.knownHosts = {
    "github.com".publicKey =
      "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl";
  };
}