Compare commits
8 commits
af6c06e82f
...
cc173b20b9
| Author | SHA1 | Date | |
|---|---|---|---|
| cc173b20b9 | |||
| beb8aa1303 | |||
| c592c01f6e | |||
| 88873d06f2 | |||
| 5866fd41de | |||
| dafe6c0625 | |||
| 8b173560bf | |||
| e0184ead26 |
7 changed files with 168 additions and 12 deletions
|
|
@ -16,6 +16,7 @@ in {
|
||||||
./../programs/lsd.nix
|
./../programs/lsd.nix
|
||||||
./../programs/neovim.nix
|
./../programs/neovim.nix
|
||||||
./../programs/starship.nix
|
./../programs/starship.nix
|
||||||
|
./../programs/yt-dlp.nix
|
||||||
];
|
];
|
||||||
home = {
|
home = {
|
||||||
stateVersion = "23.11";
|
stateVersion = "23.11";
|
||||||
|
|
@ -107,7 +108,6 @@ in {
|
||||||
gh.enable = true;
|
gh.enable = true;
|
||||||
gpg.enable = true;
|
gpg.enable = true;
|
||||||
pandoc.enable = true;
|
pandoc.enable = true;
|
||||||
yt-dlp.enable = true;
|
|
||||||
};
|
};
|
||||||
xdg = {
|
xdg = {
|
||||||
dataFile = { "julia/config/startup.jl".source = ./../dotfiles/startup.jl; };
|
dataFile = { "julia/config/startup.jl".source = ./../dotfiles/startup.jl; };
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,10 @@
|
||||||
{ config, lib, pkgs, pkgs-unstable, ... }: {
|
{ config, lib, pkgs, pkgs-unstable, ... }: {
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
./../modules/defaults.nix
|
||||||
|
./../programs/alttab.nix
|
||||||
|
./../programs/taskbar.nix
|
||||||
|
];
|
||||||
home = {
|
home = {
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
asitop
|
asitop
|
||||||
|
|
|
||||||
93
modules/defaults.nix
Normal file
93
modules/defaults.nix
Normal file
|
|
@ -0,0 +1,93 @@
|
||||||
|
# WARNING: This module was "vibe coded" by Claude Sonnet 4.5 Thinking
|
||||||
|
# Nix modules are mostly boilerplace, so the logic is (mostly) mine, and the
|
||||||
|
# rest comes from Claude. For reference, here was my prompt:
|
||||||
|
#
|
||||||
|
# I would like to write a new module for managing MacOS apps via the `defaults`
|
||||||
|
# cli. Ideally, the syntax that I want to include in my home-manager config
|
||||||
|
# should look like:
|
||||||
|
#
|
||||||
|
# ```nix
|
||||||
|
# darwin-defaults = {
|
||||||
|
# "com.fpfxtknjju.wbgcdolfev" = {
|
||||||
|
# centerTasksAndButtons = false;
|
||||||
|
# pinList = [
|
||||||
|
# { action = "finderNewWindow"; bundleIdentifier = "com.apple.finder"; }
|
||||||
|
# { action = "firefoxNewWindow"; bundleIdentifier = "org.mozilla.firefox"; }
|
||||||
|
# { action = "launchOrActivateApp"; bundleIdentifier = "com.electron.logseq"; }
|
||||||
|
# ];
|
||||||
|
# };
|
||||||
|
# "com.lwouis.alt-tab-macos" = {
|
||||||
|
# screenRecordingPermissionSkipped = true;
|
||||||
|
# nextWindowGesture = 1;
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
# ```
|
||||||
|
#
|
||||||
|
# This should be fairly easy to implement, as `defaults` accepts (escaped) plist
|
||||||
|
# strings, and Nix provides lib.generators.toPlist. Can you help me write the
|
||||||
|
# module, please?
|
||||||
|
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
let
|
||||||
|
inherit (pkgs.stdenv.hostPlatform) isDarwin;
|
||||||
|
inherit (lib) mkOption types mkIf;
|
||||||
|
inherit (lib.generators) toPlist;
|
||||||
|
|
||||||
|
cfg = config.defaults;
|
||||||
|
|
||||||
|
# Convert domain settings to defaults import command
|
||||||
|
domainToScript = domain: settings:
|
||||||
|
let
|
||||||
|
plistContent = toPlist { escape = true; } settings;
|
||||||
|
escapedDomain = lib.escapeShellArg domain;
|
||||||
|
in ''
|
||||||
|
$DRY_RUN_CMD echo "Applying defaults for ${domain}..."
|
||||||
|
$DRY_RUN_CMD /usr/bin/defaults import -app ${escapedDomain} - <<'EOF'
|
||||||
|
${plistContent}
|
||||||
|
EOF
|
||||||
|
$DRY_RUN_CMD killall ${escapedDomain} && open -a ${escapedDomain}
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Generate all activation scripts
|
||||||
|
activationScript =
|
||||||
|
lib.concatStringsSep "\n" (lib.mapAttrsToList domainToScript cfg);
|
||||||
|
|
||||||
|
in {
|
||||||
|
options.defaults = mkOption {
|
||||||
|
type = types.attrsOf (types.attrsOf types.anything);
|
||||||
|
default = { };
|
||||||
|
description = ''
|
||||||
|
Configuration for macOS defaults by domain.
|
||||||
|
|
||||||
|
Each attribute set key represents a domain (typically an app bundle identifier),
|
||||||
|
and its value is an attribute set of preference keys and values that will be
|
||||||
|
converted to a plist and imported using the `defaults` command.
|
||||||
|
|
||||||
|
This module only works on macOS (Darwin) systems.
|
||||||
|
'';
|
||||||
|
example = lib.literalExpression ''
|
||||||
|
{
|
||||||
|
"com.apple.dock" = {
|
||||||
|
autohide = true;
|
||||||
|
tilesize = 48;
|
||||||
|
orientation = "left";
|
||||||
|
};
|
||||||
|
"com.apple.finder" = {
|
||||||
|
AppleShowAllFiles = true;
|
||||||
|
ShowPathbar = true;
|
||||||
|
FXEnableExtensionChangeWarning = false;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf (isDarwin && cfg != { }) {
|
||||||
|
home.activation.defaults = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||||
|
if [[ -x /usr/bin/defaults ]]; then
|
||||||
|
${activationScript}
|
||||||
|
else
|
||||||
|
echo "Warning: /usr/bin/defaults not found. Skipping darwin-defaults configuration."
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
10
programs/alttab.nix
Normal file
10
programs/alttab.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{ ... }: {
|
||||||
|
defaults."AltTab" = {
|
||||||
|
appearanceStyle = 0;
|
||||||
|
nextWindowGesture = 1;
|
||||||
|
screenRecordingPermissionSkipped = true;
|
||||||
|
showFullscreenWindows = 0;
|
||||||
|
showHiddenWindows = 1;
|
||||||
|
updatePolicy = 2;
|
||||||
|
};
|
||||||
|
}
|
||||||
49
programs/taskbar.nix
Normal file
49
programs/taskbar.nix
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
{ ... }: {
|
||||||
|
defaults."Taskbar" = {
|
||||||
|
centerTasksAndButtons = false;
|
||||||
|
hideReviewOptions = true;
|
||||||
|
permissionsResetOnce = true;
|
||||||
|
pinList = [
|
||||||
|
{
|
||||||
|
action = "finderNewWindow";
|
||||||
|
bundleIdentifier = "com.apple.finder";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
action = "launchOrActivateApp";
|
||||||
|
bundleIdentifier = "com.apple.AppStore";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
action = "firefoxNewWindow";
|
||||||
|
bundleIdentifier = "org.mozilla.firefox";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
action = "launchOrActivateApp";
|
||||||
|
bundleIdentifier = "com.apple.systempreferences";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
action = "launchOrActivateApp";
|
||||||
|
bundleIdentifier = "com.electron.logseq";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
action = "launchOrActivateApp";
|
||||||
|
bundleIdentifier = "org.mozilla.thunderbird";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
action = "launchOrActivateApp";
|
||||||
|
bundleIdentifier =
|
||||||
|
"com.apple.Safari.WebApp.2F51A6D0-087A-438F-92D3-A73FE09CB4CC";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
action = "launchOrActivateApp";
|
||||||
|
bundleIdentifier =
|
||||||
|
"com.apple.Safari.WebApp.5EC6478E-03A6-4147-8A4D-6EF3DE3F06D3";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
sendCrashReports = true;
|
||||||
|
showMenubarIcon = false;
|
||||||
|
showThumbnails = true;
|
||||||
|
showWindowTitleInThumbails = true;
|
||||||
|
taskViewMaxWidth = 200;
|
||||||
|
updatePolicy = 0;
|
||||||
|
};
|
||||||
|
}
|
||||||
6
programs/yt-dlp.nix
Normal file
6
programs/yt-dlp.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{ pkgs-unstable, ... }: {
|
||||||
|
programs.yt-dlp = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs-unstable.yt-dlp;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -39,9 +39,10 @@ in {
|
||||||
system.primaryUser = "millironx";
|
system.primaryUser = "millironx";
|
||||||
|
|
||||||
system.defaults.dock = {
|
system.defaults.dock = {
|
||||||
autohide = false;
|
autohide = true;
|
||||||
minimize-to-application = true;
|
minimize-to-application = true;
|
||||||
mru-spaces = false;
|
mru-spaces = false;
|
||||||
|
orientation = "left";
|
||||||
persistent-apps = let
|
persistent-apps = let
|
||||||
dedupDotApp = appName:
|
dedupDotApp = appName:
|
||||||
if pkgs.lib.strings.hasSuffix ".app" appName then
|
if pkgs.lib.strings.hasSuffix ".app" appName then
|
||||||
|
|
@ -69,20 +70,10 @@ in {
|
||||||
};
|
};
|
||||||
in [
|
in [
|
||||||
(sysApp "Firefox")
|
(sysApp "Firefox")
|
||||||
(chromeApp "Messages")
|
|
||||||
(sysApp "Signal")
|
|
||||||
(sysApp "Thunderbird")
|
(sysApp "Thunderbird")
|
||||||
(localApp "Immich")
|
|
||||||
(sysApp "Logseq")
|
(sysApp "Logseq")
|
||||||
(sysApp "Zed")
|
(sysApp "Zed")
|
||||||
(sysApp "Steam")
|
(sysApp "Steam")
|
||||||
(sysApp "Amperfy")
|
|
||||||
(sysApp "Microsoft Word")
|
|
||||||
(sysApp "Microsoft Excel")
|
|
||||||
(sysApp "Microsoft PowerPoint")
|
|
||||||
(localApp "Canvas")
|
|
||||||
(sysApp "Zotero")
|
|
||||||
(localApp "VetPrep")
|
|
||||||
(chromeApp "Instinct Dashboard")
|
(chromeApp "Instinct Dashboard")
|
||||||
(chromeApp "Carestream")
|
(chromeApp "Carestream")
|
||||||
];
|
];
|
||||||
|
|
@ -213,6 +204,7 @@ in {
|
||||||
"slack"
|
"slack"
|
||||||
"stats"
|
"stats"
|
||||||
"steam"
|
"steam"
|
||||||
|
"taskbar"
|
||||||
"textmate"
|
"textmate"
|
||||||
"thunderbird@esr"
|
"thunderbird@esr"
|
||||||
"ungoogled-chromium"
|
"ungoogled-chromium"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue