Init Config

This commit is contained in:
DerGrumpf
2026-04-03 23:37:52 +02:00
parent a8ec840d21
commit 62d3c12930
111 changed files with 5652 additions and 1 deletions

51
darwin/default.nix Normal file
View File

@@ -0,0 +1,51 @@
{ pkgs, inputs, self, primaryUser, ... }: {
imports = [ ./homebrew.nix ./settings.nix ./yabai.nix ];
# nix config
nix = {
settings = {
experimental-features = [ "nix-command" "flakes" ];
max-jobs = "auto"; # Use all CPU cores
cores = 0; # Use all cores per build
# disabled due to https://github.com/NixOS/nix/issues/7273
# auto-optimise-store = true;
};
enable = true; # using determinate installer
# Garbage collection
gc = {
automatic = true;
interval = { Weekday = 7; }; # Run weekly
options = "--delete-older-than 30d";
};
};
# Disable Docs
documentation = {
enable = true;
doc.enable = false; # Skip large documentation
man.enable = true; # Keep man pages
info.enable = false; # Skip info pages
};
nixpkgs.config = { allowUnfree = true; };
# homebrew installation manager
nix-homebrew = {
user = primaryUser;
enable = true;
autoMigrate = true;
};
# macOS-specific settings
programs.fish.enable = true;
environment.shells = [ pkgs.fish ];
system.primaryUser = primaryUser;
users.users.${primaryUser} = {
home = "/Users/${primaryUser}";
shell = pkgs.fish;
};
environment = {
systemPath = [ "/opt/homebrew/bin" ];
pathsToLink = [ "/Applications" ];
};
}

20
darwin/homebrew.nix Normal file
View File

@@ -0,0 +1,20 @@
{ ... }: {
homebrew = {
enable = true;
onActivation = {
autoUpdate = false;
upgrade = true;
cleanup = "zap";
};
caskArgs.no_quarantine = true;
global.brewfile = true;
# homebrew is best for GUI apps
# nixpkgs is best for CLI tools
casks = [ "element" "affinity" "onlyoffice" "tailscale" ];
brews = [ ];
taps = [ ];
};
}

76
darwin/settings.nix Normal file
View File

@@ -0,0 +1,76 @@
{ self, ... }: {
# touch ID for sudo
security.pam.services.sudo_local.touchIdAuth = true;
# system defaults and preferences
system = {
stateVersion = 6;
configurationRevision = self.rev or self.dirtyRev or null;
startup.chime = false;
activationScripts = {
setWallpaper.text = ''
/usr/bin/osascript <<EOF
tell application "System Events"
tell every desktop
set picture to "/Users/phil/Pictures/Wallpapers/Ghost_in_the_Shell.png"
end tell
end tell
EOF
'';
};
defaults = {
ActivityMonitor = {
IconType = 5;
OpenMainWindow = true;
ShowCategory = 101;
};
dock = {
enable-spring-load-actions-on-all-items = true;
appswitcher-all-displays = false;
autohide = false;
launchanim = true;
mru-spaces = false;
orientation = "left";
persistent-apps = [
{ app = "/Users/phil/Applications/Home Manager Apps/kitty.app"; }
{ app = "/Users/phil/Applications/Home Manager Apps/Vesktop.app"; }
{ app = "/Users/phil/Applications/Home Manager Apps/Spotify.app"; }
{ app = "/Users/phil/Applications/Home Manager Apps/Floorp.app"; }
{ app = "/Users/phil/Applications/Home Manager Apps/Obsidian.app"; }
{ app = "/Users/phil/Applications/Home Manager Apps/OpenSCAD.app"; }
{ app = "/Applications/okular.app"; }
{ app = "/Applications/Affinity.app"; }
{ app = "/System/Applications/Mail.app"; }
{ app = "/System/Applications/Launchpad.app"; }
];
show-recents = false;
mineffect = "genie";
};
loginwindow = {
GuestEnabled = false;
DisableConsoleAccess = true;
};
finder = {
AppleShowAllFiles = true; # hidden files
AppleShowAllExtensions = true; # file extensions
_FXShowPosixPathInTitle = true; # title bar full path
ShowPathbar = true; # breadcrumb nav at bottom
ShowStatusBar = true; # file count & disk space
};
NSGlobalDomain = {
NSAutomaticSpellingCorrectionEnabled = false;
NSAutomaticCapitalizationEnabled = false;
NSAutomaticPeriodSubstitutionEnabled = false;
NSAutomaticWindowAnimationsEnabled = false;
};
};
};
}

105
darwin/yabai.nix Normal file
View File

@@ -0,0 +1,105 @@
{ pkgs, ... }: {
services = {
yabai = {
enable = true;
config = {
external_bar = "main:40:0";
menubar_opacity = 1.0;
mouse_follows_focus = "on";
focus_follows_mouse = "on";
display_arrangement_order = "default";
window_origin_display = "default";
window_placement = "second_child";
window_insertion_point = "focused";
window_zoom_persist = "on";
window_shadow = "off";
window_animation_duration = 0.0;
window_animation_easing = "ease_out_circ";
window_opacity_duration = 0.0;
active_window_opacity = 1.0;
normal_window_opacity = 0.9;
window_opacity = "off";
insert_feedback_color = "0xffd75f5f";
split_ratio = 0.5;
split_type = "auto";
auto_balance = "off";
top_padding = 2;
bottom_padding = 2;
left_padding = 2;
right_padding = 2;
window_gap = 2;
layout = "bsp";
mouse_modifier = "fn";
mouse_action1 = "move";
mouse_action2 = "resize";
mouse_drop_action = "swap";
};
};
# skhd = {
# enable = true;
# skhdConfig = ''
# Application Bindings
# cmd - q : open -a kitty
# cmd - e : ${pkgs.kitty}/bin/kitty yazi
# cmd - o : open -a "Obsidian"
# cmd - i : open -a "Floorp"
# cmd - g : open -a "Mail"
# Window Management (using yabai if installed, otherwise basic macOS)
#cmd + shift - c : yabai -m window --close || osascript -e 'tell application "System Events" to keystroke "w" using command down'
#cmd + shift - v : yabai -m window --toggle float
# Focus windows (vim-like)
# cmd - left : yabai -m window --focus west
# cmd - right : yabai -m window --focus east
# cmd - up : yabai -m window --focus north
# cmd - down : yabai -m window --focus south
# Move windows to spaces (workspaces)
# cmd + shift - 1 : yabai -m window --space 1
# cmd + shift - 2 : yabai -m window --space 2
# cmd + shift - 3 : yabai -m window --space 3
# cmd + shift - 4 : yabai -m window --space 4
# cmd + shift - 5 : yabai -m window --space 5
# cmd + shift - 6 : yabai -m window --space 6
# cmd + shift - 7 : yabai -m window --space 7
# cmd + shift - 8 : yabai -m window --space 8
# cmd + shift - 9 : yabai -m window --space 9
# cmd + shift - 0 : yabai -m window --space 10
# Switch to spaces (workspaces)
# cmd - 1 : yabai -m space --focus 1
# cmd - 2 : yabai -m space --focus 2
# cmd - 3 : yabai -m space --focus 3
# cmd - 4 : yabai -m space --focus 4
# cmd - 5 : yabai -m space --focus 5
# cmd - 6 : yabai -m space --focus 6
# cmd - 7 : yabai -m space --focus 7
# cmd - 8 : yabai -m space --focus 8
# cmd - 9 : yabai -m space --focus 9
# cmd - 0 : yabai -m space --focus 10
# Screenshot (macOS native)
# cmd - z : screencapture -i ~/Pictures/Screenshots/$(date +%s).png
# cmd - u : screencapture ~/Pictures/Screenshots/$(date +%s).png
# Launcher (using Raycast or Spotlight as Rofi alternative)
# cmd - r : open -a "Raycast" || osascript -e 'tell application "System Events" to keystroke space using command down'
# Lock screen
# cmd - m : pmset displaysleepnow
# Toggle layout (if using yabai)
# cmd - j : yabai -m space --layout $(yabai -m query --spaces --space | jq -r 'if .type == "bsp" then "float" else "bsp" end')
# cmd - p : yabai -m window --toggle split
# Reload skhd config
# cmd + shift - r : skhd --reload
# '';
# };
};
}