Kieran's opinionated (and probably slightly dumb) nix config

feat: add custom keybinds and mac setup

dunkirk.sh e01d8438 4504aea7

verified
Changed files
+149
dots
machines
atalanta
+1
.gitignore
···
.crush
+
.DS_Store
+36
dots/dump-keybinds-mac.sh
···
+
#!/usr/bin/env bash
+
+
defaults export com.apple.symbolichotkeys - > /tmp/symbolichotkeys.plist
+
plutil -convert json -o /tmp/symbolichotkeys.json /tmp/symbolichotkeys.plist
+
cat /tmp/symbolichotkeys.json | \
+
jq -r '
+
.AppleSymbolicHotKeys
+
| to_entries
+
| map(
+
" \"" + .key + "\" = {\n" +
+
" enabled = " + (
+
if (.value.enabled == 1 or .value.enabled == true) then
+
"true"
+
else
+
"false"
+
end
+
) + ";\n" +
+
(
+
if (.value.value? and .value.value.parameters? and .value.value.type?) then
+
" value = {\n" +
+
" parameters = [ " + (
+
.value.value.parameters
+
| map(tostring)
+
| join(" ")
+
) + " ];\n" +
+
" type = \"" + .value.value.type + "\";\n" +
+
" };\n"
+
else
+
""
+
end
+
) +
+
" };\n"
+
)
+
| " AppleSymbolicHotKeys = {\n" + ( join("") ) + " };\n"
+
'
+
+112
machines/atalanta/default.nix
···
VISUAL = "nvim";
};
+
# nothing but finder in the doc
+
system.defaults.dock = {
+
persistent-apps = [ ];
+
+
tilesize = 47;
+
show-recents = false;
+
};
+
+
# allow using apple watch or touch id for sudo
+
security.pam.services.sudo_local.touchIdAuth = true;
+
security.pam.services.sudo_local.watchIdAuth = true;
+
+
system.defaults = {
+
finder.FXPreferredViewStyle = "Nlsv";
+
finder.AppleShowAllExtensions = true;
+
# expand the save dialogs
+
NSGlobalDomain.NSNavPanelExpandedStateForSaveMode = true;
+
NSGlobalDomain.NSNavPanelExpandedStateForSaveMode2 = true;
+
LaunchServices.LSQuarantine = false; # disables "Are you sure?" for new apps
+
loginwindow.GuestEnabled = false;
+
+
NSGlobalDomain."com.apple.trackpad.scaling" = 0.875;
+
+
CustomSystemPreferences = {
+
"com.apple.DiskArbitration.diskarbitrationd" = {
+
DADisableEjectNotification = true;
+
};
+
};
+
+
CustomUserPreferences = {
+
"com.apple.driver.AppleBluetoothMultitouch.mouse" = {
+
MouseButtonMode = "TwoButton";
+
};
+
"com.apple.WindowManager" = {
+
EnableTiledWindowMargins = false;
+
};
+
"com.apple.desktopservices" = {
+
# Avoid creating .DS_Store files on network or USB volumes
+
DSDontWriteNetworkStores = true;
+
DSDontWriteUSBStores = true;
+
};
+
"com.apple.AdLib" = {
+
allowApplePersonalizedAdvertising = false;
+
};
+
"com.apple.SoftwareUpdate" = {
+
AutomaticCheckEnabled = true;
+
# Check for software updates daily, not just once per week
+
ScheduleFrequency = 1;
+
# Download newly available updates in background
+
AutomaticDownload = 1;
+
# Install System data files & security updates
+
CriticalUpdateInstall = 1;
+
};
+
# keybindings
+
# Script to export symbolic hotkey configs from MacOS
+
# https://gist.github.com/sawadashota/8e7ce32234e0f07a03e955f22ec4c0f9
+
# Screenshot selected area to file with Cmd+Option+Shift+4
+
"com.apple.symbolichotkeys" = {
+
AppleSymbolicHotKeys = {
+
# Screenshot selected area with Option+Cmd+Shift+4
+
"30" = {
+
enabled = true;
+
value = {
+
parameters = [
+
52
+
21
+
1703936
+
];
+
type = "standard";
+
};
+
};
+
# Screenshot selected area to clipboard with Cmd+Shift+4
+
"31" = {
+
enabled = true;
+
value = {
+
parameters = [
+
52
+
21
+
1179648
+
];
+
type = "standard";
+
};
+
};
+
# Fullscreen screenshot Option+Cmd+Shift+3
+
"28" = {
+
enabled = true;
+
value = {
+
parameters = [
+
51
+
20
+
1703936
+
];
+
type = "standard";
+
};
+
};
+
# Fullscreen screenshot to clipboard Cmd+Shift+3
+
"29" = {
+
enabled = true;
+
value = {
+
parameters = [
+
51
+
20
+
1179648
+
];
+
type = "standard";
+
};
+
};
+
};
+
};
+
};
+
};
+
# Used for backwards compatibility, please read the changelog before changing
system.stateVersion = 4;
}