Files
bankrupt/darwin/configuration.nix
T
2026-01-18 23:17:17 +08:00

108 lines
2.7 KiB
Nix

# This is your nix-darwin configuration for macOS
# Use this to configure your macOS system environment
{
inputs,
lib,
config,
pkgs,
...
}: {
# You can import other darwin modules here
imports = [
# Shared configuration between NixOS and nix-darwin
../common.nix
# If you want to use modules your own flake exports (from modules/darwin):
# inputs.self.darwinModules.example
# You can also split up your configuration and import pieces of it here:
# ./brew.nix
# ./defaults.nix
];
# macOS-specific Nix settings (common.nix has the shared ones)
# Any darwin-specific nix configuration can go here
# Using Determinate Nix - disable nix-darwin's Nix daemon management
# Determinate manages its own daemon and conflicts with nix-darwin
nix.enable = false;
# TODO: Set your hostname
networking.hostName = "m2n1";
networking.computerName = "m2n1";
# Create /etc/zshrc that loads the nix-darwin environment
programs.zsh.enable = true;
programs.fish.enable = true;
# Used for backwards compatibility, please read the changelog before changing
# $ darwin-rebuild changelog
system.stateVersion = 4;
# The platform the configuration will be used on
nixpkgs.hostPlatform = "aarch64-darwin"; # or "x86_64-darwin"
# TODO: Configure your system-wide user settings (groups, etc)
users.users.df = {
name = "df";
home = "/Users/df";
};
# Set primary user for system defaults
system.primaryUser = "df";
# Allow darwin-rebuild switch without sudo password
environment.etc = {
"sudoers.d/10-nix-commands".text = let
commands = [
"/usr/bin/chsh"
"/run/current-system/sw/bin/darwin-rebuild"
"/run/current-system/sw/bin/nix*"
"/run/current-system/sw/bin/ln"
"/nix/store/*/activate"
"/bin/launchctl"
];
commandsString = builtins.concatStringsSep ", " commands;
in ''
%admin ALL=(ALL:ALL) NOPASSWD: ${commandsString}
'';
};
# System-wide packages
environment.systemPackages = with pkgs; [
vim
];
# macOS system defaults
system.defaults = {
dock = {
autohide = false;
orientation = "bottom";
showhidden = true;
mru-spaces = false;
};
finder = {
AppleShowAllExtensions = true;
FXEnableExtensionChangeWarning = false;
_FXShowPosixPathInTitle = true;
};
NSGlobalDomain = {
AppleShowAllExtensions = true;
InitialKeyRepeat = 14;
KeyRepeat = 1;
};
};
# Keyboard and trackpad settings
system.keyboard = {
enableKeyMapping = true;
remapCapsLockToControl = true;
};
# Security
security.pam.services.sudo_local.touchIdAuth = true;
}