From 36c7aa8e26e8b7ed8223ec36733b3ae800121ff6 Mon Sep 17 00:00:00 2001 From: Alyxia Sother Date: Tue, 14 Mar 2023 09:54:57 +0100 Subject: [PATCH 1/3] [nix] Add nix-darwin config --- nix/darwin-configuration.nix | 161 +++++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 nix/darwin-configuration.nix diff --git a/nix/darwin-configuration.nix b/nix/darwin-configuration.nix new file mode 100644 index 0000000..e6aea7b --- /dev/null +++ b/nix/darwin-configuration.nix @@ -0,0 +1,161 @@ +{ config, pkgs, ... }: + +{ + networking = { + hostName = "alymac"; + }; + + # List packages installed in system profile. To search by name, run: + # $ nix-env -qaP | grep wget + environment.systemPackages = with pkgs; [ + bat + bitwarden-cli + crystal + delta + deno + exa + ffmpeg + fzf + git + gnupg + go + jq + mosh + neovim + nodePackages.pnpm + nodePackages.prettier + nodePackages.yarn + nodejs-19_x + openssl + pcre + pkg-config + rectangle + ripgrep + ruby_3_1 + tailscale + shards + slack + slack-term + vim + wget + zig + ]; + + homebrew = { + enable = true; + onActivation.cleanup = "zap"; + + taps = [ + "homebrew/cask" + "drud/ddev" + ]; + + brews = [ + "composer" + "ddev" + "sdl2" + "pkg-config" + ]; + + casks = [ + "alt-tab" + "amethyst" + "discord" + "docker" + "fig" + "firefox" + "google-chrome" + "iterm2" + "nss" + "obs" + "raycast" + "sequel-ace" + "shortcat" + "shottr" + "spotify" + "thunderbird" + "visual-studio-code" + ]; + }; + + # Auto upgrade nix package and the daemon service. + services.nix-daemon.enable = true; + + # Configuration for nix itself. + nix = { + package = pkgs.nix; + settings = { + experimental-features = [ "nix-command" "flakes" ]; + }; + gc = { + automatic = true; + options = "--delete-older-than 8d"; + }; + }; + + # Create /etc/zshrc that loads the nix-darwin environment. + programs.zsh = { + enable = true; + promptInit = " + source ~/.dotfiles/zsh/zshrc + "; + }; + + # Used for backwards compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = 4; + nixpkgs.config.allowUnfree = true; +} + + +# services.yabai = { +# enable = true; +# enableScriptingAddition = true; +# config = { +# layout = "bsp"; +# window_placement = "first_child"; +# auto_balance = "on"; +# +# focus_follows_mouse = "autoraise"; +# +# window_topmost = "on"; +# +# window_opacity = "on"; +# active_window_opacity = "1.0"; +# normal_window_opacity = "0.9"; +# }; +# +# extraConfig = " +# yabai -m signal --add event=dock_did_restart action=\"sudo yabai --load-sa\" +# sudo yabai --load-sa +# "; +# }; +# +# services.skhd = { +# enable = true; +# skhdConfig = " +# # Toggle split +# shift + cmd - enter : /run/current-system/sw/bin/yabai -m window --toggle split +# +# # Focus window +# ctrl + cmd - up : /run/current-system/sw/bin/yabai -m window --focus north +# ctrl + cmd - right : /run/current-system/sw/bin/yabai -m window --focus east +# ctrl + cmd - down : /run/current-system/sw/bin/yabai -m window --focus south +# ctrl + cmd - left : /run/current-system/sw/bin/yabai -m window --focus west +# +# # Move windows +# shift + cmd - left : /run/current-system/sw/bin/yabai -m window --warp west +# shift + cmd - right : /run/current-system/sw/bin/yabai -m window --warp east +# +# # Focus monitor +# ctrl + alt - z : /run/current-system/sw/bin/yabai -m display --focus prev +# +# # Increase window size +# shift + alt - a : /run/current-system/sw/bin/yabai -m window --resize left:-20:0 +# shift + alt - w : /run/current-system/sw/bin/yabai -m window --resize top:0:-20 +# +# # Decrease window size +# shift + cmd - s : /run/current-system/sw/bin/yabai -m window --resize bottom:0:-20 +# shift + cmd - w : /run/current-system/sw/bin/yabai -m window --resize top:0:20 +# "; +# }; From f9c86ee14df5af3d468bbba38746f984e31ce721 Mon Sep 17 00:00:00 2001 From: Alyxia Sother Date: Tue, 14 Mar 2023 09:55:30 +0100 Subject: [PATCH 2/3] [nvim] Add a fix for Treesitter on macOS --- nvim/plugin/treesitter.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nvim/plugin/treesitter.lua b/nvim/plugin/treesitter.lua index 65cb02e..63cb55c 100644 --- a/nvim/plugin/treesitter.lua +++ b/nvim/plugin/treesitter.lua @@ -1,6 +1,18 @@ local ok, parser_configs = pcall(require, 'nvim-treesitter.parsers') if not ok then return end +-- Should only really run on my Macbook, as it is my only macOS device. +-- Apple's C compilers seem to not want to compile any of Treesitter's +-- dialects. +-- That is, `cc`, `gcc`, `g++`, andsoforth. Funnily enough, they are all +-- aliases to the same program. +-- So, the nix-darwin configuration specifies the installation of zig as a +-- replacement compiler solely so the Treesitter dialects compile. Very +-- intuitive. +if vim.loop.os_uname().sysname == 'Darwin' then + require('nvim-treesitter.install').compilers = { "zig" } +end + local parser_configs = parser_configs.get_parser_configs() parser_configs.norg = { From a040e3b5c395f5c4264c2c64503a0731ab65857b Mon Sep 17 00:00:00 2001 From: Alyxia Sother Date: Tue, 14 Mar 2023 09:55:47 +0100 Subject: [PATCH 3/3] [nvim] *Finally* fix the neorg branch name --- nvim/dotfiles/plugins-list.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/dotfiles/plugins-list.vim b/nvim/dotfiles/plugins-list.vim index 4035af0..87965af 100644 --- a/nvim/dotfiles/plugins-list.vim +++ b/nvim/dotfiles/plugins-list.vim @@ -29,7 +29,7 @@ let s:plug = funcref('dotfiles#plugman#register') call s:plug('xiyaowong/coc-nvim-lua') call s:plug('alaviss/nim.nvim') if has('unix') - call s:plug('nvim-neorg/neorg', { 'branch': 'unstable' }) " dependencies {{{ + call s:plug('nvim-neorg/neorg') " dependencies {{{ call s:plug('nvim-treesitter/nvim-treesitter', { 'do': ':TSUpdate' }) " }}} endif