Skip to content

Commit

Permalink
conf: add mars (and nix-darwin)
Browse files Browse the repository at this point in the history
  • Loading branch information
jnsgruk committed Nov 15, 2024
1 parent af541e2 commit a9c008c
Show file tree
Hide file tree
Showing 23 changed files with 603 additions and 97 deletions.
119 changes: 119 additions & 0 deletions darwin/common/aerospace.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
{ pkgs, lib, ... }:
{
services.aerospace = {
enable = false;
package = pkgs.aerospace;
settings = {
enable-normalization-opposite-orientation-for-nested-containers = true;
enable-normalization-flatten-containers = true;
on-focused-monitor-changed = [ "move-mouse monitor-lazy-center" ];
key-mapping.preset = "qwerty";

gaps = {
outer.top = 8;
outer.right = 8;
outer.bottom = 8;
outer.left = 8;
inner.horizontal = 8;
inner.vertical = 8;
};

mode.main.binding = {
alt-enter = "exec-and-forget open -n '/Applications/Nix Apps/Alacritty.app'";
alt-backtick = "exec-and-forget /Applications/1Password.app/Contents/MacOS/1Password --quick-access";
alt-f = "fullscreen";

alt-1 = "workspace 1";
alt-2 = "workspace 2";
alt-3 = "workspace 3";
alt-4 = "workspace 4";
alt-5 = "workspace 5";
alt-6 = "workspace 6";
alt-7 = "workspace 7";
alt-8 = "workspace 8";
alt-9 = "workspace 9";

alt-shift-1 = "move-node-to-workspace 1";
alt-shift-2 = "move-node-to-workspace 2";
alt-shift-3 = "move-node-to-workspace 3";
alt-shift-4 = "move-node-to-workspace 4";
alt-shift-5 = "move-node-to-workspace 5";
alt-shift-6 = "move-node-to-workspace 6";
alt-shift-7 = "move-node-to-workspace 7";
alt-shift-8 = "move-node-to-workspace 8";
alt-shift-9 = "move-node-to-workspace 9";

# See: https://nikitabobko.github.io/AeroSpace/commands#layout
alt-a = "layout tiles horizontal vertical";
alt-comma = "layout accordion horizontal vertical";
alt-shift-space = "layout floating tiling";

# alt-h = "split horizontal";
# alt-v = "split vertical";

# See: https://nikitabobko.github.io/AeroSpace/commands#focus
alt-left = "focus left";
alt-down = "focus down";
alt-up = "focus up";
alt-right = "focus right";

# See: https://nikitabobko.github.io/AeroSpace/commands#move
alt-shift-left = "move left";
alt-shift-down = "move down";
alt-shift-up = "move up";
alt-shift-right = "move right";

# See: https://nikitabobko.github.io/AeroSpace/commands#resize
alt-shift-minus = "resize smart -50";
alt-shift-equal = "resize smart +50";

# See: https://nikitabobko.github.io/AeroSpace/commands#workspace-back-and-forth
alt-tab = "workspace-back-and-forth";

alt-r = "mode resize";
alt-shift-semicolon = "mode service";
};

mode.resize.binding = {
# Resize the window
left = "resize width -50";
up = "resize height +50";
down = "resize height -50";
right = "resize width +50";
enter = "mode main";
esc = "mode main";
};

mode.service.binding = {
esc = "mode main";
r = [
"flatten-workspace-tree"
"mode main"
];
f = [
"layout floating tiling"
"mode main"
];

left = [
"join-with left"
"mode main"
];
right = [
"join-with right"
"mode main"
];
up = [
"join-with up"
"mode main"
];
down = [
"join-with down"
"mode main"
];
};

on-window-detected = [ ];
};
};
}
9 changes: 9 additions & 0 deletions darwin/common/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{ ... }:
{
imports = [
./fonts.nix
./macos-defaults.nix
./packages.nix
./ssh-agent.nix
];
}
13 changes: 13 additions & 0 deletions darwin/common/fonts.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{ self, pkgs, ... }:
let
theme = import "${self}/lib/theme" { inherit pkgs; };
in
{
fonts = {
packages = [
theme.fonts.default.package
theme.fonts.iconFont.package
theme.fonts.monospace.package
];
};
}
105 changes: 105 additions & 0 deletions darwin/common/macos-defaults.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{ hostname, ... }:
{
system.defaults = {
CustomUserPreferences = {
"com.apple.AdLib" = {
allowApplePersonalizedAdvertising = false;
};
"com.apple.controlcenter" = {
BatteryShowPercentage = true;
};
"com.apple.desktopservices" = {
# Avoid creating .DS_Store files on network or USB volumes
DSDontWriteNetworkStores = true;
DSDontWriteUSBStores = true;
};
"com.apple.finder" = {
_FXSortFoldersFirst = true;
FXDefaultSearchScope = "SCcf"; # Search current folder by default
ShowExternalHardDrivesOnDesktop = false;
ShowHardDrivesOnDesktop = false;
ShowMountedServersOnDesktop = false;
ShowRemovableMediaOnDesktop = false;
};
# Prevent Photos from opening automatically
"com.apple.ImageCapture".disableHotPlug = true;
"com.apple.screencapture" = {
location = "~/Pictures/Screenshots";
type = "png";
};
"com.apple.SoftwareUpdate" = {
AutomaticCheckEnabled = true;
# Check for software updates daily, not just once per week
ScheduleFrequency = 1;
# Download newly available updates in background
AutomaticDownload = 0;
# Install System data files & security updates
CriticalUpdateInstall = 1;
};
"com.apple.TimeMachine".DoNotOfferNewDisksForBackup = true;
# Turn on app auto-update
"com.apple.commerce".AutoUpdate = true;
};
NSGlobalDomain = {
AppleICUForce24HourTime = true;
# AppleInterfaceStyle = "Dark";
# AppleInterfaceStyleSwitchesAutomatically = false;
AppleMeasurementUnits = "Centimeters";
AppleMetricUnits = 1;
AppleTemperatureUnit = "Celsius";
InitialKeyRepeat = 15;
KeyRepeat = 2;
NSAutomaticCapitalizationEnabled = false;
NSAutomaticDashSubstitutionEnabled = false;
NSAutomaticPeriodSubstitutionEnabled = false;
NSAutomaticQuoteSubstitutionEnabled = false;
NSAutomaticSpellingCorrectionEnabled = true;
NSNavPanelExpandedStateForSaveMode = true;
NSNavPanelExpandedStateForSaveMode2 = true;
NSWindowShouldDragOnGesture = true;
# _HIHideMenuBar = true;
};
SoftwareUpdate = {
AutomaticallyInstallMacOSUpdates = false;
};
dock = {
orientation = "bottom";
# persistent-apps = [
# "/System/Applications/Launchpad.app"
# ];
# show-recents = false;
# tilesize = 48;
# Disable hot corners
wvous-bl-corner = 1;
wvous-br-corner = 1;
wvous-tl-corner = 1;
wvous-tr-corner = 1;
};
finder = {
_FXShowPosixPathInTitle = true;
FXEnableExtensionChangeWarning = false;
FXPreferredViewStyle = "Nlsv";
AppleShowAllExtensions = true;
AppleShowAllFiles = true;
QuitMenuItem = true;
ShowPathbar = true;
ShowStatusBar = true;
};
menuExtraClock = {
ShowAMPM = false;
ShowDate = 1; # Always
Show24Hour = true;
ShowSeconds = false;
};
screensaver = {
askForPassword = true;
askForPasswordDelay = 300;
};
smb.NetBIOSName = hostname;
trackpad = {
Clicking = true;
TrackpadRightClick = true; # enable two finger right click
# TrackpadThreeFingerDrag = true; # enable three finger drag
};
};
}
41 changes: 41 additions & 0 deletions darwin/common/packages.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
pkgs,
lib,
self,
...
}:
let
basePackages = (import "${self}/host/common/base/packages.nix" { inherit pkgs lib; }).basePackages;
in
{
homebrew = {
brews = [ ];
casks = [
"1password"
"bambu-studio"
"easy-move+resize"
"google-chrome"
"obsidian"
"rambox"
"raycast"
"signal"
"sublime-merge"
"tailscale"
"todoist"
"visual-studio-code"
"vlc"
"zen-browser"
];
masApps = { };
taps = [ ];
};

environment.systemPackages =
basePackages
++ (with pkgs; [
m-cli
mas
plistwatch
yubikey-manager
]);
}
20 changes: 20 additions & 0 deletions darwin/common/ssh-agent.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{ pkgs, ... }:
{
launchd = {
user = {
agents = {
openssh-ssh-agent = {
serviceConfig = {
KeepAlive = true;
RunAtLoad = true;
ProgramArguments = [
"sh"
"-c"
"${pkgs.openssh}/bin/ssh-agent -D -a ~/.ssh/agent"
];
};
};
};
};
};
}
Loading

0 comments on commit a9c008c

Please sign in to comment.