Skip to content

Commit

Permalink
Add Darwin profiles and configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
yousiki committed Mar 22, 2024
1 parent 435c584 commit c7a1967
Show file tree
Hide file tree
Showing 9 changed files with 262 additions and 12 deletions.
10 changes: 10 additions & 0 deletions cells/darwin/darwinConfigurations.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
inputs,
cell,
}: let
inherit (inputs.cells.common.lib) importConfigurations;
in
importConfigurations {
src = ./hosts;
args = {inherit inputs cell;};
}
10 changes: 10 additions & 0 deletions cells/darwin/darwinProfiles.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
inputs,
cell,
}: let
inherit (inputs.cells.common.lib) importProfiles;
in
importProfiles {
src = ./profiles;
args = {inherit inputs cell;};
}
77 changes: 77 additions & 0 deletions cells/darwin/hosts/sakamoto/applications.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{...}: {
# Homebrew casks.
homebrew.casks = [
"1password"
"adobe-creative-cloud"
"adrive"
"alt-tab"
"altserver"
"arc"
"baidunetdisk"
"balenaetcher"
"bilibili"
"brave-browser"
"cloudflare-warp"
"cyberduck"
"discord"
"element"
"feishu"
"firefox"
"font-caskaydia-cove-nerd-font"
"font-fira-code-nerd-font"
"font-jetbrains-mono-nerd-font"
"font-lxgw-bright"
"font-lxgw-wenkai"
"font-monaspace"
"github"
"google-chrome"
"google-drive"
"handbrake"
"hiddenbar"
"iina"
"itsycal"
"jetbrains-toolbox"
"keepingyouawake"
"keka"
"kitty"
"logitech-options"
"maccy"
"microsoft-auto-update"
"microsoft-office"
"microsoft-remote-desktop"
"miniconda"
"monitorcontrol"
"mos"
"motrix"
"mounty"
"neteasemusic"
"obs"
"obsidian"
"onyx"
"orbstack"
"plex"
"poe"
"qfinder-pro"
"qq"
"qsync-client"
"qudedup-extract-tool"
"raycast"
"rectangle"
"sioyek"
"spotify"
"squirrel"
"stats"
"steam"
"tailscale"
"tencent-meeting"
"transmission"
"visual-studio-code"
"warp"
"wechat"
"wezterm"
"xpra"
"xquartz"
"zed"
"zotero-beta"
];
}
28 changes: 28 additions & 0 deletions cells/darwin/hosts/sakamoto/configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
config,
lib,
pkgs,
...
}: {
networking.hostName = "sakamoto";
networking.computerName = "YouSikiMacBookPro";

users.users.yousiki = {
name = "yousiki";
home = "/Users/yousiki";
};

# Add ability to used TouchID for sudo authentication
security.pam.enableSudoTouchIdAuth = true;

# System configurations
system.defaults.NSGlobalDomain.ApplePressAndHoldEnabled = false;
system.defaults.NSGlobalDomain.AppleShowAllExtensions = true;
system.defaults.dock.show-recents = false;
system.defaults.dock.tilesize = 48;
system.defaults.finder.QuitMenuItem = true;
system.defaults.finder.ShowPathbar = true;
system.defaults.finder.ShowStatusBar = true;
system.defaults.trackpad.Clicking = true;
system.defaults.trackpad.TrackpadThreeFingerDrag = true;
}
57 changes: 57 additions & 0 deletions cells/darwin/hosts/sakamoto/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
inputs,
cell,
}: {
_module.specialArgs = {
inherit inputs;
};

imports = [
./applications.nix
./configuration.nix

inputs.cells.darwin.darwinProfiles.core
inputs.cells.darwin.darwinProfiles.homebrew

inputs.cells.home.homeProfiles.base

{
home-manager.users.yousiki = {
imports = [
inputs.cells.home.homeProfiles.catppuccin
inputs.cells.home.homeProfiles.core
inputs.cells.home.homeProfiles.languages
inputs.cells.home.homeProfiles.shell
inputs.cells.home.homeProfiles.ssh
];

bee.home-languages = [
"c"
"latex"
"nix"
"python"
"rust"
];

bee.home-catppuccin.flavor = "mocha";
};
}
];

bee = rec {
system = "x86_64-darwin";
darwin = inputs.darwin;
home = inputs.home-manager;
pkgs = import inputs.nixpkgs {
inherit system;
config = {
allowUnfree = true;
cudaSupport = true;
};
overlays = [
inputs.fenix.overlays.default
inputs.nvfetcher.overlays.default
];
};
};
}
15 changes: 15 additions & 0 deletions cells/darwin/profiles/core.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
inputs,
cell,
}: {...}: {
imports = [
inputs.cells.common.commonProfiles.core
];

services.activate-system.enable = true;
services.nix-daemon.enable = true;

# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = 4;
}
49 changes: 49 additions & 0 deletions cells/darwin/profiles/homebrew.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
inputs,
cell,
}: {pkgs, ...}: {
homebrew.enable = true;

# Upgrade and uninstall homebrew casks automatically.
homebrew.onActivation.autoUpdate = true;
homebrew.onActivation.upgrade = true;
homebrew.onActivation.cleanup = "uninstall";

# Set environment variables.
environment.variables = {
HOMEBREW_API_DOMAIN = "https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api";
HOMEBREW_BOTTLE_DOMAIN = "https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles";
HOMEBREW_BREW_GIT_REMOTE = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git";
HOMEBREW_CORE_GIT_REMOTE = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git";
HOMEBREW_PIP_INDEX_URL = "https://pypi.tuna.tsinghua.edu.cn/simple";
};

# Add taps.
homebrew.taps = [
"buo/cask-upgrade"
{
name = "homebrew/cask-fonts";
clone_target = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-fonts.git";
}
{
name = "homebrew/cask-versions";
clone_target = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-versions.git";
}
{
name = "homebrew/command-not-found";
clone_target = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-command-not-found.git";
}
{
name = "homebrew/services";
clone_target = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-services.git";
}
];

environment.systemPath =
if pkgs.system == "aarch64-darwin"
then [
"/opt/homebrew/bin"
"/opt/homebrew/sbin"
]
else [];
}
24 changes: 12 additions & 12 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@
(std.blockTypes.devshells "devshells")

(std.blockTypes.functions "commonProfiles")
(std.blockTypes.functions "darwinModules")
(std.blockTypes.functions "darwinProfiles")
(std.blockTypes.functions "homeModules")
(std.blockTypes.functions "homeProfiles")
(std.blockTypes.functions "nixosModules")
(std.blockTypes.functions "nixosProfiles")

hive.blockTypes.darwinConfigurations
hive.blockTypes.nixosConfigurations
];
}
Expand All @@ -44,6 +47,7 @@
nixosModules = hive.pick self [["nixos" "nixosModules"]];
}
{
darwinConfigurations = collect self "darwinConfigurations";
nixosConfigurations = collect self "nixosConfigurations";
};

Expand Down

0 comments on commit c7a1967

Please sign in to comment.