finally set up some of nix-darwin

This commit is contained in:
mjallen18
2025-07-14 08:42:31 -05:00
parent 059e72584f
commit 58ba094456
9 changed files with 416 additions and 194 deletions

View File

@@ -1,76 +1,24 @@
{ pkgs, ... }:
{ config, inputs, pkgs, ... }:
{
#nix run nix-darwin -- switch --flake ~/nix-config
imports = [
./nix.nix
./homebrew.nix
./programs.nix
./system.nix
];
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
environment.systemPackages = with pkgs; [
asitop
mas
python3
python3Packages.beautifulsoup4
python3Packages.requests
python3Packages.selenium
vim
];
# Homebrew
homebrew.enable = true;
homebrew.casks = [
"spotify"
"protonvpn"
"omnissa-horizon-client"
"tg-pro"
"steam"
"orcaslicer"
"vscodium"
"epic-games"
"wine-stable"
"scroll-reverser"
];
homebrew.masApps = {
Tailscale = 1475387142;
Infuse = 1136220934;
Amphetamine = 937984704;
environment = {
systemPackages = with pkgs; [
asitop
mas
nh
];
};
# homebrew.global.autoUpdate = true;
security.pam.services.sudo_local.touchIdAuth = true;
# Auto upgrade nix package and the daemon service.
# services.nix-daemon.enable = true;
# nix.package = pkgs.nix;
# Necessary for using flakes on this system.
nix.settings.experimental-features = "nix-command flakes";
# Allow unfree
nixpkgs.config.allowUnfree = true;
# Create /etc/zshrc that loads the nix-darwin environment.
programs.zsh.enable = true; # default shell on catalina
system = {
defaults = {
trackpad.Clicking = true;
dock.autohide = false;
NSGlobalDomain = {
AppleInterfaceStyle = "Dark";
"com.apple.mouse.tapBehavior" = 1;
"com.apple.keyboard.fnState" = false;
};
};
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
stateVersion = 5;
};
# The platform the configuration will be used on.
nixpkgs.hostPlatform = "aarch64-darwin";
users.users.mattjallen = {
name = "mattjallen";
home = "/Users/mattjallen";

View File

@@ -1,111 +1,59 @@
{ ... }:
{ lib, pkgs, home, ... }:
let
shellAliases = {
update-switch = "darwin-rebuild switch --flake ~/nix-config";
update-flake = "nix flake update ~/nix-config";
ducks = "du -cksh * | sort -hr | head -n 15";
};
gitAliases = {
co = "checkout";
ci = "commit";
cia = "commit --amend";
s = "status";
st = "status";
b = "branch";
p = "pull --rebase";
pu = "push";
};
packages = with pkgs; [
age
cpufetch
deadnix
direnv
nixfmt-rfc-style
sops
tree
wget
];
in
{
imports = [ ./trampoline-apps ];
imports = [
../../modules/home/defaults.nix
../../modules/home/git.nix
../../modules/home/shell.nix
../../modules/home/vscode.nix
];
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = "mattjallen";
home.homeDirectory = "/Users/mattjallen";
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
# incompatible changes.
#
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
home.stateVersion = "23.11";
programs = {
# Let Home Manager install and manage itself.
home-manager = {
enable = true;
};
vscode = {
enable = true;
};
btop.enable = true;
zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
shellAliases = shellAliases;
oh-my-zsh = {
enable = true;
plugins = [ "git" ];
theme = "fishy";
};
};
librewolf = {
enable = true;
settings = {
"identity.fxaccounts.enabled" = true; # Enable Firefox Accounts
"privacy.clearOnShutdown.history" = false; # Disable clearing history on shutdown
"privacy.clearOnShutdown.downloads" = false; # Disable clearing downloads on shutdown
"privacy.clearOnShutdown.cache" = false; # Disable clearing cache on shutdown
"privacy.clearOnShutdown.cookiesAndStorage" = false; # Disable clearing cookies and storage on shutdown
"privacy.clearOnShutdown.cookies" = false; # Disable clearing cookies on shutdown
"privacy.clearOnShutdown_v2.cache" = false; # Disable clearing cache on shutdown
"privacy.clearOnShutdown_v2.cookiesAndStorage" = false; # Disable clearing cookies and storage on shutdown
"privacy.clearOnShutdown.formdata" = false; # Disable clearing form data on shutdown
"privacy.clearOnShutdown.offlineApps" = false; # Disable clearing offline apps on shutdown
"privacy.clearHistory.cache" = false; # Disable clearing cache on history clear
"privacy.clearHistory.cookiesAndStorage" = false; # Disable clearing cookies on history clear
"privacy.clearHistory.historyFormDataAndDownloads" = false; # Disable clearing history, form data, and downloads on history clear
"privacy.clearHistory.browsingHistoryAndDownloads" = false; # Disable clearing browsing history and downloads on history clear
"privacy.clearSiteData.cache" = false; # Disable clearing cache on site data clear
"privacy.clearSiteData.cookiesAndStorage" = false; # Disable clearing cookies on site data clear
"services.sync.prefs.sync.privacy.clearOnShutdown.cache" = true; # Enable syncing cache clear on shutdown
"services.sync.prefs.sync.privacy.clearOnShutdown.cookies" = true; # Enable syncing cookies clear on shutdown
"services.sync.prefs.sync.privacy.clearOnShutdown.downloads" = true; # Enable syncing downloads clear on shutdown
"services.sync.prefs.sync.privacy.clearOnShutdown.formdata" = true; # Enable syncing form data clear on shutdown
"services.sync.prefs.sync.privacy.clearOnShutdown.history" = true; # Enable syncing history clear on shutdown
"services.sync.prefs.sync.privacy.clearOnShutdown.offlineApps" = true; # Enable syncing offline apps clear on shutdown
"services.sync.prefs.sync.privacy.clearOnShutdown.sessions" = true; # Enable syncing sessions clear on shutdown
"services.sync.prefs.sync.privacy.clearOnShutdown.siteSettings" = true; # Enable syncing site settings clear on shutdown
"services.sync.prefs.sync.privacy.clearOnShutdown_v2.cache" = true; # Enable syncing cache clear on shutdown
"services.sync.prefs.sync.privacy.clearOnShutdown_v2.cookiesAndStorage" = true; # Enable syncing cookies clear on shutdown
"services.sync.prefs.sync.privacy.clearOnShutdown_v2.downloads" = true; # Enable syncing downloads clear on shutdown
"services.sync.prefs.sync.privacy.clearOnShutdown_v2.historyFormDataAndDownloads" = true; # Enable syncing form data clear on shutdown
"services.sync.prefs.sync.privacy.clearOnShutdown_v2.siteSettings" = true; # Enable syncing site settings clear on shutdown
"browser.newtabpage.activity-stream.feeds.topsites" = true; # Enable top sites on new tab page
"browser.newtabpage.activity-stream.topSitesRows" = 3; # Set number of rows for top sites on new tab page
};
home = {
username = "mattjallen";
homeDirectory = "/Users/mattjallen";
packages = lib.mkForce packages;
sessionVariables = {
NH_DARWIN_FLAKE = "${home.homeDirectory}/nix-config";
};
};
programs.git = {
enable = true;
userName = "mjallen18";
userEmail = "matt.l.jallen@gmail.com";
aliases = gitAliases;
programs = {
zsh = {
shellAliases = shellAliases;
};
};
# Manage bug in compilations - who uses manpages in 2024 anyways? :P
manual.manpages.enable = false;
# Override defaults that arent supported
programs = {
mangohud.enable = lib.mkForce false;
nh = {
flake = "${home.homeDirectory}/nix-config";
};
};
services = {
pass-secret-service.enable = lib.mkForce false;
nextcloud-client.enable = lib.mkForce false;
};
}

65
hosts/mac/homebrew.nix Normal file
View File

@@ -0,0 +1,65 @@
{ config, inputs, ... }:
{
nix-homebrew = {
user = config.system.primaryUser;
enable = true;
autoMigrate = true;
enableRosetta = true;
mutableTaps = false;
taps = {
"homebrew/homebrew-core" = inputs.homebrew-core;
"homebrew/homebrew-cask" = inputs.homebrew-cask;
};
};
# Homebrew
homebrew = {
enable = true;
taps = builtins.attrNames config.nix-homebrew.taps;
global = {
autoUpdate = false;
brewfile = true;
};
onActivation = {
autoUpdate = false;
cleanup = "zap";
};
casks = [
"aldente"
"bartender"
"betterdisplay"
"chromium"
"discord"
"epic-games"
"gstreamer-runtime"
"iterm2"
"kitty"
"minecraft"
"omnissa-horizon-client"
"onlyoffice"
"orcaslicer"
"proton-drive"
"proton-pass"
"protonvpn"
"scroll-reverser"
"steam"
"tabby"
"tg-pro"
"utm"
"vesktop"
"vlc"
"vscodium"
"wine-stable"
"xquartz"
];
masApps = {
Amphetamine = 937984704;
Infuse = 1136220934;
"Proton Pass for Safari" = 6502835663;
Tailscale = 1475387142;
Termius = 1176074088;
};
};
# homebrew.global.autoUpdate = true;
}

17
hosts/mac/nix.nix Normal file
View File

@@ -0,0 +1,17 @@
{ ... }:
{
# Auto upgrade nix package and the daemon service.
# services.nix-daemon.enable = true;
# nix.package = pkgs.nix;
# Necessary for using flakes on this system.
nix = {
settings.experimental-features = "nix-command flakes";
};
# The platform the configuration will be used on.
nixpkgs = {
config.allowUnfree = true;
hostPlatform = "aarch64-darwin";
};
}

24
hosts/mac/programs.nix Normal file
View File

@@ -0,0 +1,24 @@
{ ... }:
{
programs = {
direnv = {
enable = true;
nix-direnv.enable = true;
};
nix-index = {
enable = true;
};
ssh.knownHosts = {
desktop = {
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPTBMydhOc6SnOdB5WrEd7X07DrboAtagCUgXiOJjLov matt@matt-nixos";
};
nas = {
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIwoHWOLSTGVif9hAhaMLl0qDA4roIzCNuyR6kyIXDOj admin@jallen-nas";
};
};
zsh.enable = true; # default shell on catalina
};
}

50
hosts/mac/system.nix Normal file
View File

@@ -0,0 +1,50 @@
{ config, ... }:
{
system = {
primaryUser = config.users.users.mattjallen.name;
defaults = {
controlcenter = {
AirDrop = true;
BatteryShowPercentage = true;
Bluetooth = true;
Display = true;
FocusModes = true;
NowPlaying = true;
};
dock = {
minimize-to-application = true;
mouse-over-hilite-stack = true;
show-recents = false;
};
finder = {
AppleShowAllExtensions = true;
AppleShowAllFiles = true;
_FXSortFoldersFirst = true;
_FXSortFoldersFirstOnDesktop = true;
FXEnableExtensionChangeWarning = false;
ShowPathbar = true; # breadcrumb nav at bottom
ShowStatusBar = true; # file count & disk space
};
loginwindow = {
GuestEnabled = false;
};
NSGlobalDomain = {
"com.apple.keyboard.fnState" = false;
AppleInterfaceStyle = "Dark";
"com.apple.mouse.tapBehavior" = 1;
AppleShowAllExtensions = true;
AppleShowAllFiles = true;
};
trackpad = {
Clicking = true;
};
WindowManager = {
EnableTiledWindowMargins = false;
};
};
startup.chime = false;
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
stateVersion = 5;
};
}