init
This commit is contained in:
2025-08-04 15:37:38 +02:00
parent 3ae535f1b1
commit 703e3f8adf
57 changed files with 674 additions and 3283 deletions

View File

@@ -0,0 +1,74 @@
{
config,
pkgs,
lib,
home-manager,
user,
...
}:
{
imports = [
./dock
./system.nix
./homebrew.nix
./secrets.nix
];
users.users.${user} = {
name = "${user}";
home = "/Users/${user}";
isHidden = false;
shell = pkgs.fish;
};
home-manager = {
useGlobalPkgs = true;
users.${user} =
{
pkgs,
config,
lib,
...
}:
{
_module.args = { inherit user; };
imports = [
../base/home-manager/atuin.nix
../base/home-manager/bat.nix
../base/home-manager/eza.nix
../base/home-manager/fish.nix
../base/home-manager/ghostty.nix
../base/home-manager/git.nix
../base/home-manager/jujutsu.nix
../base/home-manager/ssh.nix
../base/home-manager/starship.nix
../base/home-manager/zoxide.nix
../base/home-manager/zsh.nix
];
home = {
packages = pkgs.callPackage ./packages.nix { };
stateVersion = "23.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,105 @@
{
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,8 @@
{ pkgs, ... }:
{
homebrew = {
enable = true;
masApps = { };
};
}

View File

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

View File

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

View File

@@ -0,0 +1,32 @@
{ 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 = false;
show-recents = false;
launchanim = true;
orientation = "bottom";
tilesize = 48;
};
finder = {
_FXShowPosixPathInTitle = false;
};
trackpad = {
Clicking = true;
TrackpadThreeFingerDrag = true;
};
};
}