restructed modules for home and work, untested

This commit is contained in:
2026-11-09 10:58:31 -05:00
parent 10bac6ed32
commit b3f749f8bf
13 changed files with 116 additions and 44 deletions

52
modules/base.nix Normal file
View File

@@ -0,0 +1,52 @@
{ ... }:
{
imports = [
./cli-tools.nix
./mac-settings.nix
./pkg-installs.nix
]
nixpkgs.hostPlatform = "aarch64-darwin";
nix.settings.experimental-features = "nix-command flakes";
system.stateVersion = 6;
system.primaryUser = "briannelson";
environment.systemPackages = with pkgs; [
exif
exiftool
git
helix
];
homebrew = {
enable = true;
onActivation = {
autoUpdate = true;
cleanup = "none";
};
brews = [
"bun"
"defaultbrowser"
"harper"
"rust"
"ykman"
];
casks = [
"bitwarden"
"harper-desktop"
"nextcloud"
"obsidian"
"signal"
"task-manager-tmog"
"twingate"
"vlc"
"vscodium"
"firefox"
];
};
}

19
modules/cli-tools.nix Normal file
View File

@@ -0,0 +1,19 @@
{ ... }:
{
environment.shellAliases = {
ll = "ls -la";
};
environment.etc."gitconfig".text = ''
[user]
name = Brian Nelson
email = brian@briannelson.dev
[init]
defaultBranch = main
[credential]
helper = osxkeychain
'';
environment.variables.GIT_CONFIG_SYSTEM = "/etc/gitconfig";
}

10
modules/default.nix Normal file
View File

@@ -0,0 +1,10 @@
{ ... }:
{
imports = [
./base.nix
./cli-tools.nix
./mac-settings.nix
./pkg-installs.nix
];
}

64
modules/mac-settings.nix Normal file
View File

@@ -0,0 +1,64 @@
{ ... }:
{
system.defaults = {
NSGlobalDomain = {
AppleEnableSwipeNavigateWithScrolls = true;
AppleIconAppearanceTheme = "RegularDark";
AppleInterfaceStyle = "Dark";
NSDocumentSaveNewDocumentsToCloud = false;
NSNavPanelExpandedStateForSaveMode = true;
NSNavPanelExpandedStateForSaveMode2 = true;
"com.apple.trackpad.enableSecondaryClick" = true;
};
controlcenter = {
AirDrop = true;
Bluetooth = true;
Sound = true;
};
dock = {
autohide = true;
largesize = 40;
magnification = true;
mineffect = "scale";
minimize-to-application = true;
# This is all an example of how to set the apps in the Dock.
# The key is to remember to update this before rebuilding.
# I may move this item to another file to keep things clean.
# persistent-apps = [
# {
# app = "/Applications/Safari.app";
# }
# {
# spacer = {
# small = true;
# };
# }
# {
# folder = "/System/Applications/Utilities";
# }
# {
# file = "/User/example/Downloads/test.csv";
# }
# ]
wvous-br-corner = 11; # Launchpad or Apps
wvous-tl-corner = 13; # lock screen
};
finder = {
AppleShowAllExtensions = true;
AppleShowAllFiles = true;
FXPreferredViewStyle = "clmv";
ShowPathbar = true;
};
magicmouse.MouseButtonMode = "TwoButton";
trackpad = {
TrackpadPinch = true;
TrackpadRightClick = true;
};
};
}

33
modules/pkg-installs.nix Normal file
View File

@@ -0,0 +1,33 @@
{ pkgs, lib, ... }:
let
# Add one entry per program you want to install from a .pkg file
pkgInstalls = [
{
name = "cupsadmin";
url = "https://github.com/kfattic/cupsadmin/releases/download/v1.4.1/cupsadmin-1.4.1.pkg";
hash = "sha256-DyIyDYSjAlcU7ivyfldMapIZw5nczEBXfnLicnK6k7Y=";
}
];
installScript = p:
let
src = pkgs.fetchurl { inherit (p) url hash; };
in ''
stamp="/usr/local/share/nix-pkg-stamps/${p.name}"
want="${src}"
if [ "$(cat "$stamp" 2>/dev/null)" != "$want" ]; then
echo "installing ${p.name}..."
if /usr/sbin/installer -pkg "$want" -target /; then
mkdir -p /usr/local/share/nix-pkg-stamps
echo "$want" > "$stamp"
else
echo "${p.name} install failed, skipping"
fi
fi
'';
in
{
system.activationScripts.postActivation.text =
lib.concatMapStringsSep "\n" installScript pkgInstalls;
}