From ad0c402a18726554db386a57a90a638fe255cd9d Mon Sep 17 00:00:00 2001 From: Alex Bates Date: Fri, 06 Feb 2026 05:04:12 +0000 Subject: [PATCH] big module refactor --- CLAUDE.md | 41 +++++++++++++++++++++-------------------- flake.nix | 136 ++++++++-------------------------------------------------------------------------------------------------------------------------------- home/alebat01/home.nix | 3 +-- modules/home/caches.nix | 0 modules/home/cpp/default.nix | 0 modules/home/profiles/headless.nix | 12 ++++++------ modules/home/git.nix | 0 modules/home/gitignore | 0 modules/home/rust/config.toml | 0 modules/home/rust/default.nix | 0 modules/home/shell/default.nix | 0 modules/home/shell/p10k.zsh | 0 modules/home/tmux.nix | 0 modules/home/browser.nix | 0 modules/home/profiles/desktop.nix | 15 ++++++--------- modules/home/discord/README.md | 0 modules/home/discord/default.nix | 0 modules/home/discord/krisp-patcher.py | 0 modules/home/ghostty/bettercrt.glsl | 0 modules/home/ghostty/bloom.glsl | 0 modules/home/ghostty/cursor_warp.glsl | 0 modules/home/ghostty/default.nix | 0 modules/home/ghostty/glitchy.glsl | 0 modules/home/gl.nix | 0 modules/home/hammerspoon/default.nix | 0 modules/home/hammerspoon/init.lua | 0 modules/home/niri/config.kdl | 0 modules/home/niri/default.nix | 0 modules/home/zed.nix | 0 hosts/darwin.nix | 2 +- hosts/merlon/configuration.nix | 38 ++++++++++++++++++++++++++++++++++++-- hosts/merlow/configuration.nix | 22 ++++++++++++++++++++++ hosts/nolrem/configuration.nix | 18 +++++++++++++++++- hosts/watt/configuration.nix | 13 +++++++++++++ hosts/work-mbp/configuration.nix | 18 +++++++++++++++++- modules/home/profiles/laptop.nix | 6 ++++++ modules/system/focus-follows-mouse.nix | 31 +++++++++++++++++++++++++++++++ modules/system/nixvim.nix | 0 services/darwin/focus-follows-mouse.nix | 29 ----------------------------- modules/system/factorio.nix | 0 modules/system/matchbox.nix | 0 modules/system/minecraft/gtnh/default.nix | 0 modules/system/minecraft/gtnh/gtnh.nix | 0 modules/system/minecraft/vanilla.nix | 0 modules/system/minecraft/whitelist.nix | 0 modules/system/tailscale.nix | 0 modules/system/wua-mediawiki.nix | 0 modules/system/auto-upgrade.nix | 0 modules/system/gc.nix | 0 49 file(s) changed, 185 insertion(s)(+), 199 deletion(s)(-) diff --git a/CLAUDE.md b/CLAUDE.md --- a/CLAUDE.md +++ b/CLAUDE.md @@ -34,33 +34,34 @@ Hosts are named after Paper Mario shamen/mystics and they roughly reflect what the host is for. ### Hosts (`/hosts/`) -| Host | Platform | Notes | -|------|----------|-------| -| merlon | NixOS x86_64 | Desktop with Nvidia GPU, Wayland (Niri), FIDO2 disk encryption | -| merlow | NixOS x86_64 | Hetzner VPS, headless server | -| watt | NixOS x86_64 | Homelab MacBook Pro, headless, Home Assistant | -| nolrem | nix-darwin aarch64 | MacBook Air | -| FH91CFY4QP-2 | nix-darwin aarch64 | Work MacBook, uses `alebat01` user | +Each host's `configuration.nix` is self-contained: it imports the modules it needs from `/modules/` and configures home-manager inline. The `flake.nix` is kept slim, only wiring host entry points to `nixosSystem`/`darwinSystem` with `home-manager.*Modules.*`. + +| Host | Platform | Profile | Notes | +|------|----------|---------|-------| +| merlon | NixOS x86_64 | desktop | Desktop with Nvidia GPU, Wayland (Niri), FIDO2 disk encryption | +| merlow | NixOS x86_64 | headless | Hetzner VPS, headless server | +| watt | NixOS x86_64 | headless | Homelab MacBook Pro, headless | +| nolrem | nix-darwin aarch64 | laptop | MacBook Air | +| FH91CFY4QP-2 | nix-darwin aarch64 | laptop | Work MacBook, uses `alebat01` user | + +Shared darwin config lives in `hosts/darwin.nix`. -### Home Manager (`/home/`) +### Modules (`/modules/`) -Two user profiles with layered configuration: +Reusable modules organised by module system: -- **bates64/cli/** - Base configuration for all machines (shell, git, rust, cpp) -- **bates64/gui/** - Extends cli with desktop apps (browser, terminal, window manager) -- **alebat01/** - Work user, imports shared cli/gui modules +- **`modules/system/`** - NixOS and nix-darwin system modules (auto-upgrade, gc, nixvim, tailscale, factorio, matchbox, minecraft, focus-follows-mouse). Darwin-only modules use `lib.mkIf pkgs.stdenv.isDarwin`. +- **`modules/home/`** - Home-manager modules (shell, git, rust, cpp, ghostty, niri, hammerspoon, zed, browser, etc.) +- **`modules/home/profiles/`** - Chained profiles that compose home modules: + - `headless.nix` - CLI tools (shell, git, rust, cpp, caches). Defines the `isMacOS` option. + - `desktop.nix` - Imports headless + GUI apps (niri, ghostty, zed, browser, vscode) + - `laptop.nix` - Imports desktop + hammerspoon (macOS window management) -**Key pattern:** The `isMacOS` option (defined in `home/bates64/cli/default.nix`) allows conditional logic for cross-platform configs: +Hosts import modules à la carte. The `isMacOS` option allows conditional logic for cross-platform configs: ```nix if config.isMacOS then [ ] else [ pkgs.mold ] ``` -### System Modules - -- `/tasks/` - Shared NixOS modules -- `/programs/` - System-wide programs -- `/services/` - Server services - ### Flake Structure The `flake.nix` defines: @@ -68,4 +69,4 @@ - `nixosConfigurations` for Linux hosts - `darwinConfigurations` for macOS hosts - `homeConfigurations` for standalone home-manager -Inputs are passed to modules via `extraSpecialArgs = { inherit inputs; }`. +Inputs are passed to modules via `specialArgs = { inherit inputs; }`. diff --git a/flake.nix b/flake.nix --- a/flake.nix +++ b/flake.nix @@ -60,15 +60,9 @@ outputs = { nixpkgs, - minegrub-world-sel-theme, - minecraft-plymouth-theme, home-manager, nix-darwin, - nixvim, - vscode-server, nixgl, - disko, - nix-minecraft, ... }@inputs: let @@ -84,170 +78,56 @@ config.allowUnfree = true; }; in { - # nixosConfigurations = { - # PC + # Desktop PC merlon = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; pkgs = pkgs-x86_64; + specialArgs = { inherit inputs; }; modules = [ ./hosts/merlon/configuration.nix - ./tasks/auto-upgrade.nix - ./tasks/gc.nix - minegrub-world-sel-theme.nixosModules.default - minecraft-plymouth-theme.nixosModules.default - disko.nixosModules.disko - - { - programs.nix-ld.enable = true; - } - - # Splash - { - boot = { - plymouth = { - enable = true; - plymouth-minecraft-theme.enable = true; - }; - - # Enable "Silent boot" - consoleLogLevel = 3; - initrd.verbose = false; - kernelParams = [ - "quiet" - "splash" - "boot.shell_on_fail" - "udev.log_priority=3" - "rd.systemd.show_status=auto" - ]; - }; - } - home-manager.nixosModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.bates64 = ./home/bates64/gui; - home-manager.backupCommand = "rm"; - home-manager.extraSpecialArgs = { inherit inputs; }; - } - - nixvim.nixosModules.nixvim - ./programs/nixvim.nix - - vscode-server.nixosModules.default - { - services.vscode-server.enable = true; - } - - ./services/tailscale.nix ]; }; # Hetzner VPS merlow = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; pkgs = pkgs-x86_64; + specialArgs = { inherit inputs; }; modules = [ ./hosts/merlow/configuration.nix - ./tasks/auto-upgrade.nix - ./tasks/gc.nix - home-manager.nixosModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.bates64 = ./home/bates64/cli; - } - - nixvim.nixosModules.nixvim - ./programs/nixvim.nix - - vscode-server.nixosModules.default - { - services.vscode-server.enable = true; - } - - nix-minecraft.nixosModules.minecraft-servers - { - nixpkgs.overlays = [ nix-minecraft.overlay ]; - } - - ./services/factorio.nix - #./services/wua-mediawiki.nix # FIXME extensions should use git - ./services/matchbox.nix - ./services/minecraft/vanilla.nix - ./services/minecraft/gtnh - - ./services/tailscale.nix ]; }; # Homelab watt = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; pkgs = pkgs-x86_64; + specialArgs = { inherit inputs; }; modules = [ - disko.nixosModules.disko ./hosts/watt/configuration.nix - ./tasks/auto-upgrade.nix - ./tasks/gc.nix - home-manager.nixosModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.bates64 = ./home/bates64/cli; - } - - nixvim.nixosModules.nixvim - ./programs/nixvim.nix - - ./services/tailscale.nix ]; }; }; - # Laptops darwinConfigurations = { - # Macbook Air 15 + # MacBook Air 15 nolrem = nix-darwin.lib.darwinSystem { pkgs = pkgs-aarch64-darwin; + specialArgs = { inherit inputs; }; modules = [ ./hosts/nolrem/configuration.nix - ./hosts/darwin.nix - home-manager.darwinModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.bates64 = - { ... }: - { - imports = [ ./home/bates64/gui ]; - isMacOS = true; - }; - home-manager.extraSpecialArgs = { inherit inputs; }; - } ]; }; - # (Work) Macbook Pro + # (Work) MacBook Pro "FH91CFY4QP-2" = nix-darwin.lib.darwinSystem { pkgs = pkgs-aarch64-darwin; + specialArgs = { inherit inputs; }; modules = [ ./hosts/work-mbp/configuration.nix - ./hosts/darwin.nix - home-manager.darwinModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.alebat01 = - { ... }: - { - imports = [ ./home/alebat01/home.nix ]; - isMacOS = true; - }; - home-manager.extraSpecialArgs = { inherit inputs; }; - } ]; }; }; diff --git a/home/alebat01/home.nix b/home/alebat01/home.nix --- a/home/alebat01/home.nix +++ b/home/alebat01/home.nix @@ -2,8 +2,7 @@ { config, pkgs, ... }: { imports = [ ./ssh.nix - ../bates64/cli - ../bates64/gui + ../../modules/home/profiles/desktop.nix ]; config = { home.username = "alebat01"; diff --git a/home/bates64/cli/caches.nix b/modules/home/caches.nix rename from home/bates64/cli/caches.nix rename to modules/home/caches.nix --- a/home/bates64/cli/caches.nix +++ b/modules/home/caches.nix diff --git a/home/bates64/cli/cpp/default.nix b/modules/home/cpp/default.nix rename from home/bates64/cli/cpp/default.nix rename to modules/home/cpp/default.nix --- a/home/bates64/cli/cpp/default.nix +++ b/modules/home/cpp/default.nix diff --git a/home/bates64/cli/default.nix b/modules/home/profiles/headless.nix rename from home/bates64/cli/default.nix rename to modules/home/profiles/headless.nix --- a/home/bates64/cli/default.nix +++ b/modules/home/profiles/headless.nix @@ -1,12 +1,12 @@ { lib, config, ... }: { imports = [ - ./shell - ./git.nix - ./caches.nix - #./tmux.nix - ./rust - ./cpp + ../shell + ../git.nix + ../caches.nix + #../tmux.nix + ../rust + ../cpp ]; options = { isMacOS = lib.mkOption { diff --git a/home/bates64/cli/git.nix b/modules/home/git.nix rename from home/bates64/cli/git.nix rename to modules/home/git.nix --- a/home/bates64/cli/git.nix +++ b/modules/home/git.nix diff --git a/home/bates64/cli/gitignore b/modules/home/gitignore rename from home/bates64/cli/gitignore rename to modules/home/gitignore --- a/home/bates64/cli/gitignore +++ b/modules/home/gitignore diff --git a/home/bates64/cli/rust/config.toml b/modules/home/rust/config.toml rename from home/bates64/cli/rust/config.toml rename to modules/home/rust/config.toml --- a/home/bates64/cli/rust/config.toml +++ b/modules/home/rust/config.toml diff --git a/home/bates64/cli/rust/default.nix b/modules/home/rust/default.nix rename from home/bates64/cli/rust/default.nix rename to modules/home/rust/default.nix --- a/home/bates64/cli/rust/default.nix +++ b/modules/home/rust/default.nix diff --git a/home/bates64/cli/shell/default.nix b/modules/home/shell/default.nix rename from home/bates64/cli/shell/default.nix rename to modules/home/shell/default.nix --- a/home/bates64/cli/shell/default.nix +++ b/modules/home/shell/default.nix diff --git a/home/bates64/cli/shell/p10k.zsh b/modules/home/shell/p10k.zsh rename from home/bates64/cli/shell/p10k.zsh rename to modules/home/shell/p10k.zsh --- a/home/bates64/cli/shell/p10k.zsh +++ b/modules/home/shell/p10k.zsh diff --git a/home/bates64/cli/tmux.nix b/modules/home/tmux.nix rename from home/bates64/cli/tmux.nix rename to modules/home/tmux.nix --- a/home/bates64/cli/tmux.nix +++ b/modules/home/tmux.nix diff --git a/home/bates64/gui/browser.nix b/modules/home/browser.nix rename from home/bates64/gui/browser.nix rename to modules/home/browser.nix --- a/home/bates64/gui/browser.nix +++ b/modules/home/browser.nix diff --git a/home/bates64/gui/default.nix b/modules/home/profiles/desktop.nix rename from home/bates64/gui/default.nix rename to modules/home/profiles/desktop.nix --- a/home/bates64/gui/default.nix +++ b/modules/home/profiles/desktop.nix @@ -5,7 +5,6 @@ config, ... }: let - # on macOS, override ares so that `ares` works in the shell ares-wrapped = if config.isMacOS then pkgs.ares.overrideAttrs (oldAttrs: { @@ -19,13 +18,12 @@ pkgs.ares; in { imports = [ - ../cli - ./gl.nix - ./niri - ./hammerspoon - ./ghostty - ./zed.nix - ./browser.nix + ./headless.nix + ../gl.nix + ../niri + ../ghostty + ../zed.nix + ../browser.nix ]; programs.vscode = { @@ -64,5 +62,4 @@ [ aseprite # TODO: maintain darwin package ] ); - } diff --git a/home/bates64/gui/discord/README.md b/modules/home/discord/README.md rename from home/bates64/gui/discord/README.md rename to modules/home/discord/README.md --- a/home/bates64/gui/discord/README.md +++ b/modules/home/discord/README.md diff --git a/home/bates64/gui/discord/default.nix b/modules/home/discord/default.nix rename from home/bates64/gui/discord/default.nix rename to modules/home/discord/default.nix --- a/home/bates64/gui/discord/default.nix +++ b/modules/home/discord/default.nix diff --git a/home/bates64/gui/discord/krisp-patcher.py b/modules/home/discord/krisp-patcher.py rename from home/bates64/gui/discord/krisp-patcher.py rename to modules/home/discord/krisp-patcher.py --- a/home/bates64/gui/discord/krisp-patcher.py +++ b/modules/home/discord/krisp-patcher.py diff --git a/home/bates64/gui/ghostty/bettercrt.glsl b/modules/home/ghostty/bettercrt.glsl rename from home/bates64/gui/ghostty/bettercrt.glsl rename to modules/home/ghostty/bettercrt.glsl --- a/home/bates64/gui/ghostty/bettercrt.glsl +++ b/modules/home/ghostty/bettercrt.glsl diff --git a/home/bates64/gui/ghostty/bloom.glsl b/modules/home/ghostty/bloom.glsl rename from home/bates64/gui/ghostty/bloom.glsl rename to modules/home/ghostty/bloom.glsl --- a/home/bates64/gui/ghostty/bloom.glsl +++ b/modules/home/ghostty/bloom.glsl diff --git a/home/bates64/gui/ghostty/cursor_warp.glsl b/modules/home/ghostty/cursor_warp.glsl rename from home/bates64/gui/ghostty/cursor_warp.glsl rename to modules/home/ghostty/cursor_warp.glsl --- a/home/bates64/gui/ghostty/cursor_warp.glsl +++ b/modules/home/ghostty/cursor_warp.glsl diff --git a/home/bates64/gui/ghostty/default.nix b/modules/home/ghostty/default.nix rename from home/bates64/gui/ghostty/default.nix rename to modules/home/ghostty/default.nix --- a/home/bates64/gui/ghostty/default.nix +++ b/modules/home/ghostty/default.nix diff --git a/home/bates64/gui/ghostty/glitchy.glsl b/modules/home/ghostty/glitchy.glsl rename from home/bates64/gui/ghostty/glitchy.glsl rename to modules/home/ghostty/glitchy.glsl --- a/home/bates64/gui/ghostty/glitchy.glsl +++ b/modules/home/ghostty/glitchy.glsl diff --git a/home/bates64/gui/gl.nix b/modules/home/gl.nix rename from home/bates64/gui/gl.nix rename to modules/home/gl.nix --- a/home/bates64/gui/gl.nix +++ b/modules/home/gl.nix diff --git a/home/bates64/gui/hammerspoon/default.nix b/modules/home/hammerspoon/default.nix rename from home/bates64/gui/hammerspoon/default.nix rename to modules/home/hammerspoon/default.nix --- a/home/bates64/gui/hammerspoon/default.nix +++ b/modules/home/hammerspoon/default.nix diff --git a/home/bates64/gui/hammerspoon/init.lua b/modules/home/hammerspoon/init.lua rename from home/bates64/gui/hammerspoon/init.lua rename to modules/home/hammerspoon/init.lua --- a/home/bates64/gui/hammerspoon/init.lua +++ b/modules/home/hammerspoon/init.lua diff --git a/home/bates64/gui/niri/config.kdl b/modules/home/niri/config.kdl rename from home/bates64/gui/niri/config.kdl rename to modules/home/niri/config.kdl --- a/home/bates64/gui/niri/config.kdl +++ b/modules/home/niri/config.kdl diff --git a/home/bates64/gui/niri/default.nix b/modules/home/niri/default.nix rename from home/bates64/gui/niri/default.nix rename to modules/home/niri/default.nix --- a/home/bates64/gui/niri/default.nix +++ b/modules/home/niri/default.nix diff --git a/home/bates64/gui/zed.nix b/modules/home/zed.nix rename from home/bates64/gui/zed.nix rename to modules/home/zed.nix --- a/home/bates64/gui/zed.nix +++ b/modules/home/zed.nix diff --git a/hosts/darwin.nix b/hosts/darwin.nix --- a/hosts/darwin.nix +++ b/hosts/darwin.nix @@ -1,6 +1,6 @@ { imports = [ - ../services/darwin/focus-follows-mouse.nix + ../modules/system/focus-follows-mouse.nix ]; system.defaults.NSGlobalDomain.AppleFontSmoothing = 0; # https://tonsky.me/blog/monitors/ diff --git a/hosts/merlon/configuration.nix b/hosts/merlon/configuration.nix --- a/hosts/merlon/configuration.nix +++ b/hosts/merlon/configuration.nix @@ -8,6 +8,7 @@ { config, pkgs, lib, + inputs, ... }: @@ -18,7 +19,42 @@ { imports = [ ./disko.nix #./8bitdo.nix + ../../modules/system/auto-upgrade.nix + ../../modules/system/gc.nix + ../../modules/system/nixvim.nix + ../../modules/system/tailscale.nix + inputs.minegrub-world-sel-theme.nixosModules.default + inputs.minecraft-plymouth-theme.nixosModules.default + inputs.disko.nixosModules.disko + inputs.nixvim.nixosModules.nixvim + inputs.vscode-server.nixosModules.default ]; + + programs.nix-ld.enable = true; + services.vscode-server.enable = true; + + boot.plymouth = { + enable = true; + plymouth-minecraft-theme.enable = true; + }; + boot.consoleLogLevel = 3; + boot.initrd.verbose = false; + boot.kernelParams = [ + "quiet" + "splash" + "boot.shell_on_fail" + "udev.log_priority=3" + "rd.systemd.show_status=auto" + "nvidia.NVreg_PreserveVideoMemoryAllocations=1" + ]; + + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users.bates64 = ../../modules/home/profiles/desktop.nix; + backupCommand = "rm"; + extraSpecialArgs = { inherit inputs; }; + }; boot.loader.grub = { enable = true; @@ -210,8 +246,6 @@ nvidiaSettings = true; forceFullCompositionPipeline = true; # Fixes tearing package = config.boot.kernelPackages.nvidiaPackages.stable; }; - - boot.kernelParams = [ "nvidia.NVreg_PreserveVideoMemoryAllocations=1" ]; boot.extraModulePackages = with config.boot.kernelPackages; diff --git a/hosts/merlow/configuration.nix b/hosts/merlow/configuration.nix --- a/hosts/merlow/configuration.nix +++ b/hosts/merlow/configuration.nix @@ -2,13 +2,35 @@ { config, lib, pkgs, + inputs, ... }: { imports = [ ./hardware-configuration.nix + ../../modules/system/auto-upgrade.nix + ../../modules/system/gc.nix + ../../modules/system/nixvim.nix + ../../modules/system/tailscale.nix + ../../modules/system/factorio.nix + #../../modules/system/wua-mediawiki.nix # FIXME extensions should use git + ../../modules/system/matchbox.nix + ../../modules/system/minecraft/vanilla.nix + ../../modules/system/minecraft/gtnh + inputs.nixvim.nixosModules.nixvim + inputs.vscode-server.nixosModules.default + inputs.nix-minecraft.nixosModules.minecraft-servers ]; + + services.vscode-server.enable = true; + nixpkgs.overlays = [ inputs.nix-minecraft.overlay ]; + + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users.bates64 = ../../modules/home/profiles/headless.nix; + }; # Use the GRUB 2 boot loader. boot.loader.grub.enable = true; diff --git a/hosts/nolrem/configuration.nix b/hosts/nolrem/configuration.nix --- a/hosts/nolrem/configuration.nix +++ b/hosts/nolrem/configuration.nix @@ -1,5 +1,21 @@ -{ pkgs, ... }: +{ pkgs, inputs, ... }: { + imports = [ + ../darwin.nix + ]; + + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users.bates64 = + { ... }: + { + imports = [ ../../modules/home/profiles/laptop.nix ]; + isMacOS = true; + }; + extraSpecialArgs = { inherit inputs; }; + }; + # List packages installed in system profile. To search by name, run: # $ nix-env -qaP | grep wget environment.systemPackages = [ diff --git a/hosts/watt/configuration.nix b/hosts/watt/configuration.nix --- a/hosts/watt/configuration.nix +++ b/hosts/watt/configuration.nix @@ -2,6 +2,7 @@ { config, lib, pkgs, + inputs, modulesPath, ... }: @@ -10,7 +11,19 @@ { imports = [ ./disko.nix (modulesPath + "/hardware/network/broadcom-43xx.nix") + ../../modules/system/auto-upgrade.nix + ../../modules/system/gc.nix + ../../modules/system/nixvim.nix + ../../modules/system/tailscale.nix + inputs.disko.nixosModules.disko + inputs.nixvim.nixosModules.nixvim ]; + + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users.bates64 = ../../modules/home/profiles/headless.nix; + }; # Hardware boot.initrd.availableKernelModules = [ diff --git a/hosts/work-mbp/configuration.nix b/hosts/work-mbp/configuration.nix --- a/hosts/work-mbp/configuration.nix +++ b/hosts/work-mbp/configuration.nix @@ -1,5 +1,21 @@ -{ pkgs, ... }: +{ pkgs, inputs, ... }: { + imports = [ + ../darwin.nix + ]; + + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users.alebat01 = + { ... }: + { + imports = [ ../../home/alebat01/home.nix ]; + isMacOS = true; + }; + extraSpecialArgs = { inherit inputs; }; + }; + # List packages installed in system profile. To search by name, run: # $ nix-env -qaP | grep wget environment.systemPackages = [ diff --git a/modules/home/profiles/laptop.nix b/modules/home/profiles/laptop.nix new file mode 100644 --- /dev/null +++ b/modules/home/profiles/laptop.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./desktop.nix + ../hammerspoon + ]; +} diff --git a/modules/system/focus-follows-mouse.nix b/modules/system/focus-follows-mouse.nix new file mode 100644 --- /dev/null +++ b/modules/system/focus-follows-mouse.nix @@ -0,0 +1,31 @@ +{ + config, + lib, + pkgs, + ... +}: +let + autoraise = pkgs.autoraise.overrideAttrs (old: { + buildPhase = '' + runHook preBuild + $CXX -std=c++03 -fobjc-arc -D"NS_FORMAT_ARGUMENT(A)=" -D"SKYLIGHT_AVAILABLE=1" -DEXPERIMENTAL_FOCUS_FIRST -o AutoRaise AutoRaise.mm -framework AppKit -framework SkyLight + bash create-app-bundle.sh + runHook postBuild + ''; + }); +in +{ + config = lib.mkIf pkgs.stdenv.isDarwin { + environment.systemPackages = [ autoraise ]; + + launchd.user.agents.autoraise = { + command = "${autoraise}/bin/autoraise -delay 0 -focusDelay 1"; + serviceConfig = { + KeepAlive = true; + RunAtLoad = true; + StandardOutPath = "/tmp/autoraise.log"; + StandardErrorPath = "/tmp/autoraise.err.log"; + }; + }; + }; +} diff --git a/programs/nixvim.nix b/modules/system/nixvim.nix rename from programs/nixvim.nix rename to modules/system/nixvim.nix --- a/programs/nixvim.nix +++ b/modules/system/nixvim.nix diff --git a/services/darwin/focus-follows-mouse.nix b/services/darwin/focus-follows-mouse.nix deleted file mode 100644 --- a/services/darwin/focus-follows-mouse.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -let - autoraise = pkgs.autoraise.overrideAttrs (old: { - buildPhase = '' - runHook preBuild - $CXX -std=c++03 -fobjc-arc -D"NS_FORMAT_ARGUMENT(A)=" -D"SKYLIGHT_AVAILABLE=1" -DEXPERIMENTAL_FOCUS_FIRST -o AutoRaise AutoRaise.mm -framework AppKit -framework SkyLight - bash create-app-bundle.sh - runHook postBuild - ''; - }); -in -{ - environment.systemPackages = [ autoraise ]; - - launchd.user.agents.autoraise = { - command = "${autoraise}/bin/autoraise -delay 0 -focusDelay 1"; - serviceConfig = { - KeepAlive = true; - RunAtLoad = true; - StandardOutPath = "/tmp/autoraise.log"; - StandardErrorPath = "/tmp/autoraise.err.log"; - }; - }; -} diff --git a/services/factorio.nix b/modules/system/factorio.nix rename from services/factorio.nix rename to modules/system/factorio.nix --- a/services/factorio.nix +++ b/modules/system/factorio.nix diff --git a/services/matchbox.nix b/modules/system/matchbox.nix rename from services/matchbox.nix rename to modules/system/matchbox.nix --- a/services/matchbox.nix +++ b/modules/system/matchbox.nix diff --git a/services/minecraft/gtnh/default.nix b/modules/system/minecraft/gtnh/default.nix rename from services/minecraft/gtnh/default.nix rename to modules/system/minecraft/gtnh/default.nix --- a/services/minecraft/gtnh/default.nix +++ b/modules/system/minecraft/gtnh/default.nix diff --git a/services/minecraft/gtnh/gtnh.nix b/modules/system/minecraft/gtnh/gtnh.nix rename from services/minecraft/gtnh/gtnh.nix rename to modules/system/minecraft/gtnh/gtnh.nix --- a/services/minecraft/gtnh/gtnh.nix +++ b/modules/system/minecraft/gtnh/gtnh.nix diff --git a/services/minecraft/vanilla.nix b/modules/system/minecraft/vanilla.nix rename from services/minecraft/vanilla.nix rename to modules/system/minecraft/vanilla.nix --- a/services/minecraft/vanilla.nix +++ b/modules/system/minecraft/vanilla.nix diff --git a/services/minecraft/whitelist.nix b/modules/system/minecraft/whitelist.nix rename from services/minecraft/whitelist.nix rename to modules/system/minecraft/whitelist.nix --- a/services/minecraft/whitelist.nix +++ b/modules/system/minecraft/whitelist.nix diff --git a/services/tailscale.nix b/modules/system/tailscale.nix rename from services/tailscale.nix rename to modules/system/tailscale.nix --- a/services/tailscale.nix +++ b/modules/system/tailscale.nix diff --git a/services/wua-mediawiki.nix b/modules/system/wua-mediawiki.nix rename from services/wua-mediawiki.nix rename to modules/system/wua-mediawiki.nix --- a/services/wua-mediawiki.nix +++ b/modules/system/wua-mediawiki.nix diff --git a/tasks/auto-upgrade.nix b/modules/system/auto-upgrade.nix rename from tasks/auto-upgrade.nix rename to modules/system/auto-upgrade.nix --- a/tasks/auto-upgrade.nix +++ b/modules/system/auto-upgrade.nix diff --git a/tasks/gc.nix b/modules/system/gc.nix rename from tasks/gc.nix rename to modules/system/gc.nix --- a/tasks/gc.nix +++ b/modules/system/gc.nix -- tangled.sh