From 44e501b67f4800029cc62459a12212083feee882 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Wed, 16 Apr 2025 22:56:54 +0200 Subject: [PATCH] Better handling of work/personal darwin machine, remove clang & -tools from work and add llvm via brew instead. --- flake.nix | 75 +++++++++++++++++++++++------------- nix/home.nix | 2 - nix/pkgs/darwin_personal.nix | 10 +++++ nix/pkgs/darwin_work.nix | 2 - nix/pkgs/home.nix | 2 - nix/pkgs/linux.nix | 2 + nix/pkgs/wsl.nix | 2 + nix/system/darwin_work.nix | 11 ++++++ 8 files changed, 73 insertions(+), 33 deletions(-) create mode 100644 nix/pkgs/darwin_personal.nix create mode 100644 nix/system/darwin_work.nix diff --git a/flake.nix b/flake.nix index 63ebd23..48457cf 100644 --- a/flake.nix +++ b/flake.nix @@ -133,36 +133,54 @@ darwinConfigurations = let - baseDarwinConfig = makeSystemConfig { - name = "darwin"; - system = "aarch64-darwin"; - builder = nix-darwin.lib.darwinSystem; - extraModules = [ - ./nix/system/darwin.nix - nix-homebrew.darwinModules.nix-homebrew - { - nix-homebrew = { - enable = true; - enableRosetta = true; - user = "larssonmartin1998-mac"; - taps = { - "homebrew/core" = homebrew-core; - "homebrew/cask" = homebrew-cask; - "homebrew/bundle" = homebrew-bundle; - "nikitabobko/tap" = homebrew-nikitabobko; + makeDarwinSystem = + { + name, + user, + extraModules ? [ ], + }: + makeSystemConfig { + inherit name; + system = "aarch64-darwin"; + builder = nix-darwin.lib.darwinSystem; + + extraModules = [ + ./nix/system/darwin.nix + nix-homebrew.darwinModules.nix-homebrew + { + nix-homebrew = { + enable = true; + enableRosetta = true; + user = user; # pass the user parameter + taps = { + "homebrew/core" = homebrew-core; + "homebrew/cask" = homebrew-cask; + "homebrew/bundle" = homebrew-bundle; + "nikitabobko/tap" = homebrew-nikitabobko; + }; + mutableTaps = false; }; - mutableTaps = false; - }; - } - ]; - specialArgs = { - self = self; + } + ] ++ extraModules; + + specialArgs = { + self = self; + }; }; - }; in { - "darwin" = baseDarwinConfig; - "darwin_work" = baseDarwinConfig; + darwin = makeDarwinSystem { + name = "darwin"; + user = "larssonmartin1998-mac"; + }; + + darwin_work = makeDarwinSystem { + name = "darwin_work"; + user = "martin.larsson"; + extraModules = [ + ./nix/system/darwin_work.nix + ]; + }; }; homeConfigurations = { @@ -187,7 +205,10 @@ "darwin" = makeHomeConfig { name = "darwin"; system = "aarch64-darwin"; - extraModules = [ ./nix/pkgs/darwin.nix ]; + extraModules = [ + ./nix/pkgs/darwin.nix + ./nix/pkgs/darwin_personal.nix + ]; }; "darwin_work" = makeHomeConfig { diff --git a/nix/home.nix b/nix/home.nix index f9bc89c..31adef5 100644 --- a/nix/home.nix +++ b/nix/home.nix @@ -23,8 +23,6 @@ jq starship fastfetch - clang - clang-tools nixfmt-rfc-style luajit zoxide diff --git a/nix/pkgs/darwin_personal.nix b/nix/pkgs/darwin_personal.nix new file mode 100644 index 0000000..5e86ce3 --- /dev/null +++ b/nix/pkgs/darwin_personal.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: +{ + home = { + packages = with pkgs; [ + clang + clang-tools + ]; + }; + +} diff --git a/nix/pkgs/darwin_work.nix b/nix/pkgs/darwin_work.nix index a1fc7ac..8405f7e 100644 --- a/nix/pkgs/darwin_work.nix +++ b/nix/pkgs/darwin_work.nix @@ -9,8 +9,6 @@ pcre ccache mkdocs - # jdk - # jdk21 ]; }; diff --git a/nix/pkgs/home.nix b/nix/pkgs/home.nix index 7edc009..2b82d72 100644 --- a/nix/pkgs/home.nix +++ b/nix/pkgs/home.nix @@ -112,8 +112,6 @@ in ninja tldr nerd-fonts.caskaydia-mono - # clang - # clang-tools lldb nodejs tree-sitter diff --git a/nix/pkgs/linux.nix b/nix/pkgs/linux.nix index b22dbc4..9bf1ed0 100644 --- a/nix/pkgs/linux.nix +++ b/nix/pkgs/linux.nix @@ -4,6 +4,8 @@ packages = with pkgs; [ wl-clipboard-rs sway + clang + clang-tools ]; file = { ".config/sway".source = ../sway; diff --git a/nix/pkgs/wsl.nix b/nix/pkgs/wsl.nix index 6df1c82..7ca6434 100644 --- a/nix/pkgs/wsl.nix +++ b/nix/pkgs/wsl.nix @@ -3,6 +3,8 @@ home = { packages = with pkgs; [ wslu + clang + clang-tools ]; }; } diff --git a/nix/system/darwin_work.nix b/nix/system/darwin_work.nix new file mode 100644 index 0000000..75376a4 --- /dev/null +++ b/nix/system/darwin_work.nix @@ -0,0 +1,11 @@ +{ + ... +}: +{ + homebrew = { + brews = [ + "openjdk" + "llvm" + ]; + }; +}