Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
2684213
WIP: add nix
legomb Jan 4, 2025
933289b
chore: add tasks
legomb Jan 4, 2025
a18524e
chore: add flake
legomb Jan 4, 2025
e2d1791
fix: correct path
legomb Jan 5, 2025
70bd670
fix: version must be an int
legomb Jan 5, 2025
dc16045
chore: add lock file
legomb Jan 5, 2025
db6b83b
ref: use var
legomb Jan 5, 2025
4c94b5b
chore: revert file
legomb Jan 5, 2025
f7df318
feat: add rebuild task
legomb Jan 5, 2025
29d8b2e
fix: ignore path
legomb Jan 5, 2025
b5c1e44
ref: use darwin-rebuild command
legomb Jan 5, 2025
d0f5c03
feat: allow unfree
legomb Jan 5, 2025
14b0f1b
feat: add reqs from readme
legomb Jan 5, 2025
c888f57
feat: add system defaults
legomb Jan 5, 2025
95ecbb2
wip: update instructions
legomb Feb 16, 2025
c9e83e3
Merge branch 'main' into feature/add-nix
legomb Feb 16, 2025
6745e45
doc: clean docs
legomb Feb 19, 2025
9db4eed
doc: fix numbering
legomb Feb 19, 2025
b7b503e
docs: clarify
legomb Feb 19, 2025
1f7d388
docs: min change
legomb Feb 19, 2025
3141f9c
fix: rm temp result
legomb Feb 19, 2025
1db2856
Merge branch 'main' into feature/add-nix
legomb Mar 27, 2025
828fa8f
feat: add garbage collection
legomb Mar 27, 2025
63bab0c
ref: rearrange
legomb Mar 27, 2025
b96daa8
feat: add flake update task
legomb Mar 27, 2025
dfefd21
chore: fix nix tasks naming
legomb Mar 27, 2025
26499c5
fix: update deprecated config
legomb Mar 27, 2025
8ee6906
fix: default Nix build user group ID changed
legomb Mar 27, 2025
516f942
ref: simplify
legomb Mar 27, 2025
afd0845
chore: fix tabspace
legomb Mar 27, 2025
d532e5c
chore: cleanup
legomb Mar 27, 2025
633fafb
chore: cleanup
legomb Mar 27, 2025
aec1ba3
feat: add homebrew
legomb Mar 27, 2025
73e60c8
feat: show all extensions
legomb Mar 30, 2025
6e1f0fd
feat: add nixfmt
legomb Mar 30, 2025
f16bf3d
ref: move config to own file
legomb Mar 30, 2025
757c5fa
feat: add dry run task
legomb Mar 30, 2025
011b0ca
chore: cleanup
legomb Mar 30, 2025
d3bcdec
docs: restore brew installation step
legomb Mar 30, 2025
bdce20b
docs: update
legomb Mar 30, 2025
b57a445
docs: simplify
legomb Mar 30, 2025
4fe696e
chore: keep dir as placeholder
legomb Mar 30, 2025
cef1b59
Merge branch 'main' into feature/add-nix
legomb Mar 31, 2025
2df33b7
Merge branch 'main' into feature/add-nix
legomb May 19, 2025
8862d0a
Merge branch 'main' into feature/add-nix
legomb May 20, 2025
721a68b
Merge branch 'main' into feature/add-nix
legomb May 20, 2025
c84f82d
chore: add font for powerlevel10k
legomb May 22, 2025
777d23c
Merge branch 'main' into feature/add-nix
legomb May 26, 2025
08e19c6
Merge branch 'main' into feature/add-nix
legomb Jun 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 29 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,46 @@

My macOS configuration files.

> [!NOTE]
> Nix support is in beta. If I'm happy with Nix after a while, I'll migrate everything else to Nix, and installation instructions will become simpler.

## Setting up a new MacOS machine 🚀

1. Install Homebrew:
1. Install [Nix](https://nix.dev/install-nix):

```sh
curl -L https://nixos.org/nix/install | sh
```

```sh
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
2. Clone the repo

1. Install requirements:
```sh
git clone --recurse-submodules https://github.com/legomb/dotfiles.git
```

```sh
brew install git stow go-task
```
3. Switch to the nix flake:

3. Clone the repo.
```sh
cd config/nix/.config/nix-darwin
nix run nix-darwin --extra-experimental-features "nix-command flakes" -- switch --flake .#macbook
```

This will configure macOS settings and install basic dependencies (go-task, etc.)

4. Initialize submodules:
4. Install Homebrew:

```sh
task git:submodules:update
```
```sh
task brew:install
```

5. Stow dotfiles:

```sh
task stow:stow
```
```sh
task stow:stow
```

6. Install everything:
6. Install everything using brew:

```sh
task brew:bundle:install
```
```sh
task brew:bundle:install
```
1 change: 1 addition & 0 deletions config/brew/Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ cask "alt-tab"
# cask "font-lilex-nerd-font"
# cask "font-martian-mono-nerd-font"
cask "font-meslo-lg-nerd-font"
cask "font-meslo-for-powerlevel10k"
# cask "font-monaspace-nerd-font"
# cask "font-monocraft-nerd-font"
# cask "font-monofur-nerd-font"
Expand Down
1 change: 1 addition & 0 deletions config/nix/.config/nix-darwin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
result/
53 changes: 53 additions & 0 deletions config/nix/.config/nix-darwin/configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{ self, pkgs, ... }:
{

# The default Nix build user group ID was changed from 30000 to 350. You can set the configured group ID to match the actual value with `ids.gids.nixbld = 30000;`
# We do not recommend trying to change the group ID with macOS user management tools without a complete uninstallation and reinstallation of Nix.
ids.gids.nixbld = 30000;

nixpkgs.config.allowUnfree = true;
# The platform the configuration will be used on.
nixpkgs.hostPlatform = "aarch64-darwin";

# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
environment.systemPackages = with pkgs; [
coreutils
git
go-task
neovim
stow
nixfmt-rfc-style
];

nix.settings = {
keep-outputs = true;
keep-derivations = true;

# Necessary for using flakes on this system.
experimental-features = "nix-command flakes";
};

# Set Git commit hash for darwin-version.
# system.configurationRevision = self.rev or self.dirtyRev or null;

# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = 5;

security.pam.services.sudo_local.touchIdAuth = true;

system.defaults = {
dock.autohide = true;
finder.FXPreferredViewStyle = "clmv";
finder.AppleShowAllExtensions = true;
NSGlobalDomain.AppleInterfaceStyle = "Dark";
};

# Garbage collection
nix.gc = {
automatic = true;
options = "--delete-generations +5";
};
nix.optimise.automatic = true;
}
48 changes: 48 additions & 0 deletions config/nix/.config/nix-darwin/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions config/nix/.config/nix-darwin/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
description = "Custom nix-darwin system flake";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nix-darwin.url = "github:LnL7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
};

outputs =
inputs@{
self,
nix-darwin,
nixpkgs,
}:
{
# Build darwin flake using:
# $ darwin-rebuild build --flake .#macbook
darwinConfigurations."macbook" = nix-darwin.lib.darwinSystem {
modules = [ ./configuration.nix ];
};
};
}
Empty file.
44 changes: 44 additions & 0 deletions taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ version: '3'
env:
CONFIG_PATH: '{{.PWD}}/config'
BREWFILE_PATH: '{{.CONFIG_PATH}}/brew/Brewfile'
NIX_DARWIN_FLAKE_PATH: '{{.CONFIG_PATH}}/nix/.config/nix-darwin'

dotenv: ['.env', '{{.ENV}}/.env.', '{{.HOME}}/.env']

Expand Down Expand Up @@ -64,6 +65,7 @@ tasks:
- git
- alacritty
- ghostty
- nix
cmd: stow {{.CLI_ARGS}} --dir={{.CONFIG_PATH}} --target=$HOME {{ .ITEM }}

stow:simulate:
Expand All @@ -83,3 +85,45 @@ tasks:
cmds:
- git submodule update --init --recursive
- task: zsh:create-powerlevel10k-symlink

nix:install:
desc: Installs Nix
cmds:
- curl -L https://nixos.org/nix/install | sh

nix:flake:init:nix-darwin:
desc: Initializes nix-darwin flake, as per https://youtu.be/Z8BL8mdzWHI?si=azkz7EwYHTEUBCz3
dir: '{{.NIX_DARWIN_FLAKE_PATH}}'
cmds:
- nix flake init -t nix-darwin --extra-experimental-features "nix-command flakes"
- sed -i '' "s/simple/$(scutil --get LocalHostName)/" flake.nix

nix:flake:switch:nix-darwin:
desc: Switches to the MacOS flake
dir: '{{.NIX_DARWIN_FLAKE_PATH}}'
cmds:
- nix run nix-darwin --extra-experimental-features "nix-command flakes" -- switch --flake .#macbook

nix:flake:rebuild:nix-darwin:
desc: Rebuilds the MacOS flake
dir: '{{.NIX_DARWIN_FLAKE_PATH}}'
cmds:
- darwin-rebuild switch --flake .#macbook

nix:flake:rebuild:nix-darwin:dry-run:
desc: Rebuilds the MacOS flake
dir: '{{.NIX_DARWIN_FLAKE_PATH}}'
cmds:
- darwin-rebuild switch --flake .#macbook --dry-run

nix:flake:update:nix-darwin:
desc: Updates the MacOS flake lock file
dir: '{{.NIX_DARWIN_FLAKE_PATH}}'
cmds:
- nix flake update

nix:flake:format:
desc: Formats MacOS flake file
dir: '{{.NIX_DARWIN_FLAKE_PATH}}'
cmds:
- nixfmt flake.nix