This commit is contained in:
2025-08-12 19:08:49 +00:00
parent f9a85fc581
commit 6cbfbd78c4
47 changed files with 188 additions and 175 deletions

View File

@@ -0,0 +1,78 @@
{
config,
pkgs,
nixvim,
user,
...
}: {
imports = [
../../core
../../networking/tailscale.nix
./secrets.nix
./system.nix
./homebrew.nix
./dock
];
system = {
primaryUser = user;
stateVersion = 6;
};
nix = {
settings.trusted-users = ["@admin" "${user}"];
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
../../home-manager/base
../../home-manager/darwin
];
fonts.fontconfig.enable = true;
home = {
packages = pkgs.callPackage ../../packages {}
++ 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,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,8 @@
{
user,
...
}: {
age.identityPaths = [
"/Users/${user}/.ssh/id_ed25519"
];
}

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;
};
};
}

View File

@@ -0,0 +1,74 @@
{
pkgs,
nixvim,
user,
sops-nix,
...
}: let
sshKeys = import ../../../shared/ssh-keys.nix;
in {
imports = [
../../core
../../networking/firewall.nix
../../networking/ssh.nix
./tailscale.nix
../../services/adguard.nix
sops-nix.nixosModules.sops
];
security.sudo.enable = true;
system.stateVersion = "25.11";
time.timeZone = "UTC";
nix = {
settings.trusted-users = ["${user}"];
gc.dates = "weekly";
nixPath = ["nixos-config=/home/${user}/.local/share/src/nixos-config:/etc/nixos"];
};
users.users = {
${user} = {
isNormalUser = true;
home = "/home/${user}";
extraGroups = [
"wheel"
"sudo"
"network"
"systemd-journal"
"docker"
];
shell = pkgs.fish;
openssh.authorizedKeys.keys = sshKeys.keys;
};
root = {
openssh.authorizedKeys.keys = sshKeys.keys;
};
};
home-manager = {
users.${user} = {
pkgs,
config,
lib,
...
}: {
_module.args = {inherit user;};
imports = [
nixvim.homeModules.nixvim
../../home-manager/base
../../home-manager/nixos
];
home = {
packages = pkgs.callPackage ../../packages {}
++ pkgs.callPackage ./packages.nix {};
stateVersion = "25.11";
};
};
};
}

View File

@@ -0,0 +1,4 @@
{pkgs}:
with pkgs; [
gcc15
]

View File

@@ -0,0 +1,8 @@
{
services.tailscale = {
enable = true;
port = 41641;
useRoutingFeatures = "server";
openFirewall = true;
};
}