init
init
This commit is contained in:
74
profiles/darwin/default.nix
Normal file
74
profiles/darwin/default.nix
Normal 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";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
105
profiles/darwin/dock/default.nix
Normal file
105
profiles/darwin/dock/default.nix
Normal 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
|
||||
'';
|
||||
}
|
||||
);
|
||||
}
|
||||
8
profiles/darwin/homebrew.nix
Normal file
8
profiles/darwin/homebrew.nix
Normal file
@@ -0,0 +1,8 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
homebrew = {
|
||||
enable = true;
|
||||
masApps = { };
|
||||
};
|
||||
}
|
||||
8
profiles/darwin/packages.nix
Normal file
8
profiles/darwin/packages.nix
Normal file
@@ -0,0 +1,8 @@
|
||||
{ pkgs }:
|
||||
|
||||
with pkgs;
|
||||
[
|
||||
_1password-gui
|
||||
dockutil
|
||||
raycast
|
||||
]
|
||||
13
profiles/darwin/secrets.nix
Normal file
13
profiles/darwin/secrets.nix
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
agenix,
|
||||
secrets,
|
||||
user,
|
||||
...
|
||||
}:
|
||||
{
|
||||
age.identityPaths = [
|
||||
"/Users/${user}/.ssh/id_ed25519"
|
||||
];
|
||||
}
|
||||
32
profiles/darwin/system.nix
Normal file
32
profiles/darwin/system.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user