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 411b718
Show file tree
Hide file tree
Showing 18 changed files with 579 additions and 114 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 = [ ];
};
};
}
38 changes: 38 additions & 0 deletions darwin/common/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{ self, pkgs, ... }:
let
theme = import "${self}/lib/theme" { inherit pkgs; };
in
{

imports = [ ];

fonts = {
packages = [
theme.fonts.default.package
theme.fonts.iconFont.package
theme.fonts.monospace.package
];
};

homebrew = {
brews = [ ];
casks = [
"1password"
"google-chrome"
"obsidian"
"rambox"
"raycast"
"signal"
"todoist"
"visual-studio-code"
"easy-move+resize"
];
masApps = { };
taps = [ ];
};

environment.systemPackages = with pkgs; [
openssh
];

}
214 changes: 214 additions & 0 deletions darwin/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
{
hostname,
inputs,
lib,
outputs,
pkgs,
platform,
self,
...
}:
let
basePackages = (import "${self}/host/common/base/packages.nix" { inherit pkgs lib; }).basePackages;
in
{
imports = [
./${hostname}
./common
];

environment = {
shells = [ pkgs.zsh ];
systemPackages =
basePackages
++ (with pkgs; [
m-cli
mas
plistwatch
yubikey-manager
]);
};

homebrew = {
enable = true;
onActivation = {
autoUpdate = true;
upgrade = true;
cleanup = "zap";
};
};

nixpkgs = {
hostPlatform = lib.mkDefault "${platform}";

overlays = [
# Add overlays your own flake exports (from overlays and pkgs dir):
outputs.overlays.additions
outputs.overlays.modifications
outputs.overlays.unstable-packages

# You can also add overlays exported from other flakes:
# neovim-nightly-overlay.overlays.default
inputs.agenix.overlays.default

# Or just specify overlays directly here, for example:
# (_: _: { embr = inputs.embr.packages."${pkgs.system}".embr; })
];

config = {
allowUnfree = true;
joypixels.acceptLicense = true;
};
};

nix = {
optimise.automatic = true;
settings = {
experimental-features = [
"nix-command"
"flakes"
];
warn-dirty = false;
};
};

networking.hostName = hostname;
networking.computerName = hostname;

# Enable TouchID for sudo authentication
security.pam.enableSudoTouchIdAuth = true;

services = {
activate-system.enable = true;
nix-daemon.enable = true;
tailscale.enable = true;
};

system = {
stateVersion = 5;

# activationScripts run every time you boot the system or execute `darwin-rebuild`
activationScripts = {
# reload the settings and apply them without the need to logout/login
postUserActivation.text = ''
/System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u
'';
};

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 = [
# "/Applications/Brave Browser.app"
# "/Applications/Wavebox.app"
# "/Users/${username}/Applications/Home Manager Apps/Telegram.app"
# "/Users/${username}/Applications/Home Manager Apps/Discord.app"
# "/Users/${username}/Applications/Home Manager Apps/Cinny.app"
# "/Applications/Halloy.app"
# "/Users/${username}/Applications/Home Manager Apps/Visual Studio Code.app"
# "/Users/${username}/Applications/Home Manager Apps/GitKraken.app"
# "/Users/${username}/Applications/Home Manager Apps/Alacritty.app"
# "/System/Applications/Music.app"
# "/Applications/Heynote.app"
# "/Applications/Joplin.app"
# "/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
};
};
};
}
6 changes: 6 additions & 0 deletions darwin/mars/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{ self, ... }:
{
imports = [
"${self}/darwin/common/aerospace.nix"
];
}
Loading

0 comments on commit 411b718

Please sign in to comment.