From 6eb2da277fbaf3079ce1f00f8a2a40cb591c511a Mon Sep 17 00:00:00 2001 From: Daniel Thoren Date: Fri, 5 Sep 2025 11:35:43 +0200 Subject: [PATCH 01/14] feat(flake): add nix-darwin config for macOS :apple: --- nixos/flake.nix | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/nixos/flake.nix b/nixos/flake.nix index c75fe80..af81dd2 100644 --- a/nixos/flake.nix +++ b/nixos/flake.nix @@ -3,6 +3,12 @@ nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixos-wsl.url = "github:nix-community/NixOS-WSL/main"; vscode-server.url = "github:nix-community/nixos-vscode-server"; + + # nix-darwin for macOS + # (follows nixpkgs so both use the same channel) + nix-darwin.url = "github:nix-darwin/nix-darwin/master"; + nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; + # for later # home-manager.url = "github:nix-community/home-manager"; # home-manager.inputs.nixpkgs.follows = "nixpkgs"; @@ -12,18 +18,18 @@ nixpkgs, nixos-wsl, vscode-server, + nix-darwin, self, # home-manager, ... }: { nixosConfigurations = { - wsl = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ nixos-wsl.nixosModules.default vscode-server.nixosModules.default - ./hosts/wsl.nix # previously configuration.nix + ./hosts/wsl.nix ./tmux.nix ./neovim.nix ./fish.nix @@ -35,17 +41,27 @@ system = "x86_64-linux"; modules = [ vscode-server.nixosModules.default - ./hosts/macbookair.nix # previously configuration.nix + ./hosts/macbookair.nix ./hardware-configuration.nix ./tmux.nix ./neovim.nix ./fish.nix # home-manager.nixosModules.default - # ./configuration.nix # shouldn't this be necessary??? + # ./configuration.nix # ./uxplay.nix ]; }; + }; + # macOS (nix-darwin) configuration + darwinConfigurations."Daniel-Macbook-Air" = nix-darwin.lib.darwinSystem { + modules = [ + # Ensure Apple Silicon platform + { nixpkgs.hostPlatform = "aarch64-darwin"; } + + # Your macOS module (you created it under nixos/hosts/macos.nix) + ./nixos/hosts/macos.nix + ]; }; }; } From dfd4a10c1ae986b3609ba28f7eabd13b79f06615 Mon Sep 17 00:00:00 2001 From: Daniel Thoren Date: Fri, 5 Sep 2025 11:44:11 +0200 Subject: [PATCH 02/14] fix: macos.nix :bug: --- nixos/hosts/macos.nix | 126 +++++++++++++++++------------------------- 1 file changed, 52 insertions(+), 74 deletions(-) diff --git a/nixos/hosts/macos.nix b/nixos/hosts/macos.nix index df3f80e..2268f0d 100644 --- a/nixos/hosts/macos.nix +++ b/nixos/hosts/macos.nix @@ -1,90 +1,68 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page, on -# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). - -# NixOS-WSL specific options are documented on the NixOS-WSL repository: -# https://github.com/nix-community/NixOS-WSL - { config, lib, pkgs, ... }: { - networking = { - useDHCP = true; - # nameserver sources: https://dnsmap.io/articles/most-popular-dns-servers - nameservers = [ "84.200.69.80" "8.26.56.26" "1.1.1.1" "8.8.8.8" "64.6.65.6" "208.67.222.222" "209.244.0.3" ]; - }; + # Apple Silicon + nix-darwin basics + nixpkgs.hostPlatform = "aarch64-darwin"; + services.nix-daemon.enable = true; nix.settings.experimental-features = [ "nix-command" "flakes" ]; - - programs.nix-ld.enable = true; - # TODO: move to home manager (?) - programs = { - direnv = { - enable = true; - # enableFishIntegration = true; - nix-direnv.enable = true; - }; - }; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It's perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "25.05"; # Did you read the comment? - - users.users.danny = { - isNormalUser = true; - extraGroups = [ "wheel" ]; - initialPassword = "test"; - }; - nixpkgs.config.allowUnfree = true; + + # Shells & dev ergonomics + programs.fish.enable = true; + environment.shells = [ pkgs.fish ]; + # If you want fish as default shell, uncomment: + # users.defaultUserShell = pkgs.fish; + + programs.direnv.enable = true; + programs.direnv.nix-direnv.enable = true; + + # Networking (macOS-safe) + networking = { + # Set if you want a specific hostname in macOS UI as well: + hostName = "Daniel-Macbook-Air"; + knownNetworkServices = [ "Wi-Fi" "Thunderbolt Bridge" ]; + dns = [ + "84.200.69.80" "8.26.56.26" "1.1.1.1" "8.8.8.8" "64.6.65.6" "208.67.222.222" "209.244.0.3" + ]; + }; + + # macOS niceties + security.pam.enableSudoTouchIdAuth = true; + + system.defaults = { + # Keyboard + NSGlobalDomain = { + ApplePressAndHoldEnabled = false; + InitialKeyRepeat = 15; + KeyRepeat = 2; + }; + + # Finder & Dock + finder.AppleShowAllExtensions = true; + dock.autohide = true; + dock.mru-spaces = false; + }; + + # Environment environment.variables = { DBT_USER = "DNTH"; }; environment.systemPackages = with pkgs; [ - # tmux # activated in tmux.nix - # vim # using neovim in stead - # neovim # activated in neovim.nix - - # disabled git as it comes pre-installed on macos - delete or re-enable? - # git # version control - gh # github cli tool - - ripgrep # faster grep - wget # for vscode-server - busybox # useful programs e.g. tree, unzip etc - openssl # cryptography swiss army knife - xdg-utils # terminal desktop intergrations (i.e. allow terminal to open browser) - - # make default.nix in python project folders instead of using a top-level python environment manager - # pyenv - # poetry - - neofetch # system info - btop # resource monitor - tldr # community alternative to man - fzf # fuzzy finder - - # gimp # bloat - # blender # bloat - # inkscape # bloat - + gh + ripgrep + wget + busybox + openssl + neofetch + btop + tldr + fzf cowsay lolcat ]; - # services.vscode-server.enable = true; - # security.rtkit.enable = true; # realtime kit hands out realtime scheduling priority - # services.pipewire = { - # enable = true; # if not already enabled - # alsa.enable = true; - # alsa.support32Bit = true; - # pulse.enable = true; - # # If you want to use JACK applications, uncomment this - # #jack.enable = true; - # }; + # Keep for darwin as well (tracks defaults across upgrades) + system.stateVersion = "25.05"; } From 8007a8dfd3a468b242f31363710bd266d177b0f5 Mon Sep 17 00:00:00 2001 From: Daniel Thoren Date: Mon, 8 Sep 2025 13:34:43 +0200 Subject: [PATCH 03/14] chore: move hostPlatform to macos.nix + doc: todo :truck::memo: --- nixos/flake.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/nixos/flake.nix b/nixos/flake.nix index af81dd2..f293839 100644 --- a/nixos/flake.nix +++ b/nixos/flake.nix @@ -56,11 +56,8 @@ # macOS (nix-darwin) configuration darwinConfigurations."Daniel-Macbook-Air" = nix-darwin.lib.darwinSystem { modules = [ - # Ensure Apple Silicon platform - { nixpkgs.hostPlatform = "aarch64-darwin"; } - - # Your macOS module (you created it under nixos/hosts/macos.nix) ./nixos/hosts/macos.nix + # TODO: add tmux.nix, neovim.nix, fish.nix ]; }; }; From e5a7512a98a0d589b25f8620623ec87d5e205f99 Mon Sep 17 00:00:00 2001 From: Daniel Thoren Date: Mon, 8 Sep 2025 13:40:09 +0200 Subject: [PATCH 04/14] feat(macos): improve nix-darwin config for stability and ergonomics :zap: --- nixos/hosts/macos.nix | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/nixos/hosts/macos.nix b/nixos/hosts/macos.nix index 2268f0d..5431a8f 100644 --- a/nixos/hosts/macos.nix +++ b/nixos/hosts/macos.nix @@ -5,7 +5,17 @@ nixpkgs.hostPlatform = "aarch64-darwin"; services.nix-daemon.enable = true; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix = { + settings = { + experimental-features = [ "nix-command" "flakes" ]; + auto-optimise-store = true; + }; + gc = { + automatic = true; + interval = { Weekday = 0; Hour = 3; Minute = 0; }; + }; + }; + nixpkgs.config.allowUnfree = true; # Shells & dev ergonomics @@ -22,9 +32,6 @@ # Set if you want a specific hostname in macOS UI as well: hostName = "Daniel-Macbook-Air"; knownNetworkServices = [ "Wi-Fi" "Thunderbolt Bridge" ]; - dns = [ - "84.200.69.80" "8.26.56.26" "1.1.1.1" "8.8.8.8" "64.6.65.6" "208.67.222.222" "209.244.0.3" - ]; }; # macOS niceties @@ -54,6 +61,9 @@ ripgrep wget busybox + git + gnupg + coreutils openssl neofetch btop From 5a7a8b9f5f71c8e17634e094a20921e4dc6a64a5 Mon Sep 17 00:00:00 2001 From: Daniel Thoren Date: Mon, 8 Sep 2025 13:52:32 +0200 Subject: [PATCH 05/14] fix(macos): relative path :bug: --- nixos/flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/flake.nix b/nixos/flake.nix index f293839..e182dfa 100644 --- a/nixos/flake.nix +++ b/nixos/flake.nix @@ -56,7 +56,7 @@ # macOS (nix-darwin) configuration darwinConfigurations."Daniel-Macbook-Air" = nix-darwin.lib.darwinSystem { modules = [ - ./nixos/hosts/macos.nix + ./hosts/macos.nix # TODO: add tmux.nix, neovim.nix, fish.nix ]; }; From 3a6fbd2f895a97ca742e4487dcc787a58b3a4321 Mon Sep 17 00:00:00 2001 From: Daniel Thoren Date: Mon, 8 Sep 2025 13:55:39 +0200 Subject: [PATCH 06/14] fix(macos): set darwin state-version to 6 :bug: --- nixos/hosts/macos.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nixos/hosts/macos.nix b/nixos/hosts/macos.nix index 5431a8f..6321b37 100644 --- a/nixos/hosts/macos.nix +++ b/nixos/hosts/macos.nix @@ -74,5 +74,7 @@ ]; # Keep for darwin as well (tracks defaults across upgrades) - system.stateVersion = "25.05"; + # current max per nix-darwin; bump only if a release notes says so + system.stateVersion = 6; + } From 948798af4ac8c3a32e71136a943de008c610b4a3 Mon Sep 17 00:00:00 2001 From: Daniel Thoren Date: Mon, 8 Sep 2025 14:52:14 +0200 Subject: [PATCH 07/14] fix(darwin): migrate to new nix-darwin options & root activation :wrench: - set `nix.enable = true`; remove deprecated `services.nix-daemon.enable` :fire: - replace unsafe `nix.settings.auto-optimise-store` with `nix.optimise.automatic` - rename Touch ID option to `security.pam.services.sudo_local.touchIdAuth` - add `system.primaryUser = "danny"` so user-scoped macOS defaults apply under root activation - keep GC schedule; retain `nixpkgs.hostPlatform = "aarch64-darwin"` - (minor) expand `environment.systemPackages` with `git`, `gnupg`, `coreutils` This adapts the config to recent nix-darwin changes and fixes evaluation failures during `darwin-rebuild`. --- nixos/hosts/macos.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nixos/hosts/macos.nix b/nixos/hosts/macos.nix index 6321b37..e09a985 100644 --- a/nixos/hosts/macos.nix +++ b/nixos/hosts/macos.nix @@ -3,20 +3,22 @@ { # Apple Silicon + nix-darwin basics nixpkgs.hostPlatform = "aarch64-darwin"; - services.nix-daemon.enable = true; + nix.enable = true; nix = { settings = { experimental-features = [ "nix-command" "flakes" ]; - auto-optimise-store = true; }; gc = { automatic = true; interval = { Weekday = 0; Hour = 3; Minute = 0; }; }; + optimise.automatic = true; # replaces auto-optimise-store }; nixpkgs.config.allowUnfree = true; + + system.primaryUser = "danny"; # Shells & dev ergonomics programs.fish.enable = true; @@ -35,7 +37,7 @@ }; # macOS niceties - security.pam.enableSudoTouchIdAuth = true; + security.pam.services.sudo_local.touchIdAuth = true; system.defaults = { # Keyboard From e2f8ab3088d2fb3ac2f1702aec07ea376c584920 Mon Sep 17 00:00:00 2001 From: Daniel Thoren Date: Mon, 8 Sep 2025 14:56:38 +0200 Subject: [PATCH 08/14] fix(macos): deactivate busybox :bug: --- nixos/hosts/macos.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/hosts/macos.nix b/nixos/hosts/macos.nix index e09a985..a200f22 100644 --- a/nixos/hosts/macos.nix +++ b/nixos/hosts/macos.nix @@ -62,7 +62,7 @@ gh ripgrep wget - busybox + # busybox #TODO: doesn't run on darwin git gnupg coreutils From 0701e6b107ef601d129a687a830b9b9300a4650c Mon Sep 17 00:00:00 2001 From: Daniel Thoren Date: Mon, 8 Sep 2025 15:08:59 +0200 Subject: [PATCH 09/14] fix: nix management (now managed by Determinate Systems) :bug: --- nixos/hosts/macos.nix | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/nixos/hosts/macos.nix b/nixos/hosts/macos.nix index a200f22..0d1c7a6 100644 --- a/nixos/hosts/macos.nix +++ b/nixos/hosts/macos.nix @@ -3,18 +3,7 @@ { # Apple Silicon + nix-darwin basics nixpkgs.hostPlatform = "aarch64-darwin"; - nix.enable = true; - - nix = { - settings = { - experimental-features = [ "nix-command" "flakes" ]; - }; - gc = { - automatic = true; - interval = { Weekday = 0; Hour = 3; Minute = 0; }; - }; - optimise.automatic = true; # replaces auto-optimise-store - }; + nix.enable = false; # Determinate manages Nix nixpkgs.config.allowUnfree = true; From bfb924a610c373d438c88287591411f8973f0ee4 Mon Sep 17 00:00:00 2001 From: Daniel Thoren Date: Mon, 8 Sep 2025 19:14:25 +0200 Subject: [PATCH 10/14] chore: re-enable `ApplePressAndHoldEnabled` :art: --- nixos/hosts/macos.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nixos/hosts/macos.nix b/nixos/hosts/macos.nix index 0d1c7a6..2a29fb6 100644 --- a/nixos/hosts/macos.nix +++ b/nixos/hosts/macos.nix @@ -31,9 +31,9 @@ system.defaults = { # Keyboard NSGlobalDomain = { - ApplePressAndHoldEnabled = false; - InitialKeyRepeat = 15; - KeyRepeat = 2; + ApplePressAndHoldEnabled = true; + # InitialKeyRepeat = 15; + # KeyRepeat = 2; }; # Finder & Dock From ecade3a03e3361c444802dcd88815eef5b4b98b3 Mon Sep 17 00:00:00 2001 From: Daniel Thoren Date: Mon, 8 Sep 2025 19:16:17 +0200 Subject: [PATCH 11/14] feat: add tmux, fish, nix configs to macos :apple::sparkles: --- nixos/flake.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nixos/flake.nix b/nixos/flake.nix index e182dfa..50b6fdd 100644 --- a/nixos/flake.nix +++ b/nixos/flake.nix @@ -57,7 +57,9 @@ darwinConfigurations."Daniel-Macbook-Air" = nix-darwin.lib.darwinSystem { modules = [ ./hosts/macos.nix - # TODO: add tmux.nix, neovim.nix, fish.nix + ./tmux.nix + ./neovim.nix + ./fish.nix ]; }; }; From b7f63f305d22cb53eacd0f0e7a94387a609a44a7 Mon Sep 17 00:00:00 2001 From: DannyDannyDanny Date: Mon, 8 Sep 2025 19:46:49 +0200 Subject: [PATCH 12/14] =?UTF-8?q?fix(neovim):=20guard=20NixOS=20module=20t?= =?UTF-8?q?o=20Linux=20for=20nix-darwin=20compatibility=20=F0=9F=94=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - wrap Neovim module in `lib.mkIf pkgs.stdenv.isLinux` (no-op on macOS) - add `lib` to module args - fix Lua message var: use `config_file` instead of undefined `file` - keep existing plugins and customRC on Linux unchanged --- nixos/hosts/macos.nix | 1 + nixos/neovim.nix | 141 +++++++++++++++++++++--------------------- 2 files changed, 73 insertions(+), 69 deletions(-) diff --git a/nixos/hosts/macos.nix b/nixos/hosts/macos.nix index 2a29fb6..f18411a 100644 --- a/nixos/hosts/macos.nix +++ b/nixos/hosts/macos.nix @@ -62,6 +62,7 @@ fzf cowsay lolcat + neovim ]; # Keep for darwin as well (tracks defaults across upgrades) diff --git a/nixos/neovim.nix b/nixos/neovim.nix index ed64a44..3d2b294 100644 --- a/nixos/neovim.nix +++ b/nixos/neovim.nix @@ -1,82 +1,85 @@ -{ config, pkgs, ... }: +{ lib, config, pkgs, ... }: { - programs.neovim = { - enable = true; - defaultEditor = true; - configure = { - customRC = '' - set title - set go=a - set mouse=a - set nohlsearch - set number - let mapleader="," + # Only apply the Neovim NixOS module options on Linux. + config = lib.mkIf pkgs.stdenv.isLinux { + programs.neovim = { + enable = true; + defaultEditor = true; - lua << EOF - local config_file = os.getenv("HOME")..'/.local/share/nvim_color_scheme' - local f=io.open(config_file, "r") - if f~=nil then - local system_theme = f:read() - -- f:close() - io.close(f) - if system_theme == 'dark' then - vim.cmd("set bg=dark") - elseif system_theme == 'light' then - vim.cmd("set bg=light") - else - print('warning: expected value "light" or "dark"') - print(' got:', system_theme) - print(' expected path:', file) - end - else - print('warning: nvim color scheme not found') - print(' expected path:', file) - end - EOF + configure = { + customRC = '' + set title + set go=a + set mouse=a + set nohlsearch + set number + let mapleader="," - colorscheme catppuccin " catppuccin-latte, catppuccin-frappe, catppuccin-macchiato, catppuccin-mocha + lua << EOF + local config_file = os.getenv("HOME")..'/.local/share/nvim_color_scheme' + local f = io.open(config_file, "r") + if f ~= nil then + local system_theme = f:read() + io.close(f) + if system_theme == 'dark' then + vim.cmd("set bg=dark") + elseif system_theme == 'light' then + vim.cmd("set bg=light") + else + print('warning: expected value "light" or "dark"') + print(' got:', system_theme) + print(' expected path:', config_file) + end + else + print('warning: nvim color scheme not found') + print(' expected path:', config_file) + end + EOF - " netrw (dir listing) settings - let g:netrw_liststyle = 3 - let g:netrw_banner = 0 - let g:netrw_browse_split = 3 - let g:netrw_winsize = 25 " % of page + colorscheme catppuccin " catppuccin-latte, catppuccin-frappe, catppuccin-macchiato, catppuccin-mocha - set listchars=tab:→\ ,space:·,nbsp:␣,trail:•,eol:¶,precedes:«,extends:» - set clipboard+=unnamedplus + " netrw (dir listing) settings + let g:netrw_liststyle = 3 + let g:netrw_banner = 0 + let g:netrw_browse_split = 3 + let g:netrw_winsize = 25 " % of page - " Replace-all is aliased to S. - nnoremap S :%s//g + set listchars=tab:→\ ,space:·,nbsp:␣,trail:•,eol:¶,precedes:«,extends:» + set clipboard+=unnamedplus - " save file with ,w - map w :w + " Replace-all is aliased to S. + nnoremap S :%s//g - " spellcheck - set spell spelllang=en_us - setlocal spell! spelllang=en_us - ''; - # vimPlugins inspired from Alexnortung - # https://discourse.nixos.org/t/neovim-no-longer-uses-config-or-plugins/13399/4 - packages.nix = with pkgs.vimPlugins; { - start = [ - vim-surround # shortcuts for setting () {} etc. - vim-gitgutter # git diff in sign column - # vim-airline # nice and light status bar # doesn't work nicely with tmux - # coc-nvim coc-git coc-highlight coc-python coc-rls coc-vetur coc-vimtex coc-yaml coc-html coc-json # auto completion - vim-nix # nix highlight - vimtex # latex stuff - fzf-vim # fuzzy finder through vim - nerdtree # file structure inside nvim - rainbow # color parenthesis - # gruvbox-nvim # theme - catppuccin-nvim # theme - goyo-vim # write prose - limelight-vim # prose paragraph highlighter - ]; - opt = []; + " save file with ,w + map w :w + + " spellcheck + set spell spelllang=en_us + setlocal spell! spelllang=en_us + ''; + + # vimPlugins inspired from Alexnortung + # https://discourse.nixos.org/t/neovim-no-longer-uses-config-or-plugins/13399/4 + packages.nix = with pkgs.vimPlugins; { + start = [ + vim-surround # shortcuts for setting () {} etc. + vim-gitgutter # git diff in sign column + # vim-airline # nice and light status bar (disabled for tmux) + # coc-nvim coc-* plugins (disabled for now) + vim-nix # nix highlight + vimtex # latex stuff + fzf-vim # fuzzy finder through vim + nerdtree # file structure inside nvim + rainbow # color parenthesis + # gruvbox-nvim # theme + catppuccin-nvim # theme + goyo-vim # write prose + limelight-vim # prose paragraph highlighter + ]; + opt = []; + }; }; }; }; } - From 7544e12117bd6a1133504acbbc3acf5bb858c92f Mon Sep 17 00:00:00 2001 From: DannyDannyDanny Date: Mon, 8 Sep 2025 20:41:49 +0200 Subject: [PATCH 13/14] chore: revert neovim changes, remove tmux + fish from nix-darwin :hammer: --- nixos/flake.lock | 22 ++++++++ nixos/flake.nix | 6 +- nixos/neovim.nix | 140 +++++++++++++++++++++++------------------------ 3 files changed, 94 insertions(+), 74 deletions(-) diff --git a/nixos/flake.lock b/nixos/flake.lock index 5c4b68b..78b1c2a 100644 --- a/nixos/flake.lock +++ b/nixos/flake.lock @@ -34,6 +34,27 @@ "type": "github" } }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1757130842, + "narHash": "sha256-4i7KKuXesSZGUv0cLPLfxbmF1S72Gf/3aSypgvVkwuA=", + "owner": "nix-darwin", + "repo": "nix-darwin", + "rev": "15f067638e2887c58c4b6ba1bdb65a0b61dc58c5", + "type": "github" + }, + "original": { + "owner": "nix-darwin", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, "nixos-wsl": { "inputs": { "flake-compat": "flake-compat", @@ -102,6 +123,7 @@ }, "root": { "inputs": { + "nix-darwin": "nix-darwin", "nixos-wsl": "nixos-wsl", "nixpkgs": "nixpkgs_2", "vscode-server": "vscode-server" diff --git a/nixos/flake.nix b/nixos/flake.nix index 50b6fdd..5020174 100644 --- a/nixos/flake.nix +++ b/nixos/flake.nix @@ -57,8 +57,10 @@ darwinConfigurations."Daniel-Macbook-Air" = nix-darwin.lib.darwinSystem { modules = [ ./hosts/macos.nix - ./tmux.nix - ./neovim.nix + # TODO: nix-darwin lacks tmux options; move to Home Manager.x + # ./tmux.nix + # TODO: add neovim via homemanager, that should work the same for NixOS as Nix-Darwin + # ./neovim.nix # NOTE: Option only exists on NixOS. ./fish.nix ]; }; diff --git a/nixos/neovim.nix b/nixos/neovim.nix index 3d2b294..6fc589b 100644 --- a/nixos/neovim.nix +++ b/nixos/neovim.nix @@ -1,84 +1,80 @@ -{ lib, config, pkgs, ... }: +{ config, pkgs, ... }: { - # Only apply the Neovim NixOS module options on Linux. - config = lib.mkIf pkgs.stdenv.isLinux { - programs.neovim = { - enable = true; - defaultEditor = true; + programs.neovim = { + enable = true; + defaultEditor = true; + configure = { + customRC = '' + set title + set go=a + set mouse=a + set nohlsearch + set number + let mapleader="," - configure = { - customRC = '' - set title - set go=a - set mouse=a - set nohlsearch - set number - let mapleader="," + lua << EOF + local config_file = os.getenv("HOME")..'/.local/share/nvim_color_scheme' + local f=io.open(config_file, "r") + if f~=nil then + local system_theme = f:read() + -- f:close() + io.close(f) + if system_theme == 'dark' then + vim.cmd("set bg=dark") + elseif system_theme == 'light' then + vim.cmd("set bg=light") + else + print('warning: expected value "light" or "dark"') + print(' got:', system_theme) + print(' expected path:', file) + end + else + print('warning: nvim color scheme not found') + print(' expected path:', file) + end + EOF - lua << EOF - local config_file = os.getenv("HOME")..'/.local/share/nvim_color_scheme' - local f = io.open(config_file, "r") - if f ~= nil then - local system_theme = f:read() - io.close(f) - if system_theme == 'dark' then - vim.cmd("set bg=dark") - elseif system_theme == 'light' then - vim.cmd("set bg=light") - else - print('warning: expected value "light" or "dark"') - print(' got:', system_theme) - print(' expected path:', config_file) - end - else - print('warning: nvim color scheme not found') - print(' expected path:', config_file) - end - EOF + colorscheme catppuccin " catppuccin-latte, catppuccin-frappe, catppuccin-macchiato, catppuccin-mocha - colorscheme catppuccin " catppuccin-latte, catppuccin-frappe, catppuccin-macchiato, catppuccin-mocha + " netrw (dir listing) settings + let g:netrw_liststyle = 3 + let g:netrw_banner = 0 + let g:netrw_browse_split = 3 + let g:netrw_winsize = 25 " % of page - " netrw (dir listing) settings - let g:netrw_liststyle = 3 - let g:netrw_banner = 0 - let g:netrw_browse_split = 3 - let g:netrw_winsize = 25 " % of page + set listchars=tab:→\ ,space:·,nbsp:␣,trail:•,eol:¶,precedes:«,extends:» + set clipboard+=unnamedplus - set listchars=tab:→\ ,space:·,nbsp:␣,trail:•,eol:¶,precedes:«,extends:» - set clipboard+=unnamedplus + " Replace-all is aliased to S. + nnoremap S :%s//g - " Replace-all is aliased to S. - nnoremap S :%s//g + " save file with ,w + map w :w - " save file with ,w - map w :w - - " spellcheck - set spell spelllang=en_us - setlocal spell! spelllang=en_us - ''; - - # vimPlugins inspired from Alexnortung - # https://discourse.nixos.org/t/neovim-no-longer-uses-config-or-plugins/13399/4 - packages.nix = with pkgs.vimPlugins; { - start = [ - vim-surround # shortcuts for setting () {} etc. - vim-gitgutter # git diff in sign column - # vim-airline # nice and light status bar (disabled for tmux) - # coc-nvim coc-* plugins (disabled for now) - vim-nix # nix highlight - vimtex # latex stuff - fzf-vim # fuzzy finder through vim - nerdtree # file structure inside nvim - rainbow # color parenthesis - # gruvbox-nvim # theme - catppuccin-nvim # theme - goyo-vim # write prose - limelight-vim # prose paragraph highlighter - ]; - opt = []; - }; + " spellcheck + set spell spelllang=en_us + setlocal spell! spelllang=en_us + ''; + # vimPlugins inspired from Alexnortung + # https://discourse.nixos.org/t/neovim-no-longer-uses-config-or-plugins/13399/4 + packages.nix = with pkgs.vimPlugins; { + start = [ + vim-surround # shortcuts for setting () {} etc. + vim-gitgutter # git diff in sign column + # vim-airline # nice and light status bar # doesn't work nicely with tmux + # coc-nvim coc-git coc-highlight coc-python coc-rls coc-vetur coc-vimtex coc-yaml coc-html coc-json # auto completion + vim-nix # nix highlight + vimtex # latex stuff + fzf-vim # fuzzy finder through vim + nerdtree # file structure inside nvim + rainbow # color parenthesis + # gruvbox-nvim # theme + catppuccin-nvim # theme + goyo-vim # write prose + limelight-vim # prose paragraph highlighter + ]; + opt = []; }; }; }; From 64dff944ae28317cc6be981b7a76c9dd5caa7e89 Mon Sep 17 00:00:00 2001 From: DannyDannyDanny Date: Mon, 8 Sep 2025 20:48:13 +0200 Subject: [PATCH 14/14] chore: nice apple configs :apple: :sparkles: --- nixos/hosts/macos.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nixos/hosts/macos.nix b/nixos/hosts/macos.nix index f18411a..f55869c 100644 --- a/nixos/hosts/macos.nix +++ b/nixos/hosts/macos.nix @@ -31,9 +31,11 @@ system.defaults = { # Keyboard NSGlobalDomain = { + AppleShowAllExtensions = true; ApplePressAndHoldEnabled = true; - # InitialKeyRepeat = 15; - # KeyRepeat = 2; + "com.apple.mouse.tapBehavior" = 1; + "com.apple.sound.beep.volume" = 0.0; + "com.apple.sound.beep.feedback" = 0; }; # Finder & Dock