Compare commits

52 Commits

Author SHA1 Message Date
29314ffa7b Update README.md 2026-11-13 10:56:46 -05:00
3d01855c3d added homebrew.autoMigrate 2026-11-13 10:08:22 -05:00
e5a27bcbd3 added altersend to work dock 2026-11-12 20:06:40 -05:00
2e34604ac5 turned personalized advertising off 2026-11-12 16:44:29 -05:00
c1f9a1d8e6 added altersend to personal dock 2026-11-12 16:30:46 -05:00
d227e5c9e1 updated work profile username 2026-11-12 10:52:36 -05:00
bf2b9c8762 dock apps for work 2026-11-12 10:14:11 -05:00
9ebe106841 fix config 2026-11-11 08:17:01 -05:00
700fbdc2b4 added nd to aliases 2026-11-11 08:15:11 -05:00
6ee6cad1df updated apps 2026-11-11 08:13:21 -05:00
d37abc556d updated nixpkgs 2026-11-10 16:19:31 -05:00
928b090957 updated apps and added touchId for sudo 2026-11-10 15:05:19 -05:00
6b9a18c948 updated README 2026-11-10 14:38:27 -05:00
51f82bd25f note about adding google chrome 2026-11-10 11:44:54 -05:00
6c0d871f16 added 1Pass to work and set work dock apps 2026-11-10 11:41:10 -05:00
0a9c270e31 added apps to personal dock 2026-11-10 11:33:50 -05:00
833cad7df8 added prismlauncher to personal 2026-11-09 19:16:22 -05:00
25cf488f18 added fladder to personal 2026-11-09 18:49:08 -05:00
9542e348cd added rusty-pw as global 2026-11-09 18:39:27 -05:00
d8ebcad70c updated README 2026-11-09 18:31:37 -05:00
892aa827c8 Merge pull request 'brian/profiles' (#1) from brian/profiles into main
Reviewed-on: #1
2026-11-09 18:16:33 -05:00
bf40b1d4a6 tested and confirms it works 2026-11-09 18:15:45 -05:00
1991b48f98 updated apps inside profiles 2026-11-09 13:49:44 -05:00
0a9ede2ba8 added option for global and per profile pkg and zip installs 2026-11-09 13:41:03 -05:00
00147ba242 removed imports from base 2026-11-09 11:01:18 -05:00
b3f749f8bf restructed modules for home and work, untested 2026-11-09 10:58:31 -05:00
10bac6ed32 added credential helper 2026-11-08 12:29:16 -05:00
3acbbe1803 fix git config 2026-11-08 12:23:32 -05:00
Brian Nelson
e3706e95f8 Merge existing repo history, keep working config 2026-11-08 11:58:22 -05:00
b4ce55c151 changed cupsadmin 2026-11-07 08:07:54 -05:00
f36234ea8c added cupsadmin as input and native build 2026-11-06 11:03:32 -05:00
6b61eaf75d added libreoffice 2026-11-06 10:37:18 -05:00
1368ac7d23 added task-manager 2026-11-06 09:16:38 -05:00
0774d02c5c vlc as cask 2026-11-05 18:22:06 -05:00
262c5ae623 fix mac-settings 2026-11-05 18:19:35 -05:00
60f5073114 warn problems 2026-11-05 18:18:26 -05:00
a1b639bfa5 allow unfree 2026-11-05 18:04:08 -05:00
ec53448c90 git isnt a program in nix 2026-11-05 18:02:57 -05:00
ef2fe843b1 moved some brews to pkgs and changed hostname 2026-11-05 17:59:45 -05:00
ba26a2c3a2 added packages and brews 2026-11-02 10:43:01 -05:00
32d5892ddd updated install script for usb installation 2026-10-20 14:05:20 -04:00
8b159a2eee added mac-settings to imports 2026-10-20 14:00:20 -04:00
2bb2eaa751 updated README 2026-10-20 13:52:55 -04:00
8750caa5d2 updated README 2026-10-20 13:52:19 -04:00
3cf16ff880 added install script and git config 2026-10-20 13:47:55 -04:00
863b47e663 added git and obsidian 2026-10-20 11:22:40 -04:00
f9a722aad8 moved some cli stuff to cli-tools.nix 2026-10-20 11:13:32 -04:00
c9d180680d updated hostname 2026-10-20 11:10:26 -04:00
fe2053bd10 fixed magnification value 2026-10-20 11:06:07 -04:00
ea7507e7e3 started on mac-settings 2026-10-20 10:57:47 -04:00
ca5ea4e1ab added ykman and updated README 2026-10-20 09:59:14 -04:00
b6711ec221 initial commit 2026-10-20 09:46:14 -04:00
19 changed files with 357 additions and 136 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
result

33
README.md Normal file
View File

@@ -0,0 +1,33 @@
# My nix-darwin Configuration
This repo is meant to be a declarative setup for new macOS devices, specifically focused on the application installs. All GUI applications will be handled by homebrew and some brews or CLI tools. The more stable and maintained CLI tools are installed via nixpkgs.
This config contains options for both personal user and work use. There are shared packages found in [modules/apps](./modules/apps.nix) along with "profile" specific packages in their respective directories [profiles/personal](./profiles/personal/) and [profiles/work](./profiles/work/).
> [!important]
> Ignore the `install.sh` file for now, it's out dated and I don't believe will work in the current state.
> I'll think about adding a new install script but the default installation by cloning the repo into `/etc/nix-darwin` works pretty good.
## Installation
1. Have an implementation of nix installed [nixos.org](https://nixos.org/download/)
2. Clone this repo onto the machine (probably fastest via usb) or install `git` seperatly and run `git clone https://git.briannelson.dev/brian/nix-darwin.git`
3. Copy the repo into `/etc/nix-darwin`
```bash
sudo mkdir -p /etc/nix-darwin
sudo chown $(id -nu):$(id -ng) /etc/nix-darwin
sudo cp [PATH/TO/REPO] /etc/nix-darwin
```
4. Install nix-darwin and the profile you want with
```bash
sudo nix run nix-darwin/nix-darwin-26.05#darwin-rebuild --extra-experimental-features "nix-command flakes" -- switch --flake "/etc/nix-darwin#PROFILE_NAME"
# where PROFILE_NAME is either personal or work
```
5. Maintianing nix-darwin if any changes get made locally you can run the rebuild switch command. If changes get made remotely make sure to run `git pull` then the rebuild switch command.
```bash
cd /etc/nix-darwin
git pull
sudo darwin-rebuild switch --flake ".#PROFILE"
```
## Homebrew
I like using homebrew as my package manager for most apps as its really easy and convienent to run `brew upgrade` to update all apps in 1 go. I love nix for many other reasons but some of the packages on the stable branch aren't always up-to-date and take a while to update.

View File

@@ -1,65 +0,0 @@
{ pkgs, ... }:
{
imports = [
./cli-tools.nix
./mac-settings.nix
./pkg-installs.nix
./archive-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
ffmpeg
flac
git
helix
librewolf
tea
yt-dlp
];
homebrew = {
enable = true;
onActivation = {
autoUpdate = true;
cleanup = "none";
};
brews = [
"bun"
"defaultbrowser"
"harper"
"nicotine-plus"
"rust"
"ykman"
];
casks = [
"bitwarden"
"cap"
"discord"
"docker-desktop"
"harper-desktop"
"libreoffice"
"nextcloud"
"obsidian"
"protonvpn"
"rustdesk"
"signal"
"task-manager-tmog"
"twingate"
"vlc"
"vscodium"
"firefox"
];
};
}

23
flake.lock generated
View File

@@ -76,7 +76,28 @@
"inputs": {
"nix-darwin": "nix-darwin",
"nix-homebrew": "nix-homebrew",
"nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs",
"rusty-pw": "rusty-pw"
}
},
"rusty-pw": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1792878430,
"narHash": "sha256-SZm2FqJr6tWrDdoEBa1+WUmSQZn514uXulM9opozoQ8=",
"ref": "refs/heads/main",
"rev": "d8faadac139e0856c6730cf9f5fcc74383362bef",
"revCount": 13,
"type": "git",
"url": "https://git.briannelson.dev/brian/rusty-pw"
},
"original": {
"type": "git",
"url": "https://git.briannelson.dev/brian/rusty-pw"
}
}
},

View File

@@ -6,21 +6,37 @@
nix-darwin.url = "github:nix-darwin/nix-darwin/nix-darwin-26.05";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
nix-homebrew.url = "github:zhaofengli/nix-homebrew";
rusty-pw = {
url = "git+https://git.briannelson.dev/brian/rusty-pw";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ self, nix-darwin, nixpkgs, nix-homebrew, ... }: {
darwinConfigurations."Brians-MacBook-Air" = nix-darwin.lib.darwinSystem {
modules = [
./configuration.nix
nix-homebrew.darwinModules.nix-homebrew
{
nix-homebrew = {
enable = true;
enableRosetta = true;
user = "briannelson";
};
}
];
outputs = inputs@{ self, nix-darwin, nixpkgs, nix-homebrew, ... }:
let
mkDarwin = { profile, user, system ? "aarch-64-dawin" }:
nix-darwin.lib.darwinSystem {
specialArgs = { inherit inputs user system; };
modules = [
./modules
./profiles/${profile}
nix-homebrew.darwinModules.nix-homebrew
{
nix-homebrew = {
enable = true;
enableRosetta = true;
user = "briannelson";
autoMigrate = true;
};
}
];
};
in
{
darwinConfigurations = {
personal = mkDarwin { profile = "personal"; user = "briannelson"; };
work = mkDarwin { profile = "work"; user = "briannelson"; };
};
};
}

27
install.sh Normal file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail
echo "==> Checking for Nix..."
if ! command -v nix >/dev/null 2>&1; then
echo "==> Installing Nix vis Determinate Systems installer..."
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
else
echo "Nix already installed, skipping."
fi
echo "==> Copying config to /etc/nix-darwin..."
sudo mkdir -p /etc/nix-darwin
sudo cp -r "$(pwd)/." /etc/nix-darwin
sudo chown -R root:wheel /etc/nix-darwin
echo "==> Renaming conflicting shell files if present..."
[ -f /etc/bashrc ] && sudo mv /etc/bashrc /etc/bashrc.before-nix-darwin
[ -f /etc/zshrc ] && sudo mv /etc/zshrc /etc/zshrc.before-nix-darwin
[ -f /etc/zshenv ] && sudo mv /etc/zshenv /etc/zshenv.before-nix-darwin
echo "==> Bootstraping nix-darwin..."
nix run nix-darwin/master#darwin-rebuild -- switch --flake /etc/nix-darwin
echo "==> Done! Restart your terminal to apply all changes."

47
modules/apps.nix Normal file
View File

@@ -0,0 +1,47 @@
{ inputs, pkgs, ... }:
{
# This file installs these apps on all configurations
pkgInstalls = [
{
name = "cupsadmin";
url = "https://github.com/kfattic/cupsadmin/releases/download/v1.4.1/cupsadmin-1.4.1.pkg";
hash = "sha256-DyIyDYSjAlcU7ivyfldMapIZw5nczEBXfnLicnK6k7Y=";
}
];
archiveApps = [];
nixpkgs.overlays = [
inputs.rusty-pw.overlays.default
];
environment.systemPackages = with pkgs; [
exif
exiftool
git
helix
rusty-pw
];
homebrew.brews = [
"bun"
"defaultbrowser"
"harper"
"rust"
];
homebrew.casks = [
"altersend"
"bitwarden"
"harper-desktop"
"nextcloud"
"obsidian"
"signal"
"task-manager-tmog"
"twingate"
"vlc"
"vscodium"
"firefox"
];
}

View File

@@ -1,17 +1,9 @@
{ pkgs, lib, ... }:
{ pkgs, lib, config, ... }:
let
cfg = config.archiveApps;
stampDir = "/usr/local/share/nix-pkg-stamps";
apps = [
{
name = "removemacai-app";
app = "RemoveMacAI.app";
url = "https://github.com/omlahore/RemoveMacAI/releases/download/v1.1.4/RemoveMacAI.zip";
sha256 = "2063d4dc7e0b41b15cebcd9e1b9807b04615b96e3e23db35cbd1196be3c96bee";
}
];
appScript = a:
let
src = pkgs.fetchurl { inherit (a) url sha256; };
@@ -38,8 +30,12 @@ let
'';
in
{
system.activationScripts.postActivation.text =
lib.concatStringsSep "\n" (
(map appScript apps)
);
options.archiveApps = lib.mkOption {
type = lib.types.listOf (lib.types.attrsOf lib.types.str);
default = [ ];
description = "Apps distributed as .zip archives to install into /Applications";
};
config.system.activationScripts.postActivation.text =
lib.concatMapStringsSep "\n" appScript cfg;
}

20
modules/base.nix Normal file
View File

@@ -0,0 +1,20 @@
{ ... }:
{
nixpkgs.hostPlatform = "aarch64-darwin";
nix.settings.experimental-features = "nix-command flakes";
system.stateVersion = 6;
system.primaryUser = "briannelson";
security.pam.services.sudo_local.touchIdAuth = true;
homebrew = {
enable = true;
onActivation = {
autoUpdate = true;
cleanup = "none";
};
};
}

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

@@ -0,0 +1,20 @@
{ ... }:
{
environment.shellAliases = {
ll = "ls -la";
nd = "cd /etc/nix-darwin";
};
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";
}

12
modules/default.nix Normal file
View File

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

View File

@@ -20,29 +20,11 @@
dock = {
autohide = true;
largesize = 40;
tilesize = 45;
largesize = 85;
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
};
@@ -60,5 +42,9 @@
TrackpadPinch = true;
TrackpadRightClick = true;
};
CustomUserPreferences = {
"com.apple.AdLib".allowApplePersonalizedAdvertising = false;
};
};
}

View File

@@ -1,15 +1,7 @@
{ pkgs, lib, ... }:
{ pkgs, lib, config, ... }:
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=";
}
];
cfg = config.pkgInstalls;
installScript = p:
let
src = pkgs.fetchurl { inherit (p) url hash; };
@@ -28,6 +20,12 @@ let
'';
in
{
system.activationScripts.postActivation.text =
lib.concatMapStringsSep "\n" installScript pkgInstalls;
options.pkgInstalls = lib.mkOption {
type = lib.types.listOf (lib.types.attrsOf lib.types.str);
default = [ ];
description = "PKG files to install on activation";
};
config.system.activationScripts.postActivation.text =
lib.concatMapStringsSep "\n" installScript cfg;
}

View File

@@ -0,0 +1,38 @@
{ pkgs, ... }:
{
pkgInstalls = [];
archiveApps = [
{
name = "removemacai-app";
app = "RemoveMacAI.app";
url = "https://github.com/omlahore/RemoveMacAI/releases/download/v1.1.4/RemoveMacAI.zip";
sha256 = "2063d4dc7e0b41b15cebcd9e1b9807b04615b96e3e23db35cbd1196be3c96bee";
}
];
environment.systemPackages = with pkgs; [
ffmpeg
flac
fladder
librewolf
qbittorrent
tea
yt-dlp
];
homebrew.brews = [
"nicotine-plus"
];
homebrew.casks = [
"cap"
"discord"
"docker-desktop"
"libreoffice"
"prismlauncher"
"protonvpn"
"rustdesk"
];
}

View File

@@ -1,19 +1,10 @@
{ pkgs, ... }:
{ ... }:
{
environment.shellAliases = {
yt = "yt-dlp";
ll = "ls -la";
};
environment.etc."gitconfig".text = ''
[user]
name = Brian Nelson
email = brian@briannelson.dev
[init]
defaultBranch = main
'';
environment.etc."yt-dlp.conf".text = ''
-o /Users/briannelson/Downloads/yt-dlp/%(title)s.%(ext)s
--no-mtime

View File

@@ -0,0 +1,28 @@
{ ... }:
{
imports = [
./cli-tools.nix
./apps.nix
];
system.defaults.dock = {
persistent-apps = [
{ app = "/System/Applications/Apps.app"; }
{ app = "/Applications/Nix Apps/LibreWolf.app"; }
{ app = "/System/Applications/Utilities/Terminal.app"; }
{ app = "/System/Applications/Messages.app"; }
{ app = "/Applications/Obsidian.app"; }
{ app = "/Applications/VSCodium.app"; }
{ app = "/System/Applications/Maps.app"; }
{ app = "/System/Applications/Calendar.app"; }
{ app = "/System/Applications/Reminders.app"; }
{ app = "/Applications/Bitwarden.app"; }
{ app = "/Applications/ProtonVPN.app"; }
{ app = "/Applications/Nix Apps/Fladder.app"; }
{ app = "/System/Applications/App Store.app"; }
{ app = "/Applications/AlterSend.app"; }
{ app = "/System/Applications/System Settings.app"; }
];
};
}

19
profiles/work/apps.nix Normal file
View File

@@ -0,0 +1,19 @@
{ pkgs, ... }:
{
pkgInstalls = [];
archiveApps = [];
environment.systemPackages = with pkgs; [];
homebrew.brews = [
"ykman"
];
homebrew.casks = [
"1Password"
# I would add google chrome but that will be installed by Mosyle
# "google-chrome"
];
}

View File

@@ -0,0 +1,9 @@
{ ... }:
{
system.activationScripts.postActivation.text = ''
if [ -x /opt/homebrew/bin/defaultbrowser ]; then
sudo -u briannelson /opt/homebrew/bin/defaultbrowser firefox || echo "could not set deffault browser, skipping"
fi
'';
}

24
profiles/work/default.nix Normal file
View File

@@ -0,0 +1,24 @@
{ ... }:
{
imports = [
./apps.nix
./cli-tools.nix
];
system.defaults.dock = {
persistent-apps = [
{ app = "/System/Applications/Apps.app"; }
{ app = "/Applications/Firefox.app"; }
{ app = "/System/Applications/Utilities/Terminal.app"; }
{ app = "/Applications/Obsidian.app"; }
{ app = "/Applications/VSCodium.app"; }
{ app = "/System/Applications/App Store.app"; }
{ app = "/Applications/1Password.app"; }
{ app = "/Applications/Manager.app"; }
{ app = "/Applications/CUPS Admin.app"; }
{ app = "/Applications/AlterSend.app"; }
{ app = "/System/Applications/System Settings.app"; }
];
};
}