This commit is contained in:
2025-08-12 17:56:16 +00:00
parent 2c4fb98fc7
commit ed7fc605b1
37 changed files with 12 additions and 13 deletions

View File

@@ -0,0 +1,72 @@
{
config,
pkgs,
nixvim,
user,
...
}: {
imports = [
./secrets.nix
./system.nix
./homebrew.nix
./dock
];
system = {
primaryUser = user;
stateVersion = 6;
};
nix.gc.interval = {
Weekday = 0;
Hour = 2;
Minute = 0;
};
users.users.${user} = {
name = "${user}";
home = "/Users/${user}";
isHidden = false;
shell = pkgs.fish;
};
home-manager = {
users.${user} = {
pkgs,
config,
lib,
...
}: {
_module.args = {inherit user;};
imports = [
nixvim.homeModules.nixvim
../base/home-manager
./home-manager/ghostty.nix
];
fonts.fontconfig.enable = true;
home = {
packages = pkgs.callPackage ../base/packages.nix {} ++ pkgs.callPackage ./packages.nix {};
stateVersion = "25.11";
};
};
};
local = {
dock = {
enable = true;
username = user;
entries = [
{path = "/Applications/Safari.app/";}
{path = "/${pkgs.ghostty-bin}/Applications/Ghostty.app/";}
{path = "/System/Applications/Notes.app/";}
{path = "/System/Applications/Music.app/";}
{path = "/System/Applications/System Settings.app/";}
{
path = "${config.users.users.${user}.home}/Downloads";
section = "others";
options = "--sort name --view grid --display stack";
}
];
};
};
}

View File

@@ -0,0 +1,104 @@
{
config,
pkgs,
lib,
...
}:
with lib; let
cfg = config.local.dock;
inherit (pkgs) stdenv dockutil;
in {
options = {
local.dock = {
enable = mkOption {
description = "Enable dock";
default = stdenv.isDarwin;
example = false;
};
entries = mkOption {
description = "Entries on the Dock";
type = with types;
listOf (submodule {
options = {
path = lib.mkOption {type = str;};
section = lib.mkOption {
type = str;
default = "apps";
};
options = lib.mkOption {
type = str;
default = "";
};
};
});
readOnly = true;
};
username = mkOption {
description = "Username to apply the dock settings to";
type = types.str;
};
};
};
config = mkIf cfg.enable (
let
normalize = path:
if hasSuffix ".app" path
then path + "/"
else path;
entryURI = path:
"file://"
+ (
builtins.replaceStrings
[
" "
"!"
"\""
"#"
"$"
"%"
"&"
"'"
"("
")"
]
[
"%20"
"%21"
"%22"
"%23"
"%24"
"%25"
"%26"
"%27"
"%28"
"%29"
]
(normalize path)
);
wantURIs = concatMapStrings (entry: "${entryURI entry.path}\n") cfg.entries;
createEntries =
concatMapStrings (
entry: "${dockutil}/bin/dockutil --no-restart --add '${entry.path}' --section ${entry.section} ${entry.options}\n"
)
cfg.entries;
in {
system.activationScripts.postActivation.text = ''
echo >&2 "Setting up the Dock for ${cfg.username}..."
su ${cfg.username} -s /bin/sh <<'USERBLOCK'
haveURIs="$(${dockutil}/bin/dockutil --list | ${pkgs.coreutils}/bin/cut -f2)"
if ! diff -wu <(echo -n "$haveURIs") <(echo -n '${wantURIs}') >&2 ; then
echo >&2 "Resetting Dock."
${dockutil}/bin/dockutil --no-restart --remove all
${createEntries}
killall Dock
else
echo >&2 "Dock setup complete."
fi
USERBLOCK
'';
}
);
}

View File

@@ -0,0 +1,26 @@
{pkgs, ...}: {
programs.ghostty = {
enable = true;
package = pkgs.ghostty-bin;
settings = {
command = "${pkgs.fish}/bin/fish";
theme = "catppuccin-latte";
window-padding-x = 8;
window-padding-y = 2;
window-padding-balance = true;
font-family = "Iosevka";
font-size = 15.5;
font-feature = [
"-calt"
"-dlig"
];
cursor-style = "block";
mouse-hide-while-typing = true;
mouse-scroll-multiplier = 1.25;
shell-integration = "detect";
shell-integration-features = "no-cursor";
clipboard-read = "allow";
clipboard-write = "allow";
};
};
}

View File

@@ -0,0 +1,11 @@
{
homebrew = {
enable = true;
casks = [
"orbstack"
];
masApps = {
"wipr2" = 1662217862;
};
};
}

View File

@@ -0,0 +1,8 @@
{pkgs}:
with pkgs; [
_1password-gui
dockutil
mas
raycast
whatsapp-for-mac
]

View File

@@ -0,0 +1,12 @@
{
config,
pkgs,
agenix,
secrets,
user,
...
}: {
age.identityPaths = [
"/Users/${user}/.ssh/id_ed25519"
];
}

30
modules/darwin/system.nix Normal file
View File

@@ -0,0 +1,30 @@
{lib, ...}: {
system.defaults = {
NSGlobalDomain = {
AppleShowAllExtensions = true;
ApplePressAndHoldEnabled = false;
KeyRepeat = 2;
InitialKeyRepeat = 15;
"com.apple.mouse.tapBehavior" = 1;
"com.apple.sound.beep.volume" = 0.0;
"com.apple.sound.beep.feedback" = 0;
};
dock = {
autohide = true;
show-recents = false;
launchanim = true;
orientation = "bottom";
tilesize = 60;
};
finder = {
_FXShowPosixPathInTitle = false;
};
trackpad = {
Clicking = true;
TrackpadThreeFingerDrag = true;
};
};
}