aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCopilot <198982749+Copilot@users.noreply.github.com>2026-03-01 18:56:27 +0100
committerGitHub <noreply@github.com>2026-03-01 18:56:27 +0100
commit011486787f639f2d2474bbaf5a6ef3d77fb45a43 (patch)
treec443f2c41053e2ed7599e9e676302dfa30dc89d4
parenteb7c55e9dc97524cca7c5b6a268cd66af147b12e (diff)
downloaddotfiles-011486787f639f2d2474bbaf5a6ef3d77fb45a43.tar.gz
dotfiles-011486787f639f2d2474bbaf5a6ef3d77fb45a43.zip
Refactor dotfiles to declarative Nix management (nix-darwin + home-manager) (#5)
-rw-r--r--README.md52
-rw-r--r--flake.nix39
-rw-r--r--modules/darwin/default.nix27
-rw-r--r--modules/darwin/homebrew.nix191
-rw-r--r--modules/darwin/macos.nix139
-rw-r--r--modules/home/default.nix24
-rw-r--r--modules/home/ghostty.nix5
-rw-r--r--modules/home/git.nix50
-rw-r--r--modules/home/starship.nix5
-rw-r--r--modules/home/tmux.nix5
-rw-r--r--modules/home/zsh.nix12
11 files changed, 543 insertions, 6 deletions
diff --git a/README.md b/README.md
index a72f952..3ac45ac 100644
--- a/README.md
+++ b/README.md
@@ -1,15 +1,55 @@
# dotfiles
-My Development Setup
+My Development Setup, managed with [Nix](https://nixos.org), [nix-darwin](https://github.com/LnL7/nix-darwin), and [home-manager](https://github.com/nix-community/home-manager).
## Quickstart
-First, you need to [install Brew](https://brew.sh). After which, you'll need to [get YADM going](https://yadm.io/docs/install).
+### 1. Install Nix
```shell
-cobraz@something-mac-something ~ % yadm clone git@github.com:cobraz/dotfiles.git
-cobraz@something-mac-something ~ % brew bundle
-cobraz@something-mac-something ~ % sh bootstrap.sh
+curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
```
-The last command will run for a while. It runs all Mac OSX defaults and stuff, so – i'll take some time!
+### 2. Clone the repository
+
+```shell
+git clone git@github.com:simenandre/dotfiles.git ~/dotfiles
+cd ~/dotfiles
+git submodule update --init --recursive
+```
+
+### 3. Apply the configuration
+
+On first run, bootstrap nix-darwin:
+
+```shell
+nix run nix-darwin -- switch --flake .#default
+```
+
+On subsequent runs:
+
+```shell
+darwin-rebuild switch --flake .#default
+```
+
+## Structure
+
+```
+flake.nix # Entry point – nix-darwin + home-manager
+modules/
+ darwin/
+ default.nix # System-level configuration (nix settings, core packages)
+ homebrew.nix # Homebrew packages (taps, brews, casks, Mac App Store)
+ macos.nix # macOS system defaults (replaces macos/macos script)
+ home/
+ default.nix # home-manager entry point
+ git.nix # Git configuration (programs.git)
+ zsh.nix # Zsh configuration files
+ starship.nix # Starship prompt configuration
+ tmux.nix # Tmux configuration
+ ghostty.nix # Ghostty terminal configuration
+apps/
+ Brewfile # Legacy Brewfile (superseded by modules/darwin/homebrew.nix)
+macos/
+ macos # Legacy macOS defaults script (superseded by modules/darwin/macos.nix)
+```
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..fa2e203
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,39 @@
+{
+ description = "Simen Andre's macOS configuration";
+
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+
+ nix-darwin = {
+ url = "github:LnL7/nix-darwin";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+
+ home-manager = {
+ url = "github:nix-community/home-manager";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ };
+
+ outputs =
+ {
+ self,
+ nixpkgs,
+ nix-darwin,
+ home-manager,
+ }:
+ {
+ darwinConfigurations."default" = nix-darwin.lib.darwinSystem {
+ system = "aarch64-darwin";
+ modules = [
+ ./modules/darwin
+ home-manager.darwinModules.home-manager
+ {
+ home-manager.useGlobalPkgs = true;
+ home-manager.useUserPackages = true;
+ home-manager.users.simenandre = import ./modules/home;
+ }
+ ];
+ };
+ };
+}
diff --git a/modules/darwin/default.nix b/modules/darwin/default.nix
new file mode 100644
index 0000000..5474b91
--- /dev/null
+++ b/modules/darwin/default.nix
@@ -0,0 +1,27 @@
+{ pkgs, ... }:
+
+{
+ imports = [
+ ./homebrew.nix
+ ./macos.nix
+ ];
+
+ # Enable experimental Nix features
+ nix.settings.experimental-features = "nix-command flakes";
+
+ # Allow unfree packages
+ nixpkgs.config.allowUnfree = true;
+
+ # System state version – do not change after first installation
+ system.stateVersion = 5;
+
+ # Enable Touch ID for sudo
+ security.pam.enableSudoTouchIdAuth = true;
+
+ # Core system packages available to all users
+ environment.systemPackages = with pkgs; [
+ curl
+ git
+ wget
+ ];
+}
diff --git a/modules/darwin/homebrew.nix b/modules/darwin/homebrew.nix
new file mode 100644
index 0000000..3c3f469
--- /dev/null
+++ b/modules/darwin/homebrew.nix
@@ -0,0 +1,191 @@
+{ ... }:
+
+{
+ homebrew = {
+ enable = true;
+
+ onActivation = {
+ autoUpdate = true;
+ upgrade = true;
+ cleanup = "zap";
+ };
+
+ taps = [
+ "bramstein/webfonttools"
+ "danielgtaylor/restish"
+ "oven-sh/bun"
+ "pulumi/tap"
+ "go-task/tap"
+ "tursodatabase/tap"
+ "yakitrak/yakitrak"
+ "simenandre/tools"
+ ];
+
+ brews = [
+ # Editors and terminal multiplexers
+ "neovim"
+ "tmux"
+
+ # Shells and shell utilities
+ "zsh"
+ "bash"
+ "bash-completion"
+ "ghq"
+ "moreutils"
+
+ # GNU tools
+ "findutils"
+ "gnu-sed"
+ "grep"
+
+ # Networking tools
+ "openssh"
+ "nmap"
+ "wget"
+
+ # Security and encryption
+ "gnupg"
+ "git-secret"
+ "ssh-copy-id"
+
+ # Compression libraries and tools
+ "lz4"
+ "zlib"
+ "zstd"
+ "libffi"
+ "p7zip"
+ "pigz"
+ "zopfli"
+
+ # Programming languages and runtimes
+ "golang"
+ "golangci-lint"
+ "python@3.11"
+ "rust"
+ "zig"
+ "pkl"
+
+ # Font tools
+ "sfnt2woff"
+ "sfnt2woff-zopfli"
+ "woff2"
+
+ # JavaScript runtimes and package managers
+ "bun"
+ "pnpm"
+ "volta"
+ "corepack"
+ "deno"
+
+ # REST API clients
+ "danielgtaylor/restish/restish"
+
+ # Version control
+ "git"
+ "git-lfs"
+ "lazygit"
+ "microplane"
+
+ # Search tools
+ "ripgrep"
+ "ack"
+ "fzf"
+
+ # JSON/YAML processing tools
+ "jq"
+ "yq"
+
+ # Cloud and IaC tools
+ "pulumi"
+ "crd2pulumi"
+ "kube2pulumi"
+ "pulumictl"
+ "tf2pulumi"
+ "azure-cli"
+ "kubectl"
+ "helm"
+ "cilium-cli"
+ "doctl"
+ "flyctl"
+
+ # Container tools
+ "podman"
+ "podman-compose"
+
+ # Task runners and automation
+ "go-task"
+ "act"
+
+ # Databases and database tools
+ "turso"
+ "libpq"
+ "sqld"
+
+ # Terminal tools
+ "pv"
+ "rename"
+ "rlwrap"
+ "tree"
+ "screen"
+ "vbindiff"
+ "tmate"
+ "asciinema"
+ "dasel"
+ "tldr"
+ "starship"
+ "gh"
+
+ # HTTP and web servers
+ "caddy"
+ "goreleaser"
+
+ # Specific toolsets
+ "whalebrew"
+ "gd"
+ "ghostscript"
+ "rclone"
+ "graphviz"
+
+ # Mac App Store CLI
+ "mas"
+ ];
+
+ casks = [
+ "spotify"
+ "slack"
+ "sonos"
+ "figma"
+ "discord"
+ "grammarly"
+ "microsoft-remote-desktop"
+ "postico"
+ "cyberduck"
+ "adobe-creative-cloud"
+ "1password-cli"
+ "protonvpn"
+ "openvpn-connect"
+ "raycast"
+ "rectangle"
+ "google-chrome"
+ "google-drive"
+ "karabiner-elements"
+ "postman"
+ "ghostty"
+ "proton-mail"
+ "claude"
+ "font-symbols-only-nerd-font"
+ "font-jetbrains-mono"
+ "google-cloud-sdk"
+ "docker"
+ "podman-desktop"
+ "microsoft-teams"
+ "zoom"
+ "obsidian"
+ ];
+
+ masApps = {
+ "Outline" = 1356178125;
+ "Remote Desktop" = 409907375;
+ };
+ };
+}
diff --git a/modules/darwin/macos.nix b/modules/darwin/macos.nix
new file mode 100644
index 0000000..8927903
--- /dev/null
+++ b/modules/darwin/macos.nix
@@ -0,0 +1,139 @@
+{ ... }:
+
+{
+ system.defaults = {
+ NSGlobalDomain = {
+ # Sidebar icon size: medium
+ NSTableViewDefaultSizeMode = 2;
+ # Always show scrollbars
+ AppleShowScrollBars = "Always";
+ # Expand save panel by default
+ NSNavPanelExpandedStateForSaveMode = true;
+ NSNavPanelExpandedStateForSaveMode2 = true;
+ # Expand print panel by default
+ PMPrintingExpandedStateForPrint = true;
+ PMPrintingExpandedStateForPrint2 = true;
+ # Save to disk (not to iCloud) by default
+ NSDocumentSaveNewDocumentsToCloud = false;
+ # Disable auto-correct
+ NSAutomaticSpellingCorrectionEnabled = false;
+ # Font smoothing
+ AppleFontSmoothing = 1;
+ };
+
+ dock = {
+ # Minimize windows into their application's icon
+ minimize-to-application = true;
+ # Show indicator lights for open applications in the Dock
+ show-process-indicators = true;
+ # Wipe all default app icons from the Dock
+ persistent-apps = [ ];
+ # Speed up Mission Control animations
+ expose-animation-duration = 0.1;
+ # Remove the auto-hiding Dock delay
+ autohide-delay = 0.0;
+ # Remove the animation when hiding/showing the Dock
+ autohide-time-modifier = 0.0;
+ # Automatically hide and show the Dock
+ autohide = true;
+ # Make Dock icons of hidden applications translucent
+ showhidden = true;
+ # Don't show recent applications in Dock
+ show-recents = false;
+ };
+
+ finder = {
+ # Show status bar
+ ShowStatusBar = true;
+ # Show path bar
+ ShowPathbar = true;
+ # Search the current folder by default
+ FXDefaultSearchScope = "SCcf";
+ # Disable warning when changing a file extension
+ FXEnableExtensionChangeWarning = false;
+ };
+
+ screencapture = {
+ # Save screenshots to ~/Screenshots
+ location = "~/Screenshots";
+ # Save screenshots as JPG
+ type = "jpg";
+ };
+
+ trackpad = {
+ # Enable tap to click for this user and the login screen
+ Clicking = true;
+ };
+
+ ActivityMonitor = {
+ # Show the main window when launching Activity Monitor
+ OpenMainWindow = true;
+ # Visualize CPU usage in the Activity Monitor Dock icon
+ IconType = 5;
+ # Show all processes in Activity Monitor
+ ShowCategory = 0;
+ # Sort Activity Monitor results by CPU usage
+ SortColumn = "CPUUsage";
+ SortDirection = 0;
+ };
+
+ LaunchServices = {
+ # Disable the "Are you sure you want to open this application?" dialog
+ LSQuarantine = false;
+ };
+
+ CustomUserPreferences = {
+ "com.apple.print.PrintingPrefs" = {
+ # Automatically quit printer app once the print jobs complete
+ "Quit When Finished" = true;
+ };
+ "com.apple.desktopservices" = {
+ # Avoid creating .DS_Store files on network or USB volumes
+ DSDontWriteNetworkStores = true;
+ DSDontWriteUSBStores = true;
+ };
+ "com.apple.Safari" = {
+ # Privacy: don't send search queries to Apple
+ UniversalSearchEnabled = false;
+ SuppressSearchSuggestions = true;
+ };
+ "com.apple.TimeMachine" = {
+ # Prevent Time Machine from prompting to use new hard drives
+ DoNotOfferNewDisksForBackup = true;
+ };
+ "com.apple.TextEdit" = {
+ PlainTextEncoding = 4;
+ PlainTextEncodingForWrite = 4;
+ };
+ "com.apple.SoftwareUpdate" = {
+ AutomaticCheckEnabled = true;
+ ScheduleFrequency = 1;
+ AutomaticDownload = 1;
+ CriticalUpdateInstall = 1;
+ };
+ "com.apple.commerce" = {
+ AutoUpdate = true;
+ AutoUpdateRestartRequired = true;
+ };
+ "com.apple.helpviewer" = {
+ DevMode = true;
+ };
+ "com.apple.BluetoothAudioAgent" = {
+ "Apple Bitpool Min (editable)" = 40;
+ };
+ "com.google.Chrome" = {
+ # Disable the all too sensitive backswipe on trackpads and Magic Mouse
+ AppleEnableSwipeNavigateWithScrolls = false;
+ AppleEnableMouseSwipeNavigateWithScrolls = false;
+ # Expand the print dialog by default
+ PMPrintingExpandedStateForPrint2 = true;
+ };
+ "com.apple.messageshelper.MessageController" = {
+ SOInputLineSettings = {
+ automaticQuoteSubstitutionEnabled = false;
+ continuousSpellCheckingEnabled = false;
+ };
+ };
+ };
+ };
+}
diff --git a/modules/home/default.nix b/modules/home/default.nix
new file mode 100644
index 0000000..1c0ae0e
--- /dev/null
+++ b/modules/home/default.nix
@@ -0,0 +1,24 @@
+{ pkgs, ... }:
+
+{
+ imports = [
+ ./git.nix
+ ./ghostty.nix
+ ./starship.nix
+ ./tmux.nix
+ ./zsh.nix
+ ];
+
+ home = {
+ username = "simenandre";
+ homeDirectory = "/Users/simenandre";
+ # Do not change this after the first installation
+ stateVersion = "24.11";
+ };
+
+ # Let home-manager manage itself
+ programs.home-manager.enable = true;
+
+ # Link neovim config (managed as a git submodule)
+ home.file.".config/nvim".source = ../../nvim/.config/nvim;
+}
diff --git a/modules/home/ghostty.nix b/modules/home/ghostty.nix
new file mode 100644
index 0000000..e854c6e
--- /dev/null
+++ b/modules/home/ghostty.nix
@@ -0,0 +1,5 @@
+{ ... }:
+
+{
+ home.file.".config/ghostty/config".source = ../../ghostty/.config/ghostty/config;
+}
diff --git a/modules/home/git.nix b/modules/home/git.nix
new file mode 100644
index 0000000..b42161e
--- /dev/null
+++ b/modules/home/git.nix
@@ -0,0 +1,50 @@
+{ ... }:
+
+{
+ programs.git = {
+ enable = true;
+ userName = "Simen A. W. Olsen";
+ userEmail = "hello@simenandre.no";
+
+ signing = {
+ key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMCyUn5BfmAnd/6xi0X1mYF/+jPOmCS0bpNUePF55gCY";
+ signByDefault = true;
+ };
+
+ extraConfig = {
+ apply.whitespace = "fix";
+ core = {
+ trustctime = false;
+ editor = "nvim";
+ excludesfile = "~/.gitignore_global";
+ };
+ color.ui = "auto";
+ "color \"branch\"" = {
+ current = "yellow reverse";
+ local = "yellow";
+ remote = "green";
+ };
+ "color \"diff\"" = {
+ meta = "yellow bold";
+ frag = "magenta bold";
+ old = "red";
+ new = "green";
+ };
+ "color \"status\"" = {
+ added = "yellow";
+ changed = "green";
+ untracked = "cyan";
+ };
+ diff.renames = "copies";
+ help.autocorrect = 1;
+ merge.log = true;
+ push.autoSetupRemote = true;
+ gpg.format = "ssh";
+ "gpg \"ssh\"".program = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign";
+ github.user = "simenandre";
+ pull.rebase = true;
+ "url \"ssh://git@github.com/\"".insteadOf = "https://github.com/";
+ commit.gpgsign = true;
+ };
+ };
+}
diff --git a/modules/home/starship.nix b/modules/home/starship.nix
new file mode 100644
index 0000000..05a70f3
--- /dev/null
+++ b/modules/home/starship.nix
@@ -0,0 +1,5 @@
+{ ... }:
+
+{
+ home.file.".config/starship.toml".source = ../../starship/.config/starship.toml;
+}
diff --git a/modules/home/tmux.nix b/modules/home/tmux.nix
new file mode 100644
index 0000000..473ce5e
--- /dev/null
+++ b/modules/home/tmux.nix
@@ -0,0 +1,5 @@
+{ ... }:
+
+{
+ home.file.".tmux.conf".source = ../../tmux/.tmux.conf;
+}
diff --git a/modules/home/zsh.nix b/modules/home/zsh.nix
new file mode 100644
index 0000000..b7dc9c1
--- /dev/null
+++ b/modules/home/zsh.nix
@@ -0,0 +1,12 @@
+{ ... }:
+
+{
+ home.file = {
+ ".zshenv".source = ../../zsh/.zshenv;
+ ".hushlogin".source = ../../zsh/.hushlogin;
+ ".config/zsh/.zshrc".source = ../../zsh/.config/zsh/.zshrc;
+ ".config/zsh/aliases".source = ../../zsh/.config/zsh/aliases;
+ ".config/zsh/path".source = ../../zsh/.config/zsh/path;
+ ".config/zsh/extras".source = ../../zsh/.config/zsh/extras;
+ };
+}