Skip to content

Commit

Permalink
Merge pull request #6 from michaelvanstraten/add-darwin-config-for-pe…
Browse files Browse the repository at this point in the history
…rsonal-macbook

Add darwin config for personal macbook
  • Loading branch information
michaelvanstraten authored Sep 1, 2024
2 parents fdecf62 + 52637d3 commit 3bcdbea
Show file tree
Hide file tree
Showing 22 changed files with 588 additions and 0 deletions.
32 changes: 32 additions & 0 deletions darwin/hosts/personal-macbook-pro.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{ pkgs, ... }:
{
imports = [
../modules/nix.nix
../modules/skhd.nix
../modules/system.nix
../modules/yabai.nix
../modules/shells.nix
../modules/home-manager.nix
../modules/packages.nix
];

nixpkgs = {
config.allowUnfree = true;
};

users.users.michaelvanstraten = {
createHome = true;
description = "Michael van Straten";
home = "/Users/michaelvanstraten/";
name = "michaelvanstraten";
shell = pkgs.fish;
};

system.stateVersion = 4;

security.pam.enableSudoTouchIdAuth = true;

home-manager.users.michaelvanstraten = import ../../dotfiles/michael;

environment.systemPackages = with pkgs; [ darwin.trash ];
}
4 changes: 4 additions & 0 deletions darwin/modules/fonts.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ pkgs, ... }:
{
fonts.packages = [ pkgs.nerdfonts ];
}
12 changes: 12 additions & 0 deletions darwin/modules/home-manager.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{ inputs, ... }:
{
home-manager = {
backupFileExtension = "before-home-manager";
extraSpecialArgs = {
inherit inputs;
};
useGlobalPkgs = true;
useUserPackages = true;
verbose = true;
};
}
37 changes: 37 additions & 0 deletions darwin/modules/nix.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
inputs,
pkgs,
lib,
...
}:
{
nix = {
distributedBuilds = true;
linux-builder = {
enable = true;
systems = [
"aarch64-linux"
"i686-linux"
"x86_64-linux"
];
};
settings = {
experimental-features = [
"nix-command"
"flakes"
"repl-flake"
];
trusted-users = [ "@admin" ];
};
extraOptions = lib.mkIf pkgs.stdenv.hostPlatform.isAarch64 ''
extra-platforms = x86_64-darwin aarch64-darwin
'';
};

services.nix-daemon.enable = true;

nixpkgs = {
source = inputs.nixpkgs;
};

}
18 changes: 18 additions & 0 deletions darwin/modules/packages.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{ inputs, pkgs, ... }:
{
nixpkgs = {
overlays = with inputs; [ nixpkgs-firefox-darwin.overlay ];
};

environment.systemPackages = with pkgs; [
monitorcontrol
unnaturalscrollwheels

alacritty

vscodium

firefox-bin
# chromium
];
}
8 changes: 8 additions & 0 deletions darwin/modules/shells.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{ config, lib, ... }:
{
environment.shells = lib.mapAttrsToList (_: user: user.shell) config.users.users;

programs.bash.enable = true;
programs.fish.enable = true;
programs.zsh.enable = true;
}
20 changes: 20 additions & 0 deletions darwin/modules/skhd.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{ ... }:
{
services.skhd.enable = false;
services.skhd.skhdConfig = ''
# focus windows using hjkl
alt + ctrl - h : yabai -m window --focus west
alt + ctrl - l : yabai -m window --focus east
alt + ctrl - k : yabai -m window --focus north
alt + ctrl - j : yabai -m window --focus south
# toggle float of window
alt + ctrl - t : yabai -m window --toggle float
# swap windows using hjkl
shift + alt + ctrl - h : yabai -m window --swap west
shift + alt + ctrl - l : yabai -m window --swap east
shift + alt + ctrl - k : yabai -m window --swap north
shift + alt + ctrl - j : yabai -m window --swap south
'';
}
26 changes: 26 additions & 0 deletions darwin/modules/system.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{ ... }:
{
system.defaults = {
# Automatically hide and show the Dock
dock.autohide = true;
# Set Dock auto hide time modifier
dock.autohide-time-modifier = 0.7;
# Disable most recently used spaces in Dock
dock.mru-spaces = false;
# Make Dock icons of hidden applications translucent
dock.showhidden = true;
# Don't show recent applications in the dock.
dock.show-recents = false;
dock.persistent-apps = [
"/System/Applications/Mail.app/"
"/Applications/Bitwarden.app/"
"/System/Applications/Messages.app/"
"/Applications/WhatsApp.app/"
"/System/Applications/Calendar.app/"
"/System/Applications/Reminders.app/"
"/Applications/Alacritty.app/"
"/Applications/Firefox Nightly.app/"
"/System/Applications/System Settings.app/"
];
};
}
22 changes: 22 additions & 0 deletions darwin/modules/yabai.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{ ... }:
{
services.yabai.config = {
# use bsp layout
layout = "bsp";

# put new windows always to the right of the current one
window_placement = "second_child";

# window padding
top_padding = 12;
bottom_padding = 12;
left_padding = 12;
right_padding = 12;
window_gap = 12;

extraConfig = ''
# apps to not manage by default
yabai -m rule --add app!="^(Firefox|Skim|Firefox Nightly|Alacritty)$" manage=off
'';
};
}
58 changes: 58 additions & 0 deletions dotfiles/michael/alacritty.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{ inputs, ... }:
{
programs.alacritty = {
enable = true;
settings = {
import = [ "${inputs.cyberdream-theme}/extras/alacritty/cyberdream.toml" ];
font = {
size = 14;
normal = {
family = "JetBrainsMono Nerd Font";
style = "Medium";
};
italic = {
family = "JetBrainsMono Nerd Font";
style = "Medium Italic";
};
bold = {
family = "JetBrainsMono Nerd Font";
style = "Heavy";
};
bold_italic = {
family = "JetBrainsMono Nerd Font";
style = "Heavy Italic";
};
};
selection = {
save_to_clipboard = true;
};
window = {
decorations = "Transparent";
dynamic_padding = true;
opacity = 0.87;
blur = true;

dimensions = {
columns = 128;
lines = 38;
};
padding = {
x = 18;
y = 16;
};
};
keyboard.bindings = [
{
key = "A";
mods = "Command";
chars = "\\u0001";
}
{
key = "S";
mods = "Command";
chars = "\\u0001S";
}
];
};
};
}
57 changes: 57 additions & 0 deletions dotfiles/michael/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{ inputs, pkgs, ... }:
{
imports = [
./tmux
./vscode.nix
./starship.nix
./poetry.nix
./lazygit.nix
./git.nix
./alacritty.nix
./sesh.nix
./shells
];

xdg.enable = true;

home.packages = with pkgs; [
wget
inputs.neovim-nightly-overlay.packages.${pkgs.system}.default
nil
stylua
lua-language-server
nixfmt-rfc-style
firefox-bin
ltex-ls
podman
podman-compose
nodejs_22
tree-sitter
];

home.sessionVariables = {
EDITOR = "nvim";
};

programs.home-manager.enable = true;

home.stateVersion = "24.05";

programs.git = {
userName = "Michael van Straten";
userEmail = "[email protected]";
};

programs.eza.enable = true;

programs.bat.enable = true;

programs.zoxide.enable = true;
programs.zoxide.options = [ "--cmd cd" ];

programs.thefuck.enable = true;

programs.jq.enable = true;

programs.sesh.enable = true;
}
33 changes: 33 additions & 0 deletions dotfiles/michael/git.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{ ... }:
{
programs.git = {
enable = true;

ignores = [
".DS_Store"
".vscode/"
".venv/"
];

extraConfig = {
init.defaultBranch = "master";
core = {
ignorecase = false;
};
pull.rebase = true;
push.default = "current";
fetch = {
prune = true;
writeCommitGraph = true;
};
rerere = {
enabled = true;
};
branch = {
sort = "-committerdate";
};
};
};

programs.git.lfs.enable = true;
}
30 changes: 30 additions & 0 deletions dotfiles/michael/lazygit.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{ ... }:
{
programs.lazygit = {
enable = true;
settings = {
gui = {
scrollPastBottom = false;
expandFocusedSidePanel = true;
showCommandLog = true;
skipRewordInEditorWarning = true;
};

git = {
paging.useConfig = false;
autoFetch = false;
autoRefresh = true;
fetchAll = true;
parseEmoji = true;
};

os = {
editPreset = "nvim";
};

disableStartupPopups = true;
notARepository = "skip";
promptToReturnFromSubprocess = false;
};
};
}
10 changes: 10 additions & 0 deletions dotfiles/michael/poetry.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{ ... }:
{
programs.poetry = {
enable = true;
settings = {
virtualenvs.create = true;
virtualenvs.in-project = true;
};
};
}
Loading

0 comments on commit 3bcdbea

Please sign in to comment.