diff --git a/caesium.hardware.nix b/caesium.hardware.nix index e2b9781..1bcbe43 100644 --- a/caesium.hardware.nix +++ b/caesium.hardware.nix @@ -1,40 +1,56 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: +{ config +, lib +, modulesPath +, ... +}: { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "nvme" "ahci" "xhci_pci" "thunderbolt" "usbhid" "usb_storage" "sd_mod" "sr_mod" ]; + boot.initrd.availableKernelModules = [ + "nvme" + "ahci" + "xhci_pci" + "thunderbolt" + "usbhid" + "usb_storage" + "sd_mod" + "sr_mod" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/disk/by-uuid/9523b80b-8a1f-4784-9750-9b8fadf91b92"; - fsType = "btrfs"; - options = [ "subvol=@" ]; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/9523b80b-8a1f-4784-9750-9b8fadf91b92"; + fsType = "btrfs"; + options = [ "subvol=@" ]; + }; - fileSystems."/nix" = - { device = "/dev/disk/by-uuid/9523b80b-8a1f-4784-9750-9b8fadf91b92"; - fsType = "btrfs"; - options = [ "subvol=@nix" ]; - }; + fileSystems."/nix" = { + device = "/dev/disk/by-uuid/9523b80b-8a1f-4784-9750-9b8fadf91b92"; + fsType = "btrfs"; + options = [ "subvol=@nix" ]; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/038C-E1E1"; - fsType = "vfat"; - options = [ "fmask=0022" "dmask=0022" ]; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/038C-E1E1"; + fsType = "vfat"; + options = [ + "fmask=0022" + "dmask=0022" + ]; + }; - fileSystems."/home" = - { device = "/dev/disk/by-uuid/ddbb8d84-7704-45a0-93b4-7d38905755f3"; - fsType = "ext4"; - }; + fileSystems."/home" = { + device = "/dev/disk/by-uuid/ddbb8d84-7704-45a0-93b4-7d38905755f3"; + fsType = "ext4"; + }; swapDevices = [ ]; diff --git a/caesium.home.nix b/caesium.home.nix index 0c4e275..bc11f00 100644 --- a/caesium.home.nix +++ b/caesium.home.nix @@ -1,4 +1,9 @@ -{ config, inputs, lib, pkgs, ... }: { +{ config, pkgs, ... }: { + + imports = [ + ./programs.vscode.nix + ./programs.thunderbird.nix + ]; home.packages = with pkgs; [ firefox @@ -6,32 +11,23 @@ faugus-launcher ]; + systemd.user.sessionVariables = { + ## Required to fix firefox unrendered addressbar and tabs + XDG_DATA_DIRS = "${config.home.homeDirectory}/.nix-profile/share:/usr/local/share:/usr/share"; + }; + services.flatpak = { + enable = true; packages = [ "com.spotify.Client" "com.discordapp.Discord" - "flathub:app/com.anthropic.Claude/x86_64/stable" ]; - overrides = []; }; programs.zsh.shellAliases = { claude = "nix run github:sadjow/claude-code-nix"; }; - programs.vscode = { - enable = true; - package = pkgs.vscode-fhs; - profiles.default = { - userSettings = builtins.fromJSON (builtins.readFile ./config.vscode.settings.json); - extensions = with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [ - bbenoist.nix - vscode-icons-team.vscode-icons - waderyan.gitblame - ]; - }; - }; - home.sessionVariables = { NPM_CONFIG_PREFIX = "/mnt/Projects/.npm-global/.npm-global"; }; @@ -42,5 +38,6 @@ home.file.".npmrc".text = '' prefix=/mnt/Projects/.npm-global/.npm-global - '' ; + ''; } + \ No newline at end of file diff --git a/caesium.nixos.nix b/caesium.nixos.nix index 2fbc6aa..a5b73ca 100644 --- a/caesium.nixos.nix +++ b/caesium.nixos.nix @@ -1,14 +1,17 @@ -{ config, pkgs, ... }: +{ pkgs, ... }: { - imports = [ + imports = [ ./caesium.hardware.nix # Crucial: Imports your UUIDs ./module.firewall.nix ]; time.timeZone = "America/New_York"; nixpkgs.config.allowUnfree = true; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; # --- BOOTLOADER --- boot.loader.systemd-boot.enable = true; @@ -44,39 +47,62 @@ # Primary Swap: Compressed RAM (Fastest) zramSwap.enable = true; zramSwap.memoryPercent = 25; + systemd.oomd.enable = true; + services.earlyoom.enable = true; + services.earlyoom.freeMemThreshold = 5; # trigger at 5% free RAM + services.earlyoom.freeSwapThreshold = 10; # trigger at 10% free swap # Secondary Swap: 16GB File on Alpha (Safety Net) - swapDevices = [ { - device = "/var/lib/swapfile"; - size = 16 * 1024; # 16GB - } ]; + swapDevices = [ + { + device = "/var/lib/swapfile"; + size = 16 * 1024; # 16GB + } + ]; # --- USER & GROUPS --- - users.groups.storage = {}; + users.groups.storage = { }; users.users.mbessette = { isNormalUser = true; shell = pkgs.zsh; - extraGroups = [ "wheel" "networkmanager" "storage" "docker" ]; + extraGroups = [ + "wheel" + "networkmanager" + "storage" + "docker" + ]; openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILsZW38Ad1GAhGgfo7LsBzt6M4oo30VafsmNrILPMVio" ]; }; # --- FILE SYSTEMS (Overrides/Additions) --- - # Note: The UUIDs stay in hardware-configuration.nix. + # Note: The UUIDs stay in hardware-configuration.nix. # We only list them here if we want to add specific options like compression. - - fileSystems."/nix".options = [ "subvol=@nix" "compress=zstd" "noatime" ]; + + fileSystems."/nix".options = [ + "subvol=@nix" + "compress=zstd" + "noatime" + ]; fileSystems."/mnt/bottles" = { device = "/dev/disk/by-uuid/9523b80b-8a1f-4784-9750-9b8fadf91b92"; # Use the same Alpha UUID fsType = "btrfs"; - options = [ "subvol=@bottles" "compress=zstd" "noatime" ]; + options = [ + "subvol=@bottles" + "compress=zstd" + "noatime" + ]; }; fileSystems."/mnt/steam-games" = { device = "/dev/disk/by-uuid/9523b80b-8a1f-4784-9750-9b8fadf91b92"; fsType = "btrfs"; - options = [ "subvol=@steam" "compress=zstd" "noatime" ]; + options = [ + "subvol=@steam" + "compress=zstd" + "noatime" + ]; }; fileSystems."/mnt/Projects" = { @@ -106,17 +132,17 @@ alsa.enable = true; alsa.support32Bit = true; pulse.enable = true; - + # Use pulse.rules to target specific apps or set global pulse defaults extraConfig.pipewire-pulse."92-discord-fix" = { "pulse.rules" = [ { - matches = [ { "application.name" = "~Discord*"; } ]; + matches = [{ "application.name" = "~Discord*"; }]; actions = { update-props = { - "pulse.min.req" = "1024/48000"; + "pulse.min.req" = "1024/48000"; "pulse.default.req" = "1024/48000"; - "pulse.max.req" = "2048/48000"; + "pulse.max.req" = "2048/48000"; "pulse.min.quantum" = "1024/48000"; }; }; @@ -157,6 +183,13 @@ }; # --- PROGRAMS --- + services.printing = { + enable = true; + drivers = [ + pkgs.hplip + ]; + }; + programs.zsh.enable = true; programs.steam = { @@ -179,7 +212,7 @@ environment.systemPackages = with pkgs; [ ethtool - vim + vim git wget curl diff --git a/cleo.darwin.nix b/cleo.darwin.nix index 287e7d8..d7a2c34 100644 --- a/cleo.darwin.nix +++ b/cleo.darwin.nix @@ -1,12 +1,15 @@ -{ pkgs, lib, inputs, ... }: +{ pkgs +, lib +, ... +}: let ansibleRequired = { taps = [ "fwdcloudsec/granted" # aws sso utility - "felipeelias/tap" # claude-statusline - "f1bonacc1/tap" # process-compose - "oven-sh/bun" # bun - "sst/tap" # opencode + "felipeelias/tap" # claude-statusline + "f1bonacc1/tap" # process-compose + "oven-sh/bun" # bun + "sst/tap" # opencode ]; brews = [ "allure" @@ -26,7 +29,7 @@ let "snyk-cli" "sst/tap/opencode" "ldcli" - + ## Excluded intentionally # "libpq@17" # "node@22" @@ -35,7 +38,7 @@ let "1password-cli" "aws-vpn-client" "chromedriver" - "claude-code" # stable channel; playbook can opt into claude-code@latest + "claude-code" # stable channel; playbook can opt into claude-code@latest "copilot-cli" "docker-desktop" "expo-orbit" @@ -47,7 +50,8 @@ let # "jetbrains-toolbox" ]; }; -in { +in +{ ids.gids.nixbld = 350; security.pam.services.sudo_local.touchIdAuth = true; @@ -74,7 +78,11 @@ in { ]; # Add Homebrew to PATH - environment.systemPath = [ "/opt/homebrew/bin" "/opt/homebrew/sbin" "/Users/matthew.bessette/.local/bin" ]; + environment.systemPath = [ + "/opt/homebrew/bin" + "/opt/homebrew/sbin" + "/Users/matthew.bessette/.local/bin" + ]; system.primaryUser = "matthew.bessette"; users.users."matthew.bessette" = { @@ -83,8 +91,8 @@ in { }; # Homebrew for Casks and specific binaries - # In a nix-darwin setup, Homebrew packages are not actually stored inside the Nix store. - # Instead, nix-darwin acts as a manager that triggers the standard Homebrew installation + # In a nix-darwin setup, Homebrew packages are not actually stored inside the Nix store. + # Instead, nix-darwin acts as a manager that triggers the standard Homebrew installation # process on your macOS system. homebrew = { enable = true; @@ -95,33 +103,42 @@ in { # Each list is (ansible-managed set) ++ (nix-only extras), deduped. With # cleanup = "uninstall" above, anything NOT listed here gets removed on # activation — so ansibleRequired must be merged in or nix would clobber it. - taps = lib.unique (ansibleRequired.taps ++ [ - # nix-only taps go here - ]); - brews = lib.unique (ansibleRequired.brews ++ [ - "biome" - "jira-cli" - "treehouse" - ]); + taps = lib.unique ( + ansibleRequired.taps + ++ [ + # nix-only taps go here + ] + ); + brews = lib.unique ( + ansibleRequired.brews + ++ [ + "biome" + "jira-cli" + "treehouse" + ] + ); # visual-studio-code is installed by Homebrew (in ansibleRequired.casks) so # Homebrew owns the .app; home-manager (cleo.home.nix) owns settings + # extensions only (programs.vscode with package = null) — no second copy. - casks = lib.unique (ansibleRequired.casks ++ [ - "android-commandlinetools" - "android-platform-tools" - "bruno" - "claude" - "figma" - "super-productivity" - "kopiaui" - "libreoffice" - "obsidian" - "postico" - "sublime-text" - "spotify" - "yubico-yubikey-manager" - "zoom" - ]); + casks = lib.unique ( + ansibleRequired.casks + ++ [ + "android-commandlinetools" + "android-platform-tools" + "bruno" + "claude" + "figma" + "super-productivity" + "kopiaui" + "libreoffice" + "obsidian" + "postico" + "sublime-text" + "spotify" + "yubico-yubikey-manager" + "zoom" + ] + ); masApps = { BetterSnapTool = 417375580; diff --git a/cleo.home.nix b/cleo.home.nix index 10efb8f..38ab88d 100644 --- a/cleo.home.nix +++ b/cleo.home.nix @@ -1,47 +1,11 @@ -{ config, lib, pkgs, inputs, ... }: -let - oldPkgs = import inputs.nixpkgs-nodejs { - system = pkgs.stdenv.hostPlatform.system; - config.allowUnfree = true; - }; -in +{ config, pkgs, inputs, ... }: { - home.username = "matthew.bessette"; - home.homeDirectory = "/Users/matthew.bessette"; + imports = [ + ./programs.vscode.nix + ]; - home.packages = with pkgs; []; + home.packages = with pkgs; [ ]; - programs.vscode = { - enable = true; - mutableExtensionsDir = false; - profiles.default = { - userSettings = builtins.fromJSON (builtins.readFile ./config.vscode.settings.json); - extensions = ( - with pkgs.vscode-marketplace-release; [ - bbenoist.nix - graphql.vscode-graphql-syntax - graphql.vscode-graphql - ms-python.debugpy - ms-python.python - ms-python.vscode-pylance - oxc.oxc-vscode - vscode-icons-team.vscode-icons - typescriptteam.native-preview - waderyan.gitblame - ] - ) ++ ( - with pkgs.vscode-marketplace; [ - biomejs.biome - ] - ); - }; - }; - - # mise runtime manager — installed by nix. Zsh integration is disabled - # because `mise activate zsh` registers a precmd hook that re-evaluates the - # environment before every prompt, causing a per-command shell delay. - # Tools still resolve via shims on PATH (see home.sessionPath below); this - # trades away mise's per-directory env-var auto-loading for prompt speed. programs.mise = { enable = true; enableZshIntegration = false; @@ -108,24 +72,11 @@ in home.file.".npmrc".text = '' prefix=${config.home.homeDirectory}/.npm-global - '' ; + ''; - # Stub Android SDK directory so ANDROID_HOME/platform-tools/adb resolves to - # the adb binary installed by the android-platform-tools Homebrew cask. home.file."android-sdk/platform-tools/adb".source = config.lib.file.mkOutOfStoreSymlink "/opt/homebrew/bin/adb"; home.file."android-sdk/cmdline-tools/latest/bin/sdkmanager".source = config.lib.file.mkOutOfStoreSymlink "/opt/homebrew/bin/sdkmanager"; - xdg.configFile."oxlint/oxlintrc.json".source = config.lib.file.mkOutOfStoreSymlink "/Users/matthew.bessette/nixos/config.oxlintrc.json"; - xdg.configFile."biome/biome.json".source = config.lib.file.mkOutOfStoreSymlink "/Users/matthew.bessette/nixos/config.biome.json"; - # --- Tool config parity with local-dev-ansible (tasks/config/*) --- - # Note: ~/.aws/config is intentionally NOT managed here — `aws-sso-util configure - # populate` must rewrite it at runtime, which a read-only nix symlink would block. - # Run once after switch: - # aws-sso-util configure populate \ - # --sso-start-url https://d-9067516d20.awsapps.com/start \ - # --sso-region us-east-1 --region us-east-1 --config-default output=json - - # GitHub Copilot CLI (tasks/config/copilot.yml) home.file.".copilot/settings.json".text = builtins.toJSON { footer = { showModelEffort = true; @@ -156,40 +107,4 @@ in tuiSidebarPanel.enabled = true; maintainerAnnouncements = { enabled = false; home = false; }; }; - - # Claude Code settings (tasks/config/claude-code.yml) — cleo-scoped override of the - # shared config.claude.json, since claude-statusline is only installed on cleo. - # mkForce wins over home.shared.nix's `.source = ./config.claude.json`. - xdg.configFile."claude/settings.json".source = lib.mkForce (pkgs.writeText "claude-settings.json" (builtins.toJSON { - "$schema" = "https://json.schemastore.org/claude-code-settings.json"; - theme = "dark"; - agent = "plan"; - denyCommands = [ "code --install-extension*" ]; - additionalDirectories = [ "/tmp" ]; - autoMemoryEnabled = false; - effortLevel = "medium"; - fastModePerSessionOptIn = true; - feedbackSurveyRate = 0; - model = "opusplan"; - showClearContextOnPlanAccept = false; - statusLine = { type = "command"; command = "claude-statusline prompt"; }; - })); - xdg.configFile."claude-statusline/config.toml".text = '' - format = "$directory | $git_branch | $model | $cost | $context | $usage" - preset = "default" - - [usage] - disabled = false - format = 'S: {{printf "%.0f" .BlockPct}}% ({{.BlockResets}}) | W: {{printf "%.0f" .WeeklyPct}}%' - ''; - - xdg.configFile."1Password/ssh/agent.toml".text = lib.mkForce '' - [[ssh-keys]] - item = "Cleo SSH Key" - vault = "Cleo" - - [[ssh-keys]] - item = "Personal SSH Key" - vault = "Private" - ''; -} \ No newline at end of file +} diff --git a/config.claude.json b/config.claude.json deleted file mode 100644 index fa21b22..0000000 --- a/config.claude.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/claude-code-settings.json", - "theme": "dark", - "agent": "plan", - "denyCommands": ["code --install-extension*"] -} diff --git a/config.vscode.settings.json b/config.vscode.settings.json index c7066c5..12a7f6b 100644 --- a/config.vscode.settings.json +++ b/config.vscode.settings.json @@ -32,6 +32,19 @@ "source.organizeImports": "explicit" } }, + "[nix]": { + "editor.defaultFormatter": "jnoortheen.nix-ide", + "editor.formatOnSave": true + }, + "nix.enableLanguageServer": true, + "nix.serverPath": "nixd", + "nix.serverSettings": { + "nixd": { + "formatting": { + "command": ["treefmt", "--stdin", "buffer.nix"] + } + } + }, "js/ts.updateImportsOnPaste.enabled": true, "js/ts.preferences.importModuleSpecifier": "relative", "git.openRepositoryInParentFolders": "never", diff --git a/flake.nix b/flake.nix index 30b7b53..c8f8b8e 100644 --- a/flake.nix +++ b/flake.nix @@ -42,19 +42,17 @@ nixpkgs-nodejs.url = "github:NixOS/nixpkgs/21808d22b1cda1898b71cf1a1beb524a97add2c4"; }; - outputs = inputs @ { - self, - nixpkgs, - nixpkgsUnstable, - nixos-hardware, - home-manager, - home-manager-darwin, - nix-darwin, - mac-app-util, - nix-flatpak, - nixpkgs-nodejs, - ... - }: + outputs = + inputs@{ + nixpkgs, + nixpkgsUnstable, + home-manager, + home-manager-darwin, + nix-darwin, + mac-app-util, + nix-flatpak, + ... + }: let linuxSystem = "x86_64-linux"; darwinSystem = "aarch64-darwin"; @@ -71,12 +69,16 @@ }; }) ]; - in { + in + { # ------------------------------------------------------------- # NixOS Configuration (Linux) # ------------------------------------------------------------- nixosConfigurations.caesium = nixpkgs.lib.nixosSystem { - specialArgs = { system = linuxSystem; inherit inputs; }; + specialArgs = { + system = linuxSystem; + inherit inputs; + }; modules = [ { nixpkgs.overlays = mkOverlays linuxSystem; @@ -90,7 +92,10 @@ # nix-darwin Configuration (macOS) # ------------------------------------------------------------- darwinConfigurations.cleo-darwin = nix-darwin.lib.darwinSystem { - specialArgs = { system = darwinSystem; inherit inputs; }; + specialArgs = { + system = darwinSystem; + inherit inputs; + }; system = darwinSystem; modules = [ { @@ -103,7 +108,10 @@ }; darwinConfigurations.hydrogen = nix-darwin.lib.darwinSystem { - specialArgs = { system = darwinSystem; inherit inputs; }; + specialArgs = { + system = darwinSystem; + inherit inputs; + }; system = darwinSystem; modules = [ { @@ -118,67 +126,73 @@ # ------------------------------------------------------------- # Homemanager configuration # ------------------------------------------------------------- - homeConfigurations."mbessette@caesium" = let - pkgs = import nixpkgs { - system = linuxSystem; - config.allowUnfree = true; - overlays = mkOverlays linuxSystem; + homeConfigurations."mbessette@caesium" = + let + pkgs = import nixpkgs { + system = linuxSystem; + config.allowUnfree = true; + overlays = mkOverlays linuxSystem; + }; + in + home-manager.lib.homeManagerConfiguration { + inherit pkgs; + extraSpecialArgs = { + system = linuxSystem; + hostname = "caesium"; + userConfig = (import ./variables.nix { inherit pkgs; })."mbessette"; + inherit inputs; + }; + modules = [ + nix-flatpak.homeManagerModules.nix-flatpak + ./home.shared.nix + ./caesium.home.nix + ]; }; - in home-manager.lib.homeManagerConfiguration { - inherit pkgs; - extraSpecialArgs = { - system = linuxSystem; - hostname = "caesium"; - userConfig = (import ./variables.nix { inherit pkgs; })."mbessette"; - inherit inputs; - }; - modules = [ - nix-flatpak.homeManagerModules.nix-flatpak - ./home.shared.nix - ./caesium.home.nix - ]; - }; - homeConfigurations."mbessette@hydrogen" = let - pkgs = import nixpkgsUnstable { - system = darwinSystem; - config.allowUnfree = true; - overlays = mkOverlays darwinSystem; + homeConfigurations."mbessette@hydrogen" = + let + pkgs = import nixpkgsUnstable { + system = darwinSystem; + config.allowUnfree = true; + overlays = mkOverlays darwinSystem; + }; + in + home-manager-darwin.lib.homeManagerConfiguration { + inherit pkgs; + extraSpecialArgs = { + system = darwinSystem; + hostname = "hydrogen"; + userConfig = (import ./variables.nix { inherit pkgs; }).mbessette; + inherit inputs; + }; + modules = [ + ./home.shared.nix + ./hydrogen.home.nix + mac-app-util.homeManagerModules.default + ]; }; - in home-manager-darwin.lib.homeManagerConfiguration { - inherit pkgs; - extraSpecialArgs = { - system = darwinSystem; - hostname = "hydrogen"; - userConfig = (import ./variables.nix { inherit pkgs; }).mbessette; - inherit inputs; - }; - modules = [ - ./home.shared.nix - ./hydrogen.home.nix - mac-app-util.homeManagerModules.default - ]; - }; - homeConfigurations."matthew.bessette@cleo-darwin" = let - pkgs = import nixpkgsUnstable { - system = darwinSystem; - config.allowUnfree = true; - overlays = mkOverlays darwinSystem; + homeConfigurations."matthew.bessette@cleo-darwin" = + let + pkgs = import nixpkgsUnstable { + system = darwinSystem; + config.allowUnfree = true; + overlays = mkOverlays darwinSystem; + }; + in + home-manager-darwin.lib.homeManagerConfiguration { + inherit pkgs; + extraSpecialArgs = { + system = darwinSystem; + hostname = "cleo-darwin"; + userConfig = (import ./variables.nix { inherit pkgs; })."matthew.bessette"; + inherit inputs; + }; + modules = [ + ./home.shared.nix + ./cleo.home.nix + mac-app-util.homeManagerModules.default + ]; }; - in home-manager-darwin.lib.homeManagerConfiguration { - inherit pkgs; - extraSpecialArgs = { - system = darwinSystem; - hostname = "cleo-darwin"; - userConfig = (import ./variables.nix { inherit pkgs; })."matthew.bessette"; - inherit inputs; - }; - modules = [ - ./home.shared.nix - ./cleo.home.nix - mac-app-util.homeManagerModules.default - ]; - }; }; } diff --git a/home.shared.nix b/home.shared.nix index 0a801bd..3b5a456 100644 --- a/home.shared.nix +++ b/home.shared.nix @@ -1,34 +1,75 @@ -{ config, lib, pkgs, hostname, userConfig, ... }: +{ + config, + lib, + pkgs, + hostname, + userConfig, + ... +}: let - onePassPath = if pkgs.stdenv.isDarwin - then "${userConfig.homeDirectory}/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock" - else "${userConfig.homeDirectory}/.1password/agent.sock"; - ghosttyPkg = if pkgs.stdenv.isDarwin - then pkgs."ghostty-bin" - else pkgs.ghostty; - rebuildCmd = if pkgs.stdenv.isDarwin - then "darwin-rebuild" - else "nixos-rebuild"; -in { + onePassPath = + if pkgs.stdenv.isDarwin then + "${userConfig.homeDirectory}/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock" + else + "${userConfig.homeDirectory}/.1password/agent.sock"; + ghosttyPkg = if pkgs.stdenv.isDarwin then pkgs."ghostty-bin" else pkgs.ghostty; + rebuildCmd = if pkgs.stdenv.isDarwin then "darwin-rebuild" else "nixos-rebuild"; +in +{ home.stateVersion = lib.mkDefault "26.05"; home.username = userConfig.username; home.homeDirectory = userConfig.homeDirectory; home.sessionVariables.SSH_AUTH_SOCK = onePassPath; home.sessionVariables.CLAUDE_CONFIG_DIR = "${config.xdg.configHome}/claude"; + home.packages = with pkgs; [ + nixd + treefmt + nixpkgs-fmt + deadnix + ]; + xdg.enable = true; xdg.configHome = "${config.home.homeDirectory}/.config"; xdg.cacheHome = "${config.home.homeDirectory}/.cache"; xdg.dataHome = "${config.home.homeDirectory}/.local/share"; xdg.stateHome = "${config.home.homeDirectory}/.config/state"; xdg.configFile."ssh.conf".source = ./config.ssh.conf; - xdg.configFile."claude/settings.json".source = ./config.claude.json; xdg.configFile."1Password/ssh/agent.toml".text = '' [[ssh-keys]] item = "${userConfig._1PassKeyName}" vault = "${userConfig._1PassKeyVault}" ''; + xdg.configFile."claude/settings.json".source = pkgs.writeText "claude-settings.json" ( + builtins.toJSON { + "$schema" = "https://json.schemastore.org/claude-code-settings.json"; + theme = "dark"; + agent = "plan"; + denyCommands = [ "code --install-extension*" ]; + additionalDirectories = [ "/tmp" ]; + autoMemoryEnabled = false; + effortLevel = "medium"; + fastModePerSessionOptIn = true; + feedbackSurveyRate = 0; + model = "opusplan"; + showClearContextOnPlanAccept = false; + statusLine = { + type = "command"; + command = "claude-statusline prompt"; + }; + } + ); + + xdg.configFile."claude-statusline/config.toml".text = '' + format = "$directory | $git_branch | $model | $cost | $context | $usage" + preset = "default" + + [usage] + disabled = false + format = 'S: {{printf "%.0f" .BlockPct}}% ({{.BlockResets}}) | W: {{printf "%.0f" .WeeklyPct}}%' + ''; + programs.tmux.enable = true; programs.fastfetch.enable = true; diff --git a/hydrogen.home.nix b/hydrogen.home.nix index 8503bde..7ba2735 100644 --- a/hydrogen.home.nix +++ b/hydrogen.home.nix @@ -1,17 +1,8 @@ { config, inputs, pkgs, ... }: { - - # Managed VS Code Extensions (The "Clean" Way) - programs.vscode = { - enable = true; - profiles.default = { - userSettings = builtins.fromJSON (builtins.readFile ./config.vscode.settings.json); - extensions = with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [ - bbenoist.nix - vscode-icons-team.vscode-icons - waderyan.gitblame - ]; - }; - }; + imports = [ + ./programs.vscode.nix + ./programs.thunderbird.nix + ]; home.sessionVariables = { # Points to the Homebrew location mentioned in your caveat diff --git a/programs.thunderbird.nix b/programs.thunderbird.nix new file mode 100644 index 0000000..4df5548 --- /dev/null +++ b/programs.thunderbird.nix @@ -0,0 +1,80 @@ +{ pkgs, ... }: +let + tbPkg = if pkgs.stdenv.isDarwin then pkgs.thunderbird-bin else pkgs.thunderbird; + + mkGmailAccount = address: realName: { + inherit address realName; + flavor = "gmail.com"; + thunderbird.enable = true; + }; + + mkCalendar = collection: { + remote = { + type = "caldav"; + url = "https://cloud.thiccdata.io/remote.php/dav/calendars/mbessette/${collection}/"; + userName = "mbessette"; + }; + }; + + mkAddressBook = book: { + remote = { + type = "carddav"; + url = "https://cloud.thiccdata.io/remote.php/dav/addressbooks/users/mbessette/${book}/"; + userName = "mbessette"; + }; + thunderbird.enable = true; + }; +in +{ + programs.thunderbird = { + enable = true; + package = tbPkg; + + profiles.default = { + isDefault = true; + accountsOrder = [ "personal" ]; + }; + }; + + accounts.calendar.basePath = ".calendars"; + accounts.contact.basePath = ".contacts"; + + accounts.email.accounts = { + personal = mkGmailAccount "blade30912@gmail.com" "Matthew Bessette" // { + primary = true; + }; + bessette = mkGmailAccount "bessette.matthew94@gmail.com" "Matthew Bessette"; + house = mkGmailAccount "mbessette.house@gmail.com" "Matthew Bessette"; + joseph = mkGmailAccount "joseph.lamothe55@gmail.com" "Joseph Lamothe"; + }; + + accounts.calendar.accounts = { + family = mkCalendar "test" // { + thunderbird = { + enable = true; + color = "#FED3D9"; + }; + }; + matt = mkCalendar "matt-calendar" // { + primary = true; + thunderbird = { + enable = true; + color = "#FDF0D7"; + settings = id: { + "calendar.registry.${id}.imip.identity.key" = + "id_${builtins.hashString "sha256" "personal"}"; + }; + }; + }; + joseph-cal = mkCalendar "joseph-calendar" // { + thunderbird = { + enable = true; + color = "#CEF4F8"; + }; + }; + }; + + accounts.contact.accounts = { + contacts = mkAddressBook "contacts"; + }; +} diff --git a/programs.vscode.nix b/programs.vscode.nix new file mode 100644 index 0000000..f821005 --- /dev/null +++ b/programs.vscode.nix @@ -0,0 +1,34 @@ +{ config, pkgs, ... }: { + + xdg.configFile."oxlint/oxlintrc.json".source = + config.lib.file.mkOutOfStoreSymlink "/Users/matthew.bessette/nixos/config.oxlintrc.json"; + xdg.configFile."biome/biome.json".source = + config.lib.file.mkOutOfStoreSymlink "/Users/matthew.bessette/nixos/config.biome.json"; + + programs.vscode = { + enable = true; + package = pkgs.unstable.vscode; + mutableExtensionsDir = false; + profiles.default = { + userSettings = builtins.fromJSON (builtins.readFile ./config.vscode.settings.json); + extensions = + (with pkgs.vscode-marketplace-release; [ + bbenoist.nix + jnoortheen.nix-ide + graphql.vscode-graphql-syntax + graphql.vscode-graphql + ms-python.debugpy + ms-python.python + ms-python.vscode-pylance + oxc.oxc-vscode + vscode-icons-team.vscode-icons + typescriptteam.native-preview + lucasprag.dont-git-lost + ms-vscode-remote.remote-ssh + ]) + ++ (with pkgs.vscode-marketplace; [ + biomejs.biome + ]); + }; + }; +} diff --git a/treefmt.toml b/treefmt.toml new file mode 100644 index 0000000..dd22d9b --- /dev/null +++ b/treefmt.toml @@ -0,0 +1,8 @@ +[formatter.deadnix] +command = "deadnix" +options = ["--edit", "--quiet"] +includes = ["*.nix"] + +[formatter.nix] +command = "nixpkgs-fmt" +includes = ["*.nix"]