From 2684213c9430a995f501c07870d36d60358eeba7 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Sat, 4 Jan 2025 19:30:53 +0100 Subject: [PATCH 01/41] WIP: add nix --- README.md | 24 +++++++++++++++++++----- taskfile.yml | 5 +++++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 66724c6..fe805e5 100644 --- a/README.md +++ b/README.md @@ -10,28 +10,42 @@ My macOS configuration files. /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` -1. Install requirements: +1. Install Nix + +```sh +curl -L https://nixos.org/nix/install | sh +``` + +Complete instructions can be found on the [Nix website](https://nix.dev/install-nix). + +2. Install nix stuff: + +``` + +``` + +3. Install requirements: ```sh brew install git stow go-task ``` -3. Clone the repo. +4. Clone the repo. -4. Initialize submodules: +5. Initialize submodules: ```sh task git:submodules:update ``` -5. Stow dotfiles: +6. Stow dotfiles: ```sh task stow:stow ``` -6. Install everything: +7. Install everything: ```sh task brew:bundle:install diff --git a/taskfile.yml b/taskfile.yml index c12334e..469b436 100644 --- a/taskfile.yml +++ b/taskfile.yml @@ -75,3 +75,8 @@ tasks: desc: Initialize submodules cmds: - git submodule update --init --recursive + + nix:install: + desc: Installs Nix + cmds: + - curl -L https://nixos.org/nix/install | sh From 933289b39cb7a6d1badb797b17d61035828e7fba Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Sat, 4 Jan 2025 20:38:37 +0100 Subject: [PATCH 02/41] chore: add tasks --- taskfile.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/taskfile.yml b/taskfile.yml index 469b436..2772602 100644 --- a/taskfile.yml +++ b/taskfile.yml @@ -57,6 +57,7 @@ tasks: - git - alacritty - ghostty + - nix cmd: stow {{.CLI_ARGS}} --dir={{.CONFIG_PATH}} --target=$HOME {{ .ITEM }} stow:simulate: @@ -80,3 +81,15 @@ tasks: desc: Installs Nix cmds: - curl -L https://nixos.org/nix/install | sh + + nix:nix-darwin:flake:init: + desc: Initializes nix-darwin flake, as per https://youtu.be/Z8BL8mdzWHI?si=azkz7EwYHTEUBCz3 + dir: 'config/nix/.config/nix-darwin' + cmds: + - nix flake init -t nix-darwin --extra-experimental-features "nix-command flakes" + - sed -i '' "s/simple/$(scutil --get LocalHostName)/" flake.nix + + nix:nix-darwin:flake:switch: + desc: Switches to the MacOS flake + cmds: + - nix run nix-darwin --extra-experimental-features "nix-command flakes" -- switch --flake config/nix/nix-darwin#macbook From a18524e4d6fc9d8a0baae0bfa5c1d54c4661bcb6 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Sat, 4 Jan 2025 20:38:42 +0100 Subject: [PATCH 03/41] chore: add flake --- config/nix/.config/nix/nix-darwin/flake.nix | 43 +++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 config/nix/.config/nix/nix-darwin/flake.nix diff --git a/config/nix/.config/nix/nix-darwin/flake.nix b/config/nix/.config/nix/nix-darwin/flake.nix new file mode 100644 index 0000000..5f26886 --- /dev/null +++ b/config/nix/.config/nix/nix-darwin/flake.nix @@ -0,0 +1,43 @@ +{ + 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 }: + let + configuration = { pkgs, ... }: { + # List packages installed in system profile. To search by name, run: + # $ nix-env -qaP | grep wget + environment.systemPackages = + [ pkgs.vim + ]; + + # Necessary for using flakes on this system. + nix.settings.experimental-features = "nix-command flakes"; + + # Enable alternative shell support in nix-darwin. + # programs.fish.enable = true; + + # 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; + + # The platform the configuration will be used on. + nixpkgs.hostPlatform = "aarch64-darwin"; + }; + in + { + # Build darwin flake using: + # $ darwin-rebuild build --flake .#simple + darwinConfigurations."macbook" = nix-darwin.lib.darwinSystem { + modules = [ configuration ]; + }; + }; +} From e2d1791193c2674d7653fb5aa915166c677cb42a Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Sun, 5 Jan 2025 09:13:23 +0100 Subject: [PATCH 04/41] fix: correct path --- config/nix/.config/nix-darwin/flake.nix | 32 +++++++++++++++ config/nix/.config/nix/nix-darwin/flake.nix | 43 --------------------- taskfile.yml | 3 +- 3 files changed, 34 insertions(+), 44 deletions(-) create mode 100644 config/nix/.config/nix-darwin/flake.nix delete mode 100644 config/nix/.config/nix/nix-darwin/flake.nix diff --git a/config/nix/.config/nix-darwin/flake.nix b/config/nix/.config/nix-darwin/flake.nix new file mode 100644 index 0000000..8702849 --- /dev/null +++ b/config/nix/.config/nix-darwin/flake.nix @@ -0,0 +1,32 @@ +{ + description = "Flake for macOS configuration"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + nix-darwin.url = "github:LnL7/nix-darwin"; + }; + + outputs = { self, nixpkgs, nix-darwin, ... }: + let + system = "aarch64-darwin"; + pkgs = import nixpkgs { + inherit system; + }; + configuration = { config, pkgs, ... }: { + # Compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = "5"; + + # The platform the configuration will be used on. + nixpkgs.hostPlatform = system; + }; + in + { + darwinConfigurations = { + macbook = nix-darwin.lib.darwinSystem { + system = system; + modules = [ configuration ]; + }; + }; + }; +} diff --git a/config/nix/.config/nix/nix-darwin/flake.nix b/config/nix/.config/nix/nix-darwin/flake.nix deleted file mode 100644 index 5f26886..0000000 --- a/config/nix/.config/nix/nix-darwin/flake.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ - 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 }: - let - configuration = { pkgs, ... }: { - # List packages installed in system profile. To search by name, run: - # $ nix-env -qaP | grep wget - environment.systemPackages = - [ pkgs.vim - ]; - - # Necessary for using flakes on this system. - nix.settings.experimental-features = "nix-command flakes"; - - # Enable alternative shell support in nix-darwin. - # programs.fish.enable = true; - - # 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; - - # The platform the configuration will be used on. - nixpkgs.hostPlatform = "aarch64-darwin"; - }; - in - { - # Build darwin flake using: - # $ darwin-rebuild build --flake .#simple - darwinConfigurations."macbook" = nix-darwin.lib.darwinSystem { - modules = [ configuration ]; - }; - }; -} diff --git a/taskfile.yml b/taskfile.yml index 2772602..4b0da86 100644 --- a/taskfile.yml +++ b/taskfile.yml @@ -91,5 +91,6 @@ tasks: nix:nix-darwin:flake:switch: desc: Switches to the MacOS flake + dir: 'config/nix/.config/nix-darwin' cmds: - - nix run nix-darwin --extra-experimental-features "nix-command flakes" -- switch --flake config/nix/nix-darwin#macbook + - nix run nix-darwin --extra-experimental-features "nix-command flakes" -- switch --flake .#macbook From 70bd670ee4d5a084eff4e261acf7e426dea33560 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Sun, 5 Jan 2025 09:18:17 +0100 Subject: [PATCH 05/41] fix: version must be an int --- config/nix/.config/nix-darwin/flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/nix/.config/nix-darwin/flake.nix b/config/nix/.config/nix-darwin/flake.nix index 8702849..5f6fae5 100644 --- a/config/nix/.config/nix-darwin/flake.nix +++ b/config/nix/.config/nix-darwin/flake.nix @@ -15,7 +15,7 @@ configuration = { config, pkgs, ... }: { # Compatibility, please read the changelog before changing. # $ darwin-rebuild changelog - system.stateVersion = "5"; + system.stateVersion = 5; # The platform the configuration will be used on. nixpkgs.hostPlatform = system; From dc16045073dbabf179f3b503fb70562fef00f977 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Sun, 5 Jan 2025 09:18:23 +0100 Subject: [PATCH 06/41] chore: add lock file --- config/nix/.config/nix-darwin/flake.lock | 60 ++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 config/nix/.config/nix-darwin/flake.lock diff --git a/config/nix/.config/nix-darwin/flake.lock b/config/nix/.config/nix-darwin/flake.lock new file mode 100644 index 0000000..5ae4b34 --- /dev/null +++ b/config/nix/.config/nix-darwin/flake.lock @@ -0,0 +1,60 @@ +{ + "nodes": { + "nix-darwin": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1736002328, + "narHash": "sha256-anoVvML2D+nLfHlBfhEcCMjTou/9SRrrlqQN+Ug39ws=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "a464e5ba8cfb10a81599dbd422f30f5d37997916", + "type": "github" + }, + "original": { + "owner": "LnL7", + "repo": "nix-darwin", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1718149104, + "narHash": "sha256-Ds1QpobBX2yoUDx9ZruqVGJ/uQPgcXoYuobBguyKEh8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e913ae340076bbb73d9f4d3d065c2bca7caafb16", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1735834308, + "narHash": "sha256-dklw3AXr3OGO4/XT1Tu3Xz9n/we8GctZZ75ZWVqAVhk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6df24922a1400241dae323af55f30e4318a6ca65", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nix-darwin": "nix-darwin", + "nixpkgs": "nixpkgs_2" + } + } + }, + "root": "root", + "version": 7 +} From db6b83bddf7c5ba7c5465244662131e15e4550a1 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Sun, 5 Jan 2025 09:20:08 +0100 Subject: [PATCH 07/41] ref: use var --- taskfile.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/taskfile.yml b/taskfile.yml index 4b0da86..5da9992 100644 --- a/taskfile.yml +++ b/taskfile.yml @@ -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'] @@ -84,13 +85,13 @@ tasks: nix:nix-darwin:flake:init: desc: Initializes nix-darwin flake, as per https://youtu.be/Z8BL8mdzWHI?si=azkz7EwYHTEUBCz3 - dir: 'config/nix/.config/nix-darwin' + 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:nix-darwin:flake:switch: desc: Switches to the MacOS flake - dir: 'config/nix/.config/nix-darwin' + dir: '{{.NIX_DARWIN_FLAKE_PATH}}' cmds: - nix run nix-darwin --extra-experimental-features "nix-command flakes" -- switch --flake .#macbook From 4c94b5bbe574f8915fd35842d2ac5ee22fc05489 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Sun, 5 Jan 2025 09:46:07 +0100 Subject: [PATCH 08/41] chore: revert file --- config/nix/.config/nix-darwin/flake.lock | 28 ++++-------- config/nix/.config/nix-darwin/flake.nix | 57 ++++++++++++++---------- 2 files changed, 42 insertions(+), 43 deletions(-) diff --git a/config/nix/.config/nix-darwin/flake.lock b/config/nix/.config/nix-darwin/flake.lock index 5ae4b34..53f05d1 100644 --- a/config/nix/.config/nix-darwin/flake.lock +++ b/config/nix/.config/nix-darwin/flake.lock @@ -2,7 +2,9 @@ "nodes": { "nix-darwin": { "inputs": { - "nixpkgs": "nixpkgs" + "nixpkgs": [ + "nixpkgs" + ] }, "locked": { "lastModified": 1736002328, @@ -20,30 +22,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1718149104, - "narHash": "sha256-Ds1QpobBX2yoUDx9ZruqVGJ/uQPgcXoYuobBguyKEh8=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "e913ae340076bbb73d9f4d3d065c2bca7caafb16", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1735834308, - "narHash": "sha256-dklw3AXr3OGO4/XT1Tu3Xz9n/we8GctZZ75ZWVqAVhk=", + "lastModified": 1735915915, + "narHash": "sha256-Q4HuFAvoKAIiTRZTUxJ0ZXeTC7lLfC9/dggGHNXNlCw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6df24922a1400241dae323af55f30e4318a6ca65", + "rev": "a27871180d30ebee8aa6b11bf7fef8a52f024733", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } @@ -51,7 +39,7 @@ "root": { "inputs": { "nix-darwin": "nix-darwin", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs" } } }, diff --git a/config/nix/.config/nix-darwin/flake.nix b/config/nix/.config/nix-darwin/flake.nix index 5f6fae5..8f35ae2 100644 --- a/config/nix/.config/nix-darwin/flake.nix +++ b/config/nix/.config/nix-darwin/flake.nix @@ -1,32 +1,43 @@ { - description = "Flake for macOS configuration"; + description = "Custom nix-darwin system flake"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; nix-darwin.url = "github:LnL7/nix-darwin"; + nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = { self, nixpkgs, nix-darwin, ... }: - let - system = "aarch64-darwin"; - pkgs = import nixpkgs { - inherit system; - }; - configuration = { config, pkgs, ... }: { - # Compatibility, please read the changelog before changing. - # $ darwin-rebuild changelog - system.stateVersion = 5; + outputs = inputs@{ self, nix-darwin, nixpkgs }: + let + configuration = { pkgs, ... }: { + # List packages installed in system profile. To search by name, run: + # $ nix-env -qaP | grep wget + environment.systemPackages = + [ pkgs.vim + ]; - # The platform the configuration will be used on. - nixpkgs.hostPlatform = system; - }; - in - { - darwinConfigurations = { - macbook = nix-darwin.lib.darwinSystem { - system = system; - modules = [ configuration ]; - }; - }; + # Necessary for using flakes on this system. + nix.settings.experimental-features = "nix-command flakes"; + + # Enable alternative shell support in nix-darwin. + # programs.fish.enable = true; + + # 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; + + # The platform the configuration will be used on. + nixpkgs.hostPlatform = "aarch64-darwin"; + }; + in + { + # Build darwin flake using: + # $ darwin-rebuild build --flake .#macbook + darwinConfigurations."macbook" = nix-darwin.lib.darwinSystem { + modules = [ configuration ]; }; + }; } From f7df3187abd2cc4a38d15d8a388f82dcf055a567 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Sun, 5 Jan 2025 09:46:18 +0100 Subject: [PATCH 09/41] feat: add rebuild task --- taskfile.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/taskfile.yml b/taskfile.yml index 5da9992..f15860f 100644 --- a/taskfile.yml +++ b/taskfile.yml @@ -95,3 +95,10 @@ tasks: dir: '{{.NIX_DARWIN_FLAKE_PATH}}' cmds: - nix run nix-darwin --extra-experimental-features "nix-command flakes" -- switch --flake .#macbook + + nix:nix-darwin:flake:rebuild: + desc: Rebuilds the MacOS flake + dir: '{{.NIX_DARWIN_FLAKE_PATH}}' + cmds: + # - darwin-rebuild build --flake .#macbook + - nix run nix-darwin --extra-experimental-features "nix-command flakes" -- build --flake .#macbook From 29d8b2eee6241597ef057233749155652eecbf5b Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Sun, 5 Jan 2025 09:48:34 +0100 Subject: [PATCH 10/41] fix: ignore path --- config/nix/.config/nix-darwin/.gitignore | 1 + config/nix/.config/nix-darwin/result | 1 + 2 files changed, 2 insertions(+) create mode 100644 config/nix/.config/nix-darwin/.gitignore create mode 120000 config/nix/.config/nix-darwin/result diff --git a/config/nix/.config/nix-darwin/.gitignore b/config/nix/.config/nix-darwin/.gitignore new file mode 100644 index 0000000..1cd791b --- /dev/null +++ b/config/nix/.config/nix-darwin/.gitignore @@ -0,0 +1 @@ +result/ diff --git a/config/nix/.config/nix-darwin/result b/config/nix/.config/nix-darwin/result new file mode 120000 index 0000000..853a8ad --- /dev/null +++ b/config/nix/.config/nix-darwin/result @@ -0,0 +1 @@ +/nix/store/ibxgfcc5aafakab0xb9p57zvkv3rfzx7-darwin-system-25.05.20250103.a278711+darwin5.a464e5b \ No newline at end of file From b5c1e449e7ca49c624ed3464d1ce90089ef39482 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Sun, 5 Jan 2025 10:00:16 +0100 Subject: [PATCH 11/41] ref: use darwin-rebuild command --- taskfile.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/taskfile.yml b/taskfile.yml index f15860f..3921f83 100644 --- a/taskfile.yml +++ b/taskfile.yml @@ -99,6 +99,5 @@ tasks: nix:nix-darwin:flake:rebuild: desc: Rebuilds the MacOS flake dir: '{{.NIX_DARWIN_FLAKE_PATH}}' - cmds: - # - darwin-rebuild build --flake .#macbook - - nix run nix-darwin --extra-experimental-features "nix-command flakes" -- build --flake .#macbook + cmds: + - darwin-rebuild switch --flake .#macbook From d0f5c03a91697e9c7385b0135e5ddb3912cc77dc Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Sun, 5 Jan 2025 10:05:32 +0100 Subject: [PATCH 12/41] feat: allow unfree --- config/nix/.config/nix-darwin/flake.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/nix/.config/nix-darwin/flake.nix b/config/nix/.config/nix-darwin/flake.nix index 8f35ae2..69ce025 100644 --- a/config/nix/.config/nix-darwin/flake.nix +++ b/config/nix/.config/nix-darwin/flake.nix @@ -10,6 +10,9 @@ outputs = inputs@{ self, nix-darwin, nixpkgs }: let configuration = { pkgs, ... }: { + + nixpkgs.config.allowUnfree = true; + # List packages installed in system profile. To search by name, run: # $ nix-env -qaP | grep wget environment.systemPackages = From 14b0f1b0425738b5997fe342dced4304b350344c Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Sun, 5 Jan 2025 10:18:12 +0100 Subject: [PATCH 13/41] feat: add reqs from readme --- config/nix/.config/nix-darwin/flake.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config/nix/.config/nix-darwin/flake.nix b/config/nix/.config/nix-darwin/flake.nix index 69ce025..9861e27 100644 --- a/config/nix/.config/nix-darwin/flake.nix +++ b/config/nix/.config/nix-darwin/flake.nix @@ -16,7 +16,11 @@ # List packages installed in system profile. To search by name, run: # $ nix-env -qaP | grep wget environment.systemPackages = - [ pkgs.vim + [ + pkgs.git + pkgs.go-task + pkgs.neovim + pkgs.stow ]; # Necessary for using flakes on this system. From c888f5746bb6e8fbe3317d6f206ef1b224f20425 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Sun, 5 Jan 2025 10:28:40 +0100 Subject: [PATCH 14/41] feat: add system defaults --- config/nix/.config/nix-darwin/flake.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config/nix/.config/nix-darwin/flake.nix b/config/nix/.config/nix-darwin/flake.nix index 9861e27..1e9b612 100644 --- a/config/nix/.config/nix-darwin/flake.nix +++ b/config/nix/.config/nix-darwin/flake.nix @@ -36,6 +36,14 @@ # $ darwin-rebuild changelog system.stateVersion = 5; + security.pam.enableSudoTouchIdAuth = true; + + system.defaults = { + dock.autohide = true; + finder.FXPreferredViewStyle = "clmv"; + NSGlobalDomain.AppleInterfaceStyle = "Dark"; + }; + # The platform the configuration will be used on. nixpkgs.hostPlatform = "aarch64-darwin"; }; From 95ecbb237a1c9074f1182f220ddef965441189e3 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Sun, 16 Feb 2025 14:40:44 +0100 Subject: [PATCH 15/41] wip: update instructions --- README.md | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index fe805e5..99852fc 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,6 @@ My macOS configuration files. ## Setting up a new MacOS machine 🚀 -1. Install Homebrew: - -```sh -/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -``` - 1. Install Nix ```sh @@ -18,34 +12,28 @@ curl -L https://nixos.org/nix/install | sh Complete instructions can be found on the [Nix website](https://nix.dev/install-nix). -2. Install nix stuff: - -``` - -``` +2. Clone the repo. -3. Install requirements: +3. Initialize git submodules: ```sh -brew install git stow go-task +task git:submodules:update ``` -4. Clone the repo. - - -5. Initialize submodules: +4. Switch to the nix flake: ```sh -task git:submodules:update +cd config/nix/.config/nix-darwin +nix run nix-darwin --extra-experimental-features "nix-command flakes" -- switch --flake .#macbook ``` -6. Stow dotfiles: +5. Stow dotfiles: ```sh task stow:stow ``` -7. Install everything: +6. Install everything: ```sh task brew:bundle:install From 6745e45dd7c0da6ceee901f7ccda6a1ac203e45a Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Wed, 19 Feb 2025 14:38:17 +0100 Subject: [PATCH 16/41] doc: clean docs --- README.md | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 99852fc..eb287a1 100644 --- a/README.md +++ b/README.md @@ -4,27 +4,26 @@ My macOS configuration files. ## Setting up a new MacOS machine 🚀 -1. Install Nix +1. Install [Nix](https://nix.dev/install-nix): -```sh -curl -L https://nixos.org/nix/install | sh -``` + ```sh + curl -L https://nixos.org/nix/install | sh + ``` -Complete instructions can be found on the [Nix website](https://nix.dev/install-nix). +1. Clone the repo -2. Clone the repo. +2. Switch to the nix flake: -3. Initialize git submodules: + ```sh + cd config/nix/.config/nix-darwin + nix run nix-darwin --extra-experimental-features "nix-command flakes" -- switch --flake .#macbook + ``` -```sh -task git:submodules:update -``` - -4. Switch to the nix flake: + This will install basic dependencies (go-task, etc.) as well as configure macOS settings. +4. Initialize git submodules: ```sh -cd config/nix/.config/nix-darwin -nix run nix-darwin --extra-experimental-features "nix-command flakes" -- switch --flake .#macbook +task git:submodules:update ``` 5. Stow dotfiles: @@ -33,7 +32,7 @@ nix run nix-darwin --extra-experimental-features "nix-command flakes" -- switch task stow:stow ``` -6. Install everything: +6. Install everything using brew: ```sh task brew:bundle:install From 9db4eeddcd131a131196d4b895d5a12e425b3c33 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Wed, 19 Feb 2025 14:39:30 +0100 Subject: [PATCH 17/41] doc: fix numbering --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index eb287a1..2792857 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,9 @@ My macOS configuration files. curl -L https://nixos.org/nix/install | sh ``` -1. Clone the repo +2. Clone the repo -2. Switch to the nix flake: +3. Switch to the nix flake: ```sh cd config/nix/.config/nix-darwin @@ -20,6 +20,7 @@ My macOS configuration files. ``` This will install basic dependencies (go-task, etc.) as well as configure macOS settings. + 4. Initialize git submodules: ```sh From b7b503eb1c734b1302da3228f511d18d8672157e Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Wed, 19 Feb 2025 18:56:30 +0100 Subject: [PATCH 18/41] docs: clarify --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2792857..e2e8272 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ 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 as well, and installation instructions should become simpler, as everything will be done via Nix. + ## Setting up a new MacOS machine 🚀 1. Install [Nix](https://nix.dev/install-nix): @@ -19,7 +22,7 @@ My macOS configuration files. nix run nix-darwin --extra-experimental-features "nix-command flakes" -- switch --flake .#macbook ``` - This will install basic dependencies (go-task, etc.) as well as configure macOS settings. + This will configure macOS settings and install basic dependencies (go-task, etc.) 4. Initialize git submodules: From 1f7d3889b947397621e38ed9ba2ea6440c0e8676 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Wed, 19 Feb 2025 19:03:13 +0100 Subject: [PATCH 19/41] docs: min change --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e2e8272..1d55887 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ 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 as well, and installation instructions should become simpler, as everything will be done via Nix. +> 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 🚀 From 3141f9ccf67e1eaa31ac1a5dd22b8da9a801f4e5 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Wed, 19 Feb 2025 19:13:44 +0100 Subject: [PATCH 20/41] fix: rm temp result --- config/nix/.config/nix-darwin/result | 1 - 1 file changed, 1 deletion(-) delete mode 120000 config/nix/.config/nix-darwin/result diff --git a/config/nix/.config/nix-darwin/result b/config/nix/.config/nix-darwin/result deleted file mode 120000 index 853a8ad..0000000 --- a/config/nix/.config/nix-darwin/result +++ /dev/null @@ -1 +0,0 @@ -/nix/store/ibxgfcc5aafakab0xb9p57zvkv3rfzx7-darwin-system-25.05.20250103.a278711+darwin5.a464e5b \ No newline at end of file From 828fa8fa255344b829858fb99c0203266778f5f5 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Thu, 27 Mar 2025 12:19:58 +0100 Subject: [PATCH 21/41] feat: add garbage collection --- config/nix/.config/nix-darwin/flake.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config/nix/.config/nix-darwin/flake.nix b/config/nix/.config/nix-darwin/flake.nix index 1e9b612..ac2c82a 100644 --- a/config/nix/.config/nix-darwin/flake.nix +++ b/config/nix/.config/nix-darwin/flake.nix @@ -44,6 +44,15 @@ NSGlobalDomain.AppleInterfaceStyle = "Dark"; }; + # Automatic cleanup / garbage collection + nix.gc = { + automatic = true; + options = "--delete-generations +5"; + }; + nix.settings.keep-outputs = true; + nix.settings.keep-derivations = true; + nix.optimise.automatic = true; + # The platform the configuration will be used on. nixpkgs.hostPlatform = "aarch64-darwin"; }; From 63bab0cf0fd8e178f02fd58bf9e14f323107fd78 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Thu, 27 Mar 2025 12:28:12 +0100 Subject: [PATCH 22/41] ref: rearrange --- config/nix/.config/nix-darwin/flake.nix | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/config/nix/.config/nix-darwin/flake.nix b/config/nix/.config/nix-darwin/flake.nix index ac2c82a..4f09d46 100644 --- a/config/nix/.config/nix-darwin/flake.nix +++ b/config/nix/.config/nix-darwin/flake.nix @@ -12,6 +12,8 @@ configuration = { pkgs, ... }: { 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 @@ -23,8 +25,13 @@ pkgs.stow ]; - # Necessary for using flakes on this system. - nix.settings.experimental-features = "nix-command flakes"; + nix.settings = { + keep-outputs = true; + keep-derivations = true; + + # Necessary for using flakes on this system. + experimental-features = "nix-command flakes"; + }; # Enable alternative shell support in nix-darwin. # programs.fish.enable = true; @@ -44,17 +51,12 @@ NSGlobalDomain.AppleInterfaceStyle = "Dark"; }; - # Automatic cleanup / garbage collection + # Garbage collection nix.gc = { automatic = true; options = "--delete-generations +5"; }; - nix.settings.keep-outputs = true; - nix.settings.keep-derivations = true; nix.optimise.automatic = true; - - # The platform the configuration will be used on. - nixpkgs.hostPlatform = "aarch64-darwin"; }; in { From b96daa897ce384e999b23486d611941f2694da98 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Thu, 27 Mar 2025 12:43:23 +0100 Subject: [PATCH 23/41] feat: add flake update task --- config/nix/.config/nix-darwin/flake.lock | 12 ++++++------ taskfile.yml | 6 ++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/config/nix/.config/nix-darwin/flake.lock b/config/nix/.config/nix-darwin/flake.lock index 53f05d1..3d8ca1f 100644 --- a/config/nix/.config/nix-darwin/flake.lock +++ b/config/nix/.config/nix-darwin/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1736002328, - "narHash": "sha256-anoVvML2D+nLfHlBfhEcCMjTou/9SRrrlqQN+Ug39ws=", + "lastModified": 1742869675, + "narHash": "sha256-rgwUZJZVztaNYPTsf6MIqirPL5r2JTMMyHuzk1ezyYk=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "a464e5ba8cfb10a81599dbd422f30f5d37997916", + "rev": "bb81755a3674951724d79b8cba6bbff01409d44d", "type": "github" }, "original": { @@ -22,11 +22,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1735915915, - "narHash": "sha256-Q4HuFAvoKAIiTRZTUxJ0ZXeTC7lLfC9/dggGHNXNlCw=", + "lastModified": 1742923925, + "narHash": "sha256-biPjLws6FiBVUUDHEMFq5pUQL84Wf7PntPYdo3oKkFw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a27871180d30ebee8aa6b11bf7fef8a52f024733", + "rev": "25d1b84f5c90632a623c48d83a2faf156451e6b1", "type": "github" }, "original": { diff --git a/taskfile.yml b/taskfile.yml index 3921f83..e913646 100644 --- a/taskfile.yml +++ b/taskfile.yml @@ -101,3 +101,9 @@ tasks: dir: '{{.NIX_DARWIN_FLAKE_PATH}}' cmds: - darwin-rebuild switch --flake .#macbook + + nix:nix-darwin:flake:update: + desc: Updates the MacOS flake lock file + dir: '{{.NIX_DARWIN_FLAKE_PATH}}' + cmds: + - nix flake update From dfefd21066237b0623340d4bc4a48e9d5fefc476 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Thu, 27 Mar 2025 12:44:24 +0100 Subject: [PATCH 24/41] chore: fix nix tasks naming --- taskfile.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/taskfile.yml b/taskfile.yml index e913646..648afcc 100644 --- a/taskfile.yml +++ b/taskfile.yml @@ -83,26 +83,26 @@ tasks: cmds: - curl -L https://nixos.org/nix/install | sh - nix:nix-darwin:flake:init: + 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:nix-darwin:flake:switch: + 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:nix-darwin:flake:rebuild: + nix:flake:rebuild:nix-darwin: desc: Rebuilds the MacOS flake dir: '{{.NIX_DARWIN_FLAKE_PATH}}' cmds: - darwin-rebuild switch --flake .#macbook - nix:nix-darwin:flake:update: + nix:flake:update:nix-darwin: desc: Updates the MacOS flake lock file dir: '{{.NIX_DARWIN_FLAKE_PATH}}' cmds: From 26499c5f547425591f4ffe36f4384ac0cc0590a9 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Thu, 27 Mar 2025 13:21:57 +0100 Subject: [PATCH 25/41] fix: update deprecated config --- config/nix/.config/nix-darwin/flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/nix/.config/nix-darwin/flake.nix b/config/nix/.config/nix-darwin/flake.nix index 4f09d46..3171bc9 100644 --- a/config/nix/.config/nix-darwin/flake.nix +++ b/config/nix/.config/nix-darwin/flake.nix @@ -43,7 +43,7 @@ # $ darwin-rebuild changelog system.stateVersion = 5; - security.pam.enableSudoTouchIdAuth = true; + security.pam.services.sudo_local.touchIdAuth = true; system.defaults = { dock.autohide = true; From 8ee6906bc8459ebd16c807adf99486ffd2a77e0b Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Thu, 27 Mar 2025 13:24:36 +0100 Subject: [PATCH 26/41] fix: default Nix build user group ID changed --- config/nix/.config/nix-darwin/flake.nix | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/config/nix/.config/nix-darwin/flake.nix b/config/nix/.config/nix-darwin/flake.nix index 3171bc9..abe9d0e 100644 --- a/config/nix/.config/nix-darwin/flake.nix +++ b/config/nix/.config/nix-darwin/flake.nix @@ -11,7 +11,23 @@ let configuration = { pkgs, ... }: { - nixpkgs.config.allowUnfree = true; +# fix: default Nix build user group ID changed + # error: Build user group has mismatching GID, aborting activation + # The default Nix build user group ID was changed from 30000 to 350. + # You are currently managing Nix build users with nix-darwin, but your + # nixbld group has GID 30000, whereas we expected 350. + # Possible causes include setting up a new Nix installation with an + # existing nix-darwin configuration, setting up a new nix-darwin + # installation with an existing Nix installation, or manually increasing + # your `system.stateVersion` setting. + # You can set the configured group ID to match the actual value: + # 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. This is because the group ID is used in many places in the Nix + ids.gids.nixbld = 30000; + + nixpkgs.config.allowUnfree = true; # The platform the configuration will be used on. nixpkgs.hostPlatform = "aarch64-darwin"; From 516f9422f557b72933901540046b968fab09af11 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Thu, 27 Mar 2025 13:25:04 +0100 Subject: [PATCH 27/41] ref: simplify --- config/nix/.config/nix-darwin/flake.nix | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/config/nix/.config/nix-darwin/flake.nix b/config/nix/.config/nix-darwin/flake.nix index abe9d0e..9a98a14 100644 --- a/config/nix/.config/nix-darwin/flake.nix +++ b/config/nix/.config/nix-darwin/flake.nix @@ -11,7 +11,7 @@ let configuration = { pkgs, ... }: { -# fix: default Nix build user group ID changed + # fix: default Nix build user group ID changed # error: Build user group has mismatching GID, aborting activation # The default Nix build user group ID was changed from 30000 to 350. # You are currently managing Nix build users with nix-darwin, but your @@ -27,19 +27,18 @@ # of Nix. This is because the group ID is used in many places in the Nix ids.gids.nixbld = 30000; - nixpkgs.config.allowUnfree = true; + 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 = - [ - pkgs.git - pkgs.go-task - pkgs.neovim - pkgs.stow - ]; + environment.systemPackages = with pkgs; [ + git + go-task + neovim + stow + ]; nix.settings = { keep-outputs = true; From afd0845a4246b5aa0820cca70b2d8701260287f5 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Thu, 27 Mar 2025 13:27:48 +0100 Subject: [PATCH 28/41] chore: fix tabspace --- config/nix/.config/nix-darwin/flake.nix | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/config/nix/.config/nix-darwin/flake.nix b/config/nix/.config/nix-darwin/flake.nix index 9a98a14..f9d2687 100644 --- a/config/nix/.config/nix-darwin/flake.nix +++ b/config/nix/.config/nix-darwin/flake.nix @@ -11,20 +11,20 @@ let configuration = { pkgs, ... }: { - # fix: default Nix build user group ID changed - # error: Build user group has mismatching GID, aborting activation - # The default Nix build user group ID was changed from 30000 to 350. - # You are currently managing Nix build users with nix-darwin, but your - # nixbld group has GID 30000, whereas we expected 350. - # Possible causes include setting up a new Nix installation with an - # existing nix-darwin configuration, setting up a new nix-darwin - # installation with an existing Nix installation, or manually increasing - # your `system.stateVersion` setting. - # You can set the configured group ID to match the actual value: - # 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. This is because the group ID is used in many places in the Nix + # fix: default Nix build user group ID changed + # error: Build user group has mismatching GID, aborting activation + # The default Nix build user group ID was changed from 30000 to 350. + # You are currently managing Nix build users with nix-darwin, but your + # nixbld group has GID 30000, whereas we expected 350. + # Possible causes include setting up a new Nix installation with an + # existing nix-darwin configuration, setting up a new nix-darwin + # installation with an existing Nix installation, or manually increasing + # your `system.stateVersion` setting. + # You can set the configured group ID to match the actual value: + # 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. This is because the group ID is used in many places in the Nix ids.gids.nixbld = 30000; nixpkgs.config.allowUnfree = true; From d532e5c2c0d0e5141d2bb57dcf58ce93d0491894 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Thu, 27 Mar 2025 13:29:44 +0100 Subject: [PATCH 29/41] chore: cleanup --- config/nix/.config/nix-darwin/flake.nix | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/config/nix/.config/nix-darwin/flake.nix b/config/nix/.config/nix-darwin/flake.nix index f9d2687..aa578b2 100644 --- a/config/nix/.config/nix-darwin/flake.nix +++ b/config/nix/.config/nix-darwin/flake.nix @@ -11,20 +11,8 @@ let configuration = { pkgs, ... }: { - # fix: default Nix build user group ID changed - # error: Build user group has mismatching GID, aborting activation - # The default Nix build user group ID was changed from 30000 to 350. - # You are currently managing Nix build users with nix-darwin, but your - # nixbld group has GID 30000, whereas we expected 350. - # Possible causes include setting up a new Nix installation with an - # existing nix-darwin configuration, setting up a new nix-darwin - # installation with an existing Nix installation, or manually increasing - # your `system.stateVersion` setting. - # You can set the configured group ID to match the actual value: - # 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. This is because the group ID is used in many places in the Nix + # 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. This is because the group ID is used in many places in the Nix ids.gids.nixbld = 30000; nixpkgs.config.allowUnfree = true; From 633fafb88685fb2020f2083c127f2fb6653478f1 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Thu, 27 Mar 2025 13:34:26 +0100 Subject: [PATCH 30/41] chore: cleanup --- config/nix/.config/nix-darwin/flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/nix/.config/nix-darwin/flake.nix b/config/nix/.config/nix-darwin/flake.nix index aa578b2..67ef9b3 100644 --- a/config/nix/.config/nix-darwin/flake.nix +++ b/config/nix/.config/nix-darwin/flake.nix @@ -12,7 +12,7 @@ configuration = { 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. This is because the group ID is used in many places in the Nix + # 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; From aec1ba3cecbe3da28fdb0b586d6f71b4800dfa1c Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Thu, 27 Mar 2025 22:38:11 +0100 Subject: [PATCH 31/41] feat: add homebrew --- config/nix/.config/nix-darwin/flake.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/config/nix/.config/nix-darwin/flake.nix b/config/nix/.config/nix-darwin/flake.nix index 67ef9b3..04d06f0 100644 --- a/config/nix/.config/nix-darwin/flake.nix +++ b/config/nix/.config/nix-darwin/flake.nix @@ -28,6 +28,23 @@ stow ]; + # Enable and configure Homebrew + homebrew = { + enable = true; + onActivation = { + autoUpdate = false; + cleanup = "none"; + }; + global = { + brewfile = false; + }; + # taps = []; + # brews = []; + # casks = []; + # masApps = []; + # whalebrews = []; + }; + nix.settings = { keep-outputs = true; keep-derivations = true; From 73e60c8d2dae7d2dd407ed446a706199179451fb Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Sun, 30 Mar 2025 11:13:12 +0200 Subject: [PATCH 32/41] feat: show all extensions --- config/nix/.config/nix-darwin/flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/config/nix/.config/nix-darwin/flake.nix b/config/nix/.config/nix-darwin/flake.nix index 04d06f0..65cd2f9 100644 --- a/config/nix/.config/nix-darwin/flake.nix +++ b/config/nix/.config/nix-darwin/flake.nix @@ -68,6 +68,7 @@ system.defaults = { dock.autohide = true; finder.FXPreferredViewStyle = "clmv"; + finder.AppleShowAllExtensions = true; NSGlobalDomain.AppleInterfaceStyle = "Dark"; }; From 6e1f0fdcaae437895f3e920959db59894c58e8b3 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Sun, 30 Mar 2025 12:03:04 +0200 Subject: [PATCH 33/41] feat: add nixfmt --- config/nix/.config/nix-darwin/flake.nix | 140 +++++++++++++----------- taskfile.yml | 8 +- 2 files changed, 81 insertions(+), 67 deletions(-) diff --git a/config/nix/.config/nix-darwin/flake.nix b/config/nix/.config/nix-darwin/flake.nix index 65cd2f9..2ce1598 100644 --- a/config/nix/.config/nix-darwin/flake.nix +++ b/config/nix/.config/nix-darwin/flake.nix @@ -7,84 +7,92 @@ nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = inputs@{ self, nix-darwin, nixpkgs }: - let - configuration = { pkgs, ... }: { + outputs = + inputs@{ + self, + nix-darwin, + nixpkgs, + }: + let + configuration = + { 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; + # 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"; + 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; [ - git - go-task - neovim - stow - ]; + # List packages installed in system profile. To search by name, run: + # $ nix-env -qaP | grep wget + environment.systemPackages = with pkgs; [ + git + go-task + neovim + stow + nixfmt-rfc-style + ]; - # Enable and configure Homebrew - homebrew = { - enable = true; - onActivation = { - autoUpdate = false; - cleanup = "none"; - }; - global = { - brewfile = false; - }; - # taps = []; - # brews = []; - # casks = []; - # masApps = []; - # whalebrews = []; - }; + # Enable and configure Homebrew + homebrew = { + enable = true; + onActivation = { + autoUpdate = false; + cleanup = "none"; + }; + global = { + brewfile = false; + }; + # taps = []; + # brews = []; + # casks = []; + # masApps = []; + # whalebrews = []; + }; - nix.settings = { - keep-outputs = true; - keep-derivations = true; + nix.settings = { + keep-outputs = true; + keep-derivations = true; - # Necessary for using flakes on this system. - experimental-features = "nix-command flakes"; - }; + # Necessary for using flakes on this system. + experimental-features = "nix-command flakes"; + }; - # Enable alternative shell support in nix-darwin. - # programs.fish.enable = true; + # Enable alternative shell support in nix-darwin. + # programs.fish.enable = true; - # Set Git commit hash for darwin-version. - system.configurationRevision = self.rev or self.dirtyRev or null; + # 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; + # Used for backwards compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = 5; - security.pam.services.sudo_local.touchIdAuth = true; + security.pam.services.sudo_local.touchIdAuth = true; - system.defaults = { - dock.autohide = true; - finder.FXPreferredViewStyle = "clmv"; - finder.AppleShowAllExtensions = true; - NSGlobalDomain.AppleInterfaceStyle = "Dark"; - }; + system.defaults = { + dock.autohide = true; + finder.FXPreferredViewStyle = "clmv"; + finder.AppleShowAllExtensions = true; + NSGlobalDomain.AppleInterfaceStyle = "Dark"; + }; - # Garbage collection - nix.gc = { - automatic = true; - options = "--delete-generations +5"; + # Garbage collection + nix.gc = { + automatic = true; + options = "--delete-generations +5"; + }; + nix.optimise.automatic = true; + }; + in + { + # Build darwin flake using: + # $ darwin-rebuild build --flake .#macbook + darwinConfigurations."macbook" = nix-darwin.lib.darwinSystem { + modules = [ configuration ]; }; - nix.optimise.automatic = true; }; - in - { - # Build darwin flake using: - # $ darwin-rebuild build --flake .#macbook - darwinConfigurations."macbook" = nix-darwin.lib.darwinSystem { - modules = [ configuration ]; - }; - }; } diff --git a/taskfile.yml b/taskfile.yml index 648afcc..56f0717 100644 --- a/taskfile.yml +++ b/taskfile.yml @@ -99,7 +99,7 @@ tasks: nix:flake:rebuild:nix-darwin: desc: Rebuilds the MacOS flake dir: '{{.NIX_DARWIN_FLAKE_PATH}}' - cmds: + cmds: - darwin-rebuild switch --flake .#macbook nix:flake:update:nix-darwin: @@ -107,3 +107,9 @@ tasks: 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 From f16bf3d42273d0a95541c9165c2daff8227183b6 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Sun, 30 Mar 2025 23:19:15 +0200 Subject: [PATCH 34/41] ref: move config to own file --- .../nix/.config/nix-darwin/configuration.nix | 72 +++++++++++++++++ config/nix/.config/nix-darwin/flake.nix | 77 +------------------ 2 files changed, 73 insertions(+), 76 deletions(-) create mode 100644 config/nix/.config/nix-darwin/configuration.nix diff --git a/config/nix/.config/nix-darwin/configuration.nix b/config/nix/.config/nix-darwin/configuration.nix new file mode 100644 index 0000000..10dfdb8 --- /dev/null +++ b/config/nix/.config/nix-darwin/configuration.nix @@ -0,0 +1,72 @@ +{ 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; [ + git + go-task + neovim + stow + nixfmt-rfc-style + ]; + + # Enable and configure Homebrew + homebrew = { + enable = true; + onActivation = { + autoUpdate = false; + cleanup = "none"; + }; + global = { + brewfile = false; + }; + # taps = []; + # brews = []; + # casks = []; + # masApps = []; + # whalebrews = []; + }; + + nix.settings = { + keep-outputs = true; + keep-derivations = true; + + # Necessary for using flakes on this system. + experimental-features = "nix-command flakes"; + }; + + # Enable alternative shell support in nix-darwin. + # programs.fish.enable = true; + + # 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; +} diff --git a/config/nix/.config/nix-darwin/flake.nix b/config/nix/.config/nix-darwin/flake.nix index 2ce1598..03f86a6 100644 --- a/config/nix/.config/nix-darwin/flake.nix +++ b/config/nix/.config/nix-darwin/flake.nix @@ -13,86 +13,11 @@ nix-darwin, nixpkgs, }: - let - configuration = - { 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; [ - git - go-task - neovim - stow - nixfmt-rfc-style - ]; - - # Enable and configure Homebrew - homebrew = { - enable = true; - onActivation = { - autoUpdate = false; - cleanup = "none"; - }; - global = { - brewfile = false; - }; - # taps = []; - # brews = []; - # casks = []; - # masApps = []; - # whalebrews = []; - }; - - nix.settings = { - keep-outputs = true; - keep-derivations = true; - - # Necessary for using flakes on this system. - experimental-features = "nix-command flakes"; - }; - - # Enable alternative shell support in nix-darwin. - # programs.fish.enable = true; - - # 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; - }; - in { # Build darwin flake using: # $ darwin-rebuild build --flake .#macbook darwinConfigurations."macbook" = nix-darwin.lib.darwinSystem { - modules = [ configuration ]; + modules = [ ./configuration.nix ]; }; }; } From 757c5fa93490c9b994ee86e64d98feb711034434 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Mon, 31 Mar 2025 00:18:39 +0200 Subject: [PATCH 35/41] feat: add dry run task --- taskfile.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/taskfile.yml b/taskfile.yml index 56f0717..82e2d62 100644 --- a/taskfile.yml +++ b/taskfile.yml @@ -102,6 +102,12 @@ tasks: 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}}' From 011b0cafba13f1fa3ed3aed8ce2f0ec6deda0b30 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Mon, 31 Mar 2025 00:24:38 +0200 Subject: [PATCH 36/41] chore: cleanup --- .../nix/.config/nix-darwin/configuration.nix | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/config/nix/.config/nix-darwin/configuration.nix b/config/nix/.config/nix-darwin/configuration.nix index 10dfdb8..04ea266 100644 --- a/config/nix/.config/nix-darwin/configuration.nix +++ b/config/nix/.config/nix-darwin/configuration.nix @@ -12,6 +12,7 @@ # 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 @@ -19,23 +20,6 @@ nixfmt-rfc-style ]; - # Enable and configure Homebrew - homebrew = { - enable = true; - onActivation = { - autoUpdate = false; - cleanup = "none"; - }; - global = { - brewfile = false; - }; - # taps = []; - # brews = []; - # casks = []; - # masApps = []; - # whalebrews = []; - }; - nix.settings = { keep-outputs = true; keep-derivations = true; @@ -44,9 +28,6 @@ experimental-features = "nix-command flakes"; }; - # Enable alternative shell support in nix-darwin. - # programs.fish.enable = true; - # Set Git commit hash for darwin-version. # system.configurationRevision = self.rev or self.dirtyRev or null; From d3bcdec182cda3a689ba3e319ad660e0aa4c06d5 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Mon, 31 Mar 2025 00:30:25 +0200 Subject: [PATCH 37/41] docs: restore brew installation step --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1d55887..c530b99 100644 --- a/README.md +++ b/README.md @@ -24,19 +24,25 @@ My macOS configuration files. This will configure macOS settings and install basic dependencies (go-task, etc.) -4. Initialize git submodules: +4. Install Homebrew: + + ```sh + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + ``` + +5. Initialize git submodules: ```sh task git:submodules:update ``` -5. Stow dotfiles: +6. Stow dotfiles: ```sh task stow:stow ``` -6. Install everything using brew: +7. Install everything using brew: ```sh task brew:bundle:install From bdce20b2b1422520696206e9acdd857b7bb71f2a Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Mon, 31 Mar 2025 00:36:33 +0200 Subject: [PATCH 38/41] docs: update --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index c530b99..7a365e3 100644 --- a/README.md +++ b/README.md @@ -27,23 +27,23 @@ My macOS configuration files. 4. Install Homebrew: ```sh - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + task brew:install ``` - + 5. Initialize git submodules: -```sh -task git:submodules:update -``` + ```sh + task git:submodules:update + ``` 6. Stow dotfiles: -```sh -task stow:stow -``` + ```sh + task stow:stow + ``` 7. Install everything using brew: -```sh -task brew:bundle:install -``` + ```sh + task brew:bundle:install + ``` From b57a445be414dba413f09d625bc6e19f218623cb Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Mon, 31 Mar 2025 00:53:45 +0200 Subject: [PATCH 39/41] docs: simplify --- README.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 7a365e3..da9b1e1 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,10 @@ My macOS configuration files. 2. Clone the repo + ```sh + git clone --recurse-submodules https://github.com/legomb/dotfiles.git + ``` + 3. Switch to the nix flake: ```sh @@ -30,19 +34,13 @@ My macOS configuration files. task brew:install ``` -5. Initialize git submodules: - - ```sh - task git:submodules:update - ``` - -6. Stow dotfiles: +5. Stow dotfiles: ```sh task stow:stow ``` -7. Install everything using brew: +6. Install everything using brew: ```sh task brew:bundle:install From 4fe696e6f8bbbd8d02a1678df7c50029eed4f55c Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Mon, 31 Mar 2025 00:58:30 +0200 Subject: [PATCH 40/41] chore: keep dir as placeholder --- config/nix/.config/nix-darwin/modules/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 config/nix/.config/nix-darwin/modules/.gitkeep diff --git a/config/nix/.config/nix-darwin/modules/.gitkeep b/config/nix/.config/nix-darwin/modules/.gitkeep new file mode 100644 index 0000000..e69de29 From c84f82dfb4a51d2b13647f521dd1ba180e7a66b3 Mon Sep 17 00:00:00 2001 From: Javier Gombinsky Date: Thu, 22 May 2025 08:30:09 +0200 Subject: [PATCH 41/41] chore: add font for powerlevel10k --- config/brew/Brewfile | 1 + 1 file changed, 1 insertion(+) diff --git a/config/brew/Brewfile b/config/brew/Brewfile index 5d48024..f7de933 100644 --- a/config/brew/Brewfile +++ b/config/brew/Brewfile @@ -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"