From 022902fc6dd31b7856949c0db4c81fb4b136e542 Mon Sep 17 00:00:00 2001
From: sloane <git@sloanelybutsurely.com>
Date: Sat, 15 Feb 2025 10:03:22 -0500
Subject: [PATCH] add personal machine, a whole lotta config

---
 flake.nix                                     |  28 ++-
 home-manager/default.nix                      | 188 ++++--------------
 home-manager/nixvim/default.nix               | 157 +++++++++++++++
 home-manager/users/sloane.nix                 |  10 +
 home-manager/users/sperrault.nix              |   8 +
 nix-darwin/default.nix                        |  56 +++++-
 .../hosts/Sloanes-MacBook-Air/default.nix     |   8 +
 nix-darwin/hosts/tid27880sperrau/default.nix  |   4 +
 8 files changed, 294 insertions(+), 165 deletions(-)
 create mode 100644 home-manager/nixvim/default.nix
 create mode 100644 home-manager/users/sloane.nix
 create mode 100644 home-manager/users/sperrault.nix
 create mode 100644 nix-darwin/hosts/Sloanes-MacBook-Air/default.nix
 create mode 100644 nix-darwin/hosts/tid27880sperrau/default.nix

diff --git a/flake.nix b/flake.nix
index c6babba..3ad361f 100644
--- a/flake.nix
+++ b/flake.nix
@@ -13,14 +13,13 @@
 
   outputs = inputs@{ self, nix-darwin, nixpkgs, home-manager, nixvim }:
   {
-    # Build darwin flake using:
-    # $ darwin-rebuild build --flake .#tid27880sperrau
     darwinConfigurations."tid27880sperrau" = nix-darwin.lib.darwinSystem {
       modules = [
         {
           system.configurationRevision = self.rev or self.dirtyRev or null;
         }
         ./nix-darwin
+        ./nix-darwin/hosts/tid27880sperrau
         home-manager.darwinModules.home-manager
         {
           users.users.sperrault.home = "/Users/sperrault";
@@ -31,7 +30,30 @@
             extraSpecialArgs = {
               inherit nixvim;
             };
-            users.sperrault = import ./home-manager;
+            users.sperrault = import ./home-manager/users/sperrault.nix;
+          };
+        }
+      ];
+    };
+
+    darwinConfigurations."Sloanes-MacBook-Air" = nix-darwin.lib.darwinSystem {
+      modules = [
+        {
+          system.configurationRevision = self.rev or self.dirtyRev or null;
+        }
+        ./nix-darwin
+        ./nix-darwin/hosts/Sloanes-MacBook-Air
+        home-manager.darwinModules.home-manager
+        {
+          users.users.sloane.home = "/Users/sloane";
+          home-manager = {
+            useGlobalPkgs = true;
+            useUserPackages = true;
+            backupFileExtension = "before-home-manager";
+            extraSpecialArgs = {
+              inherit nixvim;
+            };
+            users.sloane = import ./home-manager/users/sloane.nix;
           };
         }
       ];
diff --git a/home-manager/default.nix b/home-manager/default.nix
index b41c492..d150b66 100644
--- a/home-manager/default.nix
+++ b/home-manager/default.nix
@@ -2,11 +2,10 @@
 {
   imports = [
     nixvim.homeManagerModules.nixvim
+    ./nixvim
   ];
   
   home = {
-    username = "sperrault";
-    homeDirectory = "/Users/sperrault";
     stateVersion = "24.11";
 
     sessionVariables = {
@@ -16,13 +15,30 @@
     packages = with pkgs; [
       watchman
       difftastic
+      maple-mono-NF
     ];
   };
 
+  home.file.".config/ghostty/config" = {
+    enable = true;
+    text = ''
+      font-family = "Maple Mono NF"
+      font-size = 16
+      theme = "catppuccin-mocha"
+    '';
+  };
+
   programs.fish = {
     enable = true;
     interactiveShellInit = ''
       fish_vi_key_bindings
+
+      # start or attach to default tmux session
+      if not set -q TMUX
+        set -g TMUX tmux new-session -d -s default
+        eval $TMUX
+        tmux attach-session -d -t default
+      end
     '';
     shellAbbrs = {
       j = "jj";
@@ -41,161 +57,25 @@
     enableFishIntegration = true;
   };
 
-  programs.nixvim = {
+  programs.tmux = {
     enable = true;
-
-    globals = {
-      mapleader = " ";
-    };
-
-    globalOpts = {
-      number = true;
-      relativenumber = true;
-      shiftwidth = 2;
-      expandtab = true;
-      tabstop = 2;
-    };
-
-    colorschemes.catppuccin.enable = true;
-
-    keymaps = [
-      {
-        key = ";";
-        action = ":";
-        mode = ["n" "v"];
-      }
-      {
-        key = "<leader>y";
-        action = ''"+y'';
-        mode = ["n" "v"];
-      }
-      {
-        key = "<leader>Y";
-        action = ''"+Y'';
-        mode = ["n" "v"];
-      }
-      {
-        key = "<leader>p";
-        action = ''"+p'';
-        mode = ["n" "v"];
-      }
-      {
-        key = "<leader>P";
-        action = ''"+P'';
-        mode = ["n" "v"];
-      }
-      {
-        key = "<leader>w";
-        action = "<cmd>w<cr>";
-        mode = ["n"];
-      }
-      {
-        key = "<leader>q";
-        action = "<cmd>q<cr>";
-        mode = ["n"];
-      }
-      {
-        key = "<esc>";
-        action = "<cmd>nohlsearch<cr>";
-        mode = ["n"];
-      }
-      {
-        key = ''<leader>"'';
-        action = "<cmd>split<cr>";
-        mode = ["n"];
-      }
-      {
-        key = "<leader>%";
-        action = "<cmd>vsplit<cr>";
-        mode = ["n"];
-      }
-      {
-        key = "<leader><tab>";
-        action = "<cmd>NERDTreeToggle<cr>";
-        mode = ["n"];
-      }
-      {
-        key = "<leader>fl";
-        action = "<cmd>NERDTreeFind<cr>";
-        mode = ["n"];
-      }
-      {
-        key = "<leader><space>";
-        action = "<cmd>Telescope find_files theme=dropdown<cr>";
-        mode = ["n"];
-      }
-      {
-        key = "<leader>/";
-        action = "<cmd>Telescope live_grep<cr>";
-        mode = ["n"];
-      }
+    keyMode = "vi";
+    mouse = true;
+    prefix = "C-a";
+    sensibleOnTop = true;
+    plugins = with pkgs.tmuxPlugins; [
+      sensible
+      prefix-highlight
+      vim-tmux-navigator
+      catppuccin
     ];
+    extraConfig = ''
+      set -g @catppuccin_flavor 'frappe'
 
-    extraPlugins = with pkgs.vimPlugins; [
-      vim-abolish
-      nerdtree
-      vim-rhubarb
-    ];
-
-    plugins.commentary.enable = true;
-    plugins.repeat.enable = true;
-    plugins.fugitive.enable = true;
-
-    plugins.nvim-autopairs.enable = true;
-    plugins.nvim-surround.enable = true;
-
-    plugins.web-devicons.enable = true;
-
-    plugins.treesitter = {
-      enable = true;
-      settings.indent.enable = true;
-      settings.highlight.enable = true;
-      grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
-        bash
-        json
-        lua
-        markdown
-        nix
-        toml
-        vim
-        yaml
-        elixir
-        javascript
-        typescript
-        css
-        html
-      ];
-    };
-
-    plugins.lsp = {
-      enable = true;
-      servers = {
-        elixirls.enable = true;
-        fish_lsp.enable = true;
-        html.enable = true;
-        nixd.enable = true;
-        tailwindcss.enable = true;
-        terraform_lsp.enable = true;
-      };
-    };
-
-    plugins.telescope.enable = true;
-
-    plugins.cmp = {
-      enable = true;
-      autoEnableSources = true;
-      settings.sources = [
-        { name = "nvim_lsp"; }
-        { name = "luasnip"; }
-        { name = "path"; }
-        { name = "buffer"; }
-      ];
-    };
-  };
-
-  programs.zellij = {
-    enable = true;
-    enableFishIntegration = false;
+      bind c new-window -c "#{pane_current_path}"
+      bind '"' split-window -c "#{pane_current_path}"
+      bind % split-window -h -c "#{pane_current_path}"
+    '';
   };
 
   programs.ssh = {
diff --git a/home-manager/nixvim/default.nix b/home-manager/nixvim/default.nix
new file mode 100644
index 0000000..d8d8f71
--- /dev/null
+++ b/home-manager/nixvim/default.nix
@@ -0,0 +1,157 @@
+{ pkgs, ... }:
+{
+  programs.nixvim = {
+    enable = true;
+
+    globals = {
+      mapleader = " ";
+    };
+
+    globalOpts = {
+      number = true;
+      relativenumber = true;
+      shiftwidth = 2;
+      expandtab = true;
+      tabstop = 2;
+    };
+
+    colorschemes.catppuccin.enable = true;
+
+    keymaps = [
+      {
+        key = ";";
+        action = ":";
+        mode = ["n" "v"];
+      }
+      {
+        key = "<leader>y";
+        action = ''"+y'';
+        mode = ["n" "v"];
+      }
+      {
+        key = "<leader>Y";
+        action = ''"+Y'';
+        mode = ["n" "v"];
+      }
+      {
+        key = "<leader>p";
+        action = ''"+p'';
+        mode = ["n" "v"];
+      }
+      {
+        key = "<leader>P";
+        action = ''"+P'';
+        mode = ["n" "v"];
+      }
+      {
+        key = "<leader>w";
+        action = "<cmd>w<cr>";
+        mode = ["n"];
+      }
+      {
+        key = "<leader>q";
+        action = "<cmd>q<cr>";
+        mode = ["n"];
+      }
+      {
+        key = "<esc>";
+        action = "<cmd>nohlsearch<cr>";
+        mode = ["n"];
+      }
+      {
+        key = ''<leader>"'';
+        action = "<cmd>split<cr>";
+        mode = ["n"];
+      }
+      {
+        key = "<leader>%";
+        action = "<cmd>vsplit<cr>";
+        mode = ["n"];
+      }
+      {
+        key = "<leader><tab>";
+        action = "<cmd>NERDTreeToggle<cr>";
+        mode = ["n"];
+      }
+      {
+        key = "<leader>fl";
+        action = "<cmd>NERDTreeFind<cr>";
+        mode = ["n"];
+      }
+      {
+        key = "<leader><space>";
+        action = "<cmd>Telescope find_files theme=dropdown<cr>";
+        mode = ["n"];
+      }
+      {
+        key = "<leader>/";
+        action = "<cmd>Telescope live_grep<cr>";
+        mode = ["n"];
+      }
+    ];
+
+    extraPlugins = with pkgs.vimPlugins; [
+      vim-abolish
+      nerdtree
+      vim-rhubarb
+    ];
+
+    plugins.commentary.enable = true;
+    plugins.repeat.enable = true;
+    plugins.fugitive.enable = true;
+
+    plugins.nvim-autopairs.enable = true;
+    plugins.nvim-surround.enable = true;
+
+    plugins.web-devicons.enable = true;
+
+    plugins.treesitter = {
+      enable = true;
+      settings.indent.enable = true;
+      settings.highlight.enable = true;
+      grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
+        bash
+        json
+        lua
+        markdown
+        nix
+        toml
+        vim
+        yaml
+        elixir
+        javascript
+        typescript
+        css
+        html
+      ];
+    };
+
+    plugins.lsp = {
+      enable = true;
+      servers = {
+        elixirls.enable = true;
+        fish_lsp.enable = true;
+        html.enable = true;
+        nixd.enable = true;
+        tailwindcss.enable = true;
+        terraform_lsp.enable = true;
+      };
+    };
+
+    plugins.telescope.enable = true;
+
+    plugins.cmp = {
+      enable = true;
+      autoEnableSources = true;
+      settings.sources = [
+        { name = "nvim_lsp"; }
+        { name = "luasnip"; }
+        { name = "path"; }
+        { name = "buffer"; }
+      ];
+    };
+
+    plugins.tmux-navigator.enable = true;
+  };
+
+}
diff --git a/home-manager/users/sloane.nix b/home-manager/users/sloane.nix
new file mode 100644
index 0000000..321dd9c
--- /dev/null
+++ b/home-manager/users/sloane.nix
@@ -0,0 +1,10 @@
+{ ... }:
+{
+  imports = [
+    ../default.nix
+  ];
+  home = {
+    username = "sloane";
+    homeDirectory = "/Users/sloane";
+  };
+}
diff --git a/home-manager/users/sperrault.nix b/home-manager/users/sperrault.nix
new file mode 100644
index 0000000..569a964
--- /dev/null
+++ b/home-manager/users/sperrault.nix
@@ -0,0 +1,8 @@
+{ ... }:
+{
+  imports = [ ../default.nix ];
+  home = {
+    username = "sperrault";
+    homeDirectory = "/Users/sperrault";
+  };
+}
diff --git a/nix-darwin/default.nix b/nix-darwin/default.nix
index 7c3c22d..fda2253 100644
--- a/nix-darwin/default.nix
+++ b/nix-darwin/default.nix
@@ -1,17 +1,10 @@
 { pkgs, ... }:
 {
-  # List packages installed in system profile. To search by name, run:
-  # $ nix-env -qaP | grep wget
   environment.systemPackages = [];
 
   # 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.
-
   # Used for backwards compatibility, please read the changelog before changing.
   # $ darwin-rebuild changelog
   system.stateVersion = 6;
@@ -19,6 +12,53 @@
   # The platform the configuration will be used on.
   nixpkgs.hostPlatform = "aarch64-darwin";
 
+  security.pam.enableSudoTouchIdAuth = true;
+
+  system.defaults = {
+    dock = {
+      autohide = true;
+      autohide-delay = 0.05;
+      orientation = "bottom";
+    };
+  };
+
   environment.shells = [ pkgs.fish ];
-  programs.fish.enable = true;
+
+  programs.fish = {
+    enable = true;
+    shellInit = ''
+      eval "$(/opt/homebrew/bin/brew shellenv)"
+    '';
+  };
+
+  homebrew = {
+    enable = true;
+    global = {
+      autoUpdate = false;
+    };
+    onActivation = {
+      autoUpdate = false;
+      cleanup = "uninstall";
+    };
+
+    brews = [
+      "mas"
+    ];
+
+    casks = [
+      "1password"
+      "alfred"
+      "fantastical"
+      "firefox"
+      "ghostty"
+      "karabiner-elements"
+      "keepingyouawake"
+      "tailscale"
+    ];
+
+    masApps = {
+      Things = 904280696;
+      "Hand Mirror" = 1502839586;
+    };
+  };
 }
diff --git a/nix-darwin/hosts/Sloanes-MacBook-Air/default.nix b/nix-darwin/hosts/Sloanes-MacBook-Air/default.nix
new file mode 100644
index 0000000..e2a52ed
--- /dev/null
+++ b/nix-darwin/hosts/Sloanes-MacBook-Air/default.nix
@@ -0,0 +1,8 @@
+{ ... }:
+{
+  homebrew = {
+    casks = [
+      "discord"
+    ];
+  };
+}
diff --git a/nix-darwin/hosts/tid27880sperrau/default.nix b/nix-darwin/hosts/tid27880sperrau/default.nix
new file mode 100644
index 0000000..facb35d
--- /dev/null
+++ b/nix-darwin/hosts/tid27880sperrau/default.nix
@@ -0,0 +1,4 @@
+{ ... }:
+{
+
+}