From e67f14395ae48a61f4f888c1e861e92957cee3c2 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Fri, 11 Apr 2025 10:27:39 +0200 Subject: [PATCH 1/4] Add ruby to treesitter --- nvim/lua/plugs/treesitter.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/lua/plugs/treesitter.lua b/nvim/lua/plugs/treesitter.lua index 1ca9ac1..04a099c 100644 --- a/nvim/lua/plugs/treesitter.lua +++ b/nvim/lua/plugs/treesitter.lua @@ -49,6 +49,7 @@ return { "python", "latex", "typst", + "ruby", }, sync_install = false, -- This can be updated to a list of languages instead of defaulting to true From 04ffc6f57ee36d1aebaa0812409d564a8aebb21f Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Fri, 11 Apr 2025 10:27:56 +0200 Subject: [PATCH 2/4] Fix: format keybinding now actually formats the code if format on save is disabled --- nvim/lua/format_handler.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/lua/format_handler.lua b/nvim/lua/format_handler.lua index fc539af..6d103bc 100644 --- a/nvim/lua/format_handler.lua +++ b/nvim/lua/format_handler.lua @@ -27,7 +27,7 @@ function M.setup() end utils.set_keymap_list({ - { "ff", function() M.format() end }, + { "ff", function() M.format(true) end }, { "fe", function() M.format_enable() end }, { "fd", function() M.format_disable() end }, }) From f15bbc57e21cf12ab490ea0c4635161285087964 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Wed, 16 Apr 2025 16:38:27 +0200 Subject: [PATCH 3/4] Merge main --- flake.nix | 2 +- nix/local_home.nix | 4 ++-- nix/local_system.nix | 4 +++- nix/pkgs/darwin_work.nix | 4 ++++ nix/pkgs/home.nix | 4 ++-- nix/system/darwin.nix | 2 +- nvim/lua/plugs/neogit.lua | 2 +- 7 files changed, 14 insertions(+), 8 deletions(-) diff --git a/flake.nix b/flake.nix index 4839c0a..63ebd23 100644 --- a/flake.nix +++ b/flake.nix @@ -151,7 +151,7 @@ "homebrew/bundle" = homebrew-bundle; "nikitabobko/tap" = homebrew-nikitabobko; }; - mutableTaps = true; + mutableTaps = false; }; } ]; diff --git a/nix/local_home.nix b/nix/local_home.nix index cad7a94..da758ab 100644 --- a/nix/local_home.nix +++ b/nix/local_home.nix @@ -6,7 +6,7 @@ # accordingly, and then commit it. home = { # Stub values for demonstration. Override these in local branch. - username = "nixos"; - homeDirectory = "/home/nixos"; + username = "martin.larsson"; + homeDirectory = "/Users/martin.larsson"; }; } diff --git a/nix/local_system.nix b/nix/local_system.nix index 6bdfb5f..e916e9c 100644 --- a/nix/local_system.nix +++ b/nix/local_system.nix @@ -3,6 +3,8 @@ }: { system = { - stateVersion = "24.11"; + stateVersion = 5; }; + + nix-homebrew.user = "martin.larsson"; } diff --git a/nix/pkgs/darwin_work.nix b/nix/pkgs/darwin_work.nix index 02947f4..a1fc7ac 100644 --- a/nix/pkgs/darwin_work.nix +++ b/nix/pkgs/darwin_work.nix @@ -8,6 +8,10 @@ ])) pcre ccache + mkdocs + # jdk + # jdk21 ]; }; + } diff --git a/nix/pkgs/home.nix b/nix/pkgs/home.nix index 2053ed0..7edc009 100644 --- a/nix/pkgs/home.nix +++ b/nix/pkgs/home.nix @@ -112,8 +112,8 @@ in ninja tldr nerd-fonts.caskaydia-mono - clang - clang-tools + # clang + # clang-tools lldb nodejs tree-sitter diff --git a/nix/system/darwin.nix b/nix/system/darwin.nix index 6a8eed8..35fd1dd 100644 --- a/nix/system/darwin.nix +++ b/nix/system/darwin.nix @@ -65,7 +65,7 @@ enableKeyMapping = true; nonUS.remapTilde = true; remapCapsLockToEscape = true; - swapLeftCtrlAndFn = true; + swapLeftCtrlAndFn = false; }; activationScripts.applications.text = let diff --git a/nvim/lua/plugs/neogit.lua b/nvim/lua/plugs/neogit.lua index e510511..8f171d5 100644 --- a/nvim/lua/plugs/neogit.lua +++ b/nvim/lua/plugs/neogit.lua @@ -16,6 +16,6 @@ return { lazy = true, opts = {}, keys = { - { "g", function() require("neogit").open({ kind = "vsplit" }) end } + { "g", function() require("neogit").open() end } }, } From 44e501b67f4800029cc62459a12212083feee882 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Wed, 16 Apr 2025 22:56:54 +0200 Subject: [PATCH 4/4] 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" + ]; + }; +}