From 66d9b256826d9b2cd713fb2802b2344b65b7d522 Mon Sep 17 00:00:00 2001 From: Harivansh Rathi Date: Mon, 30 Mar 2026 00:28:59 -0400 Subject: [PATCH] ci + lint --- .github/workflows/quality.yml | 63 +++++++++++++++++ ci/agentcomputer-cli-stub/flake.nix | 30 ++++++++ home/bat.nix | 3 +- home/claude.nix | 9 +-- home/codex.nix | 3 +- home/colima.nix | 6 +- home/common.nix | 3 +- home/default.nix | 3 +- home/eza.nix | 3 +- home/fzf.nix | 8 ++- home/gcloud.nix | 5 +- home/gh.nix | 3 +- home/ghostty.nix | 13 ++-- home/git.nix | 3 +- home/k9s.nix | 3 +- home/karabiner.nix | 5 +- home/lazygit.nix | 6 +- home/migration.nix | 7 +- home/mise.nix | 3 +- home/netty.nix | 3 +- home/nvim.nix | 15 ++-- home/rectangle.nix | 5 +- home/scripts.nix | 10 +-- home/skills.nix | 26 ++++--- home/ssh.nix | 3 +- home/tmux.nix | 8 ++- home/zsh.nix | 80 +++++++++++----------- hosts/darwin/default.nix | 3 +- hosts/netty/configuration.nix | 16 +++-- hosts/netty/default.nix | 8 ++- hosts/netty/hardware-configuration.nix | 9 +-- lib/package-sets.nix | 23 ++++--- lib/theme.nix | 94 +++++++++++++++----------- modules/base.nix | 47 ++++++------- modules/homebrew.nix | 3 +- modules/macos.nix | 3 +- modules/nixpkgs.nix | 16 ++--- modules/packages.nix | 8 ++- scripts/default.nix | 61 +++++++++++------ 39 files changed, 395 insertions(+), 225 deletions(-) create mode 100644 .github/workflows/quality.yml create mode 100644 ci/agentcomputer-cli-stub/flake.nix diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml new file mode 100644 index 0000000..1e525e7 --- /dev/null +++ b/.github/workflows/quality.yml @@ -0,0 +1,63 @@ +name: quality + +on: + pull_request: + branches: [main] + push: + branches: [main] + +permissions: + contents: read + +jobs: + changes: + runs-on: ubuntu-latest + outputs: + quality: ${{ steps.filter.outputs.quality }} + steps: + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + quality: + - "**/*.nix" + - "flake.lock" + - "flake.nix" + - "ci/**" + - "config/**" + - "scripts/**" + - ".github/workflows/**" + + flake-check: + name: Flake Check + runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.quality == 'true' }} + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@main + - name: Prepare local flake input shims + run: | + set -euo pipefail + # The repo currently depends on a local path flake input for agentcomputer-cli. + sudo mkdir -p /Users/rathi/Documents/GitHub/companion/agentcomputer/apps + sudo ln -sfn "$GITHUB_WORKSPACE/ci/agentcomputer-cli-stub" /Users/rathi/Documents/GitHub/companion/agentcomputer/apps/cli + - run: nix flake check + + nix-format: + name: Nix Format Check + runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.quality == 'true' }} + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@main + - name: Prepare local flake input shims + run: | + set -euo pipefail + sudo mkdir -p /Users/rathi/Documents/GitHub/companion/agentcomputer/apps + sudo ln -sfn "$GITHUB_WORKSPACE/ci/agentcomputer-cli-stub" /Users/rathi/Documents/GitHub/companion/agentcomputer/apps/cli + - run: nix fmt -- --ci diff --git a/ci/agentcomputer-cli-stub/flake.nix b/ci/agentcomputer-cli-stub/flake.nix new file mode 100644 index 0000000..aafbc22 --- /dev/null +++ b/ci/agentcomputer-cli-stub/flake.nix @@ -0,0 +1,30 @@ +{ + description = "CI stub for the local agentcomputer-cli flake input"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + + outputs = + { nixpkgs, ... }: + let + systems = [ + "aarch64-darwin" + "x86_64-darwin" + "aarch64-linux" + "x86_64-linux" + ]; + forAllSystems = nixpkgs.lib.genAttrs systems; + in + { + packages = forAllSystems ( + system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + default = pkgs.writeShellScriptBin "aicomputer" '' + echo "agentcomputer-cli CI stub" + ''; + } + ); + }; +} diff --git a/home/bat.nix b/home/bat.nix index 73dac2b..967652f 100644 --- a/home/bat.nix +++ b/home/bat.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ programs.bat = { enable = true; diff --git a/home/claude.nix b/home/claude.nix index e515e46..3a1b188 100644 --- a/home/claude.nix +++ b/home/claude.nix @@ -2,10 +2,11 @@ inputs, pkgs, ... -}: let - claudePackage = - inputs.claudeCode.packages.${pkgs.stdenv.hostPlatform.system}.default; -in { +}: +let + claudePackage = inputs.claudeCode.packages.${pkgs.stdenv.hostPlatform.system}.default; +in +{ # Keep the managed Claude binary on the same path the live machine was using # so the Nix package cleanly replaces the prior manual install. home.file.".local/bin/claude".source = "${claudePackage}/bin/claude"; diff --git a/home/codex.nix b/home/codex.nix index c7a7568..a261634 100644 --- a/home/codex.nix +++ b/home/codex.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ home.file.".codex/AGENTS.md".source = ../config/codex/AGENTS.md; home.file.".codex/config.toml".source = ../config/codex/config.toml; } diff --git a/home/colima.nix b/home/colima.nix index eebc661..afaeb04 100644 --- a/home/colima.nix +++ b/home/colima.nix @@ -2,9 +2,11 @@ config, pkgs, ... -}: let +}: +let defaultProfile = "default"; -in { +in +{ home.packages = with pkgs; [ docker-buildx docker-client diff --git a/home/common.nix b/home/common.nix index ed15f04..35fa271 100644 --- a/home/common.nix +++ b/home/common.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ imports = [ ./bat.nix ./eza.nix diff --git a/home/default.nix b/home/default.nix index fee11b6..22c67d0 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ imports = [ ./common.nix ./colima.nix diff --git a/home/eza.nix b/home/eza.nix index f3ef34f..815335c 100644 --- a/home/eza.nix +++ b/home/eza.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ programs.eza = { enable = true; enableZshIntegration = true; diff --git a/home/fzf.nix b/home/fzf.nix index c0f5ee4..be0c859 100644 --- a/home/fzf.nix +++ b/home/fzf.nix @@ -1,6 +1,8 @@ -{config, ...}: let - theme = import ../lib/theme.nix {inherit config;}; -in { +{ config, ... }: +let + theme = import ../lib/theme.nix { inherit config; }; +in +{ home.sessionVariables = { FZF_DEFAULT_OPTS_FILE = theme.paths.fzfCurrentFile; }; diff --git a/home/gcloud.nix b/home/gcloud.nix index d080447..c30d2d5 100644 --- a/home/gcloud.nix +++ b/home/gcloud.nix @@ -1,7 +1,8 @@ -{lib, ...}: { +{ lib, ... }: +{ xdg.configFile."gcloud/active_config".text = "default\n"; - xdg.configFile."gcloud/configurations/config_default".text = lib.generators.toINI {} { + xdg.configFile."gcloud/configurations/config_default".text = lib.generators.toINI { } { core = { account = "rathiharivansh@gmail.com"; project = "hari-gc"; diff --git a/home/gh.nix b/home/gh.nix index 2f61f54..6f770e9 100644 --- a/home/gh.nix +++ b/home/gh.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ programs.gh = { enable = true; gitCredentialHelper.enable = true; diff --git a/home/ghostty.nix b/home/ghostty.nix index 6616258..c660cf9 100644 --- a/home/ghostty.nix +++ b/home/ghostty.nix @@ -3,8 +3,9 @@ lib, pkgs, ... -}: let - theme = import ../lib/theme.nix {inherit config;}; +}: +let + theme = import ../lib/theme.nix { inherit config; }; ghosttyConfig = '' theme = "cozybox-current" font-family = Berkeley Mono @@ -52,13 +53,11 @@ focus-follows-mouse = true link-url = true ''; -in { +in +{ programs.ghostty = { enable = true; - package = - if pkgs.stdenv.isDarwin - then pkgs.ghostty-bin - else pkgs.ghostty; + package = if pkgs.stdenv.isDarwin then pkgs.ghostty-bin else pkgs.ghostty; installBatSyntax = true; }; diff --git a/home/git.nix b/home/git.nix index 7eda60b..7e2bb02 100644 --- a/home/git.nix +++ b/home/git.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ programs.git = { enable = true; lfs.enable = true; diff --git a/home/k9s.nix b/home/k9s.nix index 1821b67..16f3904 100644 --- a/home/k9s.nix +++ b/home/k9s.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ programs.k9s = { enable = true; diff --git a/home/karabiner.nix b/home/karabiner.nix index 118f4ed..06eee91 100644 --- a/home/karabiner.nix +++ b/home/karabiner.nix @@ -2,11 +2,12 @@ config, lib, ... -}: { +}: +{ # Karabiner-Elements destroys file-level symlinks (unlink + rewrite), but # directory-level symlinks survive. Point ~/.config/karabiner at the repo # directory so changes are tracked in git and Karabiner can write freely. - home.activation.karabinerConfig = lib.hm.dag.entryAfter ["writeBoundary"] '' + home.activation.karabinerConfig = lib.hm.dag.entryAfter [ "writeBoundary" ] '' karabiner_link="${config.home.homeDirectory}/.config/karabiner" karabiner_src="/Users/rathi/Documents/GitHub/nix/config/karabiner" diff --git a/home/lazygit.nix b/home/lazygit.nix index fa65e09..3297091 100644 --- a/home/lazygit.nix +++ b/home/lazygit.nix @@ -2,11 +2,11 @@ lib, pkgs, ... -}: { +}: +{ xdg.configFile."lazygit/config.yml".source = ../config/lazygit/config.yml; home.file = lib.mkIf pkgs.stdenv.isDarwin { - "Library/Application Support/lazygit/config.yml".source = - ../config/lazygit/config.yml; + "Library/Application Support/lazygit/config.yml".source = ../config/lazygit/config.yml; }; } diff --git a/home/migration.nix b/home/migration.nix index bcd42ba..9b6a219 100644 --- a/home/migration.nix +++ b/home/migration.nix @@ -1,8 +1,9 @@ -{lib, ...}: { +{ lib, ... }: +{ # Transitional cleanup for files previously owned by ~/dots. Keeping this # separate from steady-state modules makes it obvious what can be deleted # once every managed path has been fully handed over to Home Manager. - home.activation.removeLegacyZshLinks = lib.hm.dag.entryBefore ["checkLinkTargets"] '' + home.activation.removeLegacyZshLinks = lib.hm.dag.entryBefore [ "checkLinkTargets" ] '' for path in "$HOME/.zshenv" "$HOME/.zshrc"; do if [ -L "$path" ]; then target="$(readlink "$path")" @@ -15,7 +16,7 @@ done ''; - home.activation.removeLegacyTmuxLink = lib.hm.dag.entryBefore ["checkLinkTargets"] '' + home.activation.removeLegacyTmuxLink = lib.hm.dag.entryBefore [ "checkLinkTargets" ] '' path="$HOME/.config/tmux/tmux.conf" if [ -L "$path" ]; then target="$(readlink "$path")" diff --git a/home/mise.nix b/home/mise.nix index ff7b5b4..f68cbce 100644 --- a/home/mise.nix +++ b/home/mise.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ programs.mise = { enable = true; globalConfig = { diff --git a/home/netty.nix b/home/netty.nix index af72e74..6da8357 100644 --- a/home/netty.nix +++ b/home/netty.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ imports = [ ./common.nix ]; diff --git a/home/nvim.nix b/home/nvim.nix index e7bc2bc..14e08d5 100644 --- a/home/nvim.nix +++ b/home/nvim.nix @@ -3,22 +3,23 @@ lib, pkgs, ... -}: let +}: +let nvimConfig = lib.cleanSourceWith { src = ../config/nvim; - filter = path: type: - builtins.baseNameOf path != ".git" - && builtins.baseNameOf path != "lazy-lock.json"; + filter = + path: type: builtins.baseNameOf path != ".git" && builtins.baseNameOf path != "lazy-lock.json"; }; lazyLockSeed = ../config/nvim/lazy-lock.json; lazyLockPath = "${config.xdg.stateHome}/nvim/lazy-lock.json"; python = pkgs.writeShellScriptBin "python" '' exec ${pkgs.python3}/bin/python3 "$@" ''; -in { +in +{ # Keep rust-analyzer in the user profile so it shadows rustup's proxy in # /run/current-system/sw/bin when Neovim resolves LSP executables. - home.packages = [pkgs.rust-analyzer]; + home.packages = [ pkgs.rust-analyzer ]; programs.neovim = { enable = true; @@ -59,7 +60,7 @@ in { recursive = true; }; - home.activation.seedNvimLazyLock = lib.hm.dag.entryAfter ["writeBoundary"] '' + home.activation.seedNvimLazyLock = lib.hm.dag.entryAfter [ "writeBoundary" ] '' state_dir="${config.xdg.stateHome}/nvim" lockfile="${lazyLockPath}" diff --git a/home/rectangle.nix b/home/rectangle.nix index 7684b20..cf7c154 100644 --- a/home/rectangle.nix +++ b/home/rectangle.nix @@ -1,5 +1,6 @@ -{lib, ...}: { - home.activation.importRectanglePreferences = lib.hm.dag.entryAfter ["writeBoundary"] '' +{ lib, ... }: +{ + home.activation.importRectanglePreferences = lib.hm.dag.entryAfter [ "writeBoundary" ] '' /usr/bin/defaults import com.knollsoft.Rectangle ${../config/rectangle/Rectangle.plist} ''; } diff --git a/home/scripts.nix b/home/scripts.nix index bccc35b..d0b8170 100644 --- a/home/scripts.nix +++ b/home/scripts.nix @@ -3,12 +3,14 @@ lib, pkgs, ... -}: let - customScripts = import ../scripts {inherit config lib pkgs;}; -in { +}: +let + customScripts = import ../scripts { inherit config lib pkgs; }; +in +{ home.packages = builtins.attrValues customScripts.packages; - home.activation.initializeThemeState = lib.hm.dag.entryAfter ["writeBoundary"] '' + home.activation.initializeThemeState = lib.hm.dag.entryAfter [ "writeBoundary" ] '' mkdir -p "${customScripts.theme.paths.stateDir}" "${customScripts.theme.paths.fzfDir}" "${customScripts.theme.paths.ghosttyDir}" "${customScripts.theme.paths.tmuxDir}" if [[ -f "${customScripts.theme.paths.stateFile}" ]]; then diff --git a/home/skills.nix b/home/skills.nix index 20d35cb..0f4ab89 100644 --- a/home/skills.nix +++ b/home/skills.nix @@ -3,7 +3,8 @@ lib, pkgs, ... -}: let +}: +let globalSkills = [ { name = "rams"; @@ -42,8 +43,9 @@ needs_sync=1 fi '') globalSkills; -in { - home.activation.ensureGlobalSkills = lib.hm.dag.entryAfter ["writeBoundary"] '' +in +{ + home.activation.ensureGlobalSkills = lib.hm.dag.entryAfter [ "writeBoundary" ] '' state_dir="${config.xdg.stateHome}/skills" stamp_file="$state_dir/global-skills-manifest.sha256" desired_hash=${lib.escapeShellArg manifestHash} @@ -58,14 +60,16 @@ in { ${missingChecks} if [ "$needs_sync" -eq 1 ]; then - export PATH="${lib.makeBinPath [ - pkgs.nodejs_22 - pkgs.git - pkgs.coreutils - pkgs.findutils - pkgs.gnugrep - pkgs.gnused - ]}:$PATH" + export PATH="${ + lib.makeBinPath [ + pkgs.nodejs_22 + pkgs.git + pkgs.coreutils + pkgs.findutils + pkgs.gnugrep + pkgs.gnused + ] + }:$PATH" ${installCommands} diff --git a/home/ssh.nix b/home/ssh.nix index d227be3..d384ab1 100644 --- a/home/ssh.nix +++ b/home/ssh.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ programs.ssh = { enable = true; enableDefaultConfig = false; diff --git a/home/tmux.nix b/home/tmux.nix index f9d7e31..2c100c7 100644 --- a/home/tmux.nix +++ b/home/tmux.nix @@ -3,9 +3,11 @@ lib, pkgs, ... -}: let - theme = import ../lib/theme.nix {inherit config;}; -in { +}: +let + theme = import ../lib/theme.nix { inherit config; }; +in +{ programs.tmux = { enable = true; plugins = with pkgs.tmuxPlugins; [ diff --git a/home/zsh.nix b/home/zsh.nix index 086e194..3279601 100644 --- a/home/zsh.nix +++ b/home/zsh.nix @@ -3,15 +3,15 @@ lib, pkgs, ... -}: { - home.file.".oh-my-zsh/custom/themes/agnoster.zsh-theme".source = - ../config/agnoster.zsh-theme; +}: +{ + home.file.".oh-my-zsh/custom/themes/agnoster.zsh-theme".source = ../config/agnoster.zsh-theme; - home.activation.ensureOhMyZshCache = lib.hm.dag.entryAfter ["writeBoundary"] '' + home.activation.ensureOhMyZshCache = lib.hm.dag.entryAfter [ "writeBoundary" ] '' mkdir -p "${config.xdg.cacheHome}/oh-my-zsh" ''; - home.packages = [pkgs.oh-my-zsh]; + home.packages = [ pkgs.oh-my-zsh ]; programs.zsh = { enable = true; @@ -22,42 +22,40 @@ autosuggestion.enable = true; syntaxHighlighting.enable = true; - shellAliases = - { - co = "codex --dangerously-bypass-approvals-and-sandbox"; - ca = "cursor-agent"; - cc = "claude"; - ch = "claude-handoff"; - cl = "clear"; - gc = "git commit"; - gd = "git diff"; - gk = "git checkout"; - gp = "git push"; - gpo = "git pull origin"; - gs = "git status"; - ld = "lumen diff"; - lg = "lazygit"; - nim = "nvim ."; + shellAliases = { + co = "codex --dangerously-bypass-approvals-and-sandbox"; + ca = "cursor-agent"; + cc = "claude"; + ch = "claude-handoff"; + cl = "clear"; + gc = "git commit"; + gd = "git diff"; + gk = "git checkout"; + gp = "git push"; + gpo = "git pull origin"; + gs = "git status"; + ld = "lumen diff"; + lg = "lazygit"; + nim = "nvim ."; } // lib.optionalAttrs pkgs.stdenv.isDarwin { tailscale = "/Applications/Tailscale.app/Contents/MacOS/Tailscale"; }; - envExtra = - '' - if [[ -f "$HOME/.cargo/env" ]]; then - . "$HOME/.cargo/env" - fi - export NODE_NO_WARNINGS=1 - '' - + lib.optionalString pkgs.stdenv.isDarwin '' - # Ghostty shell integration expects a resource directory; the Nix app - # bundle lives in the store instead of /Applications. - export GHOSTTY_RESOURCES_DIR="${pkgs.ghostty-bin}/Applications/Ghostty.app/Contents/Resources/ghostty" - '' - + '' - export MANPAGER="nvim +Man!" - ''; + envExtra = '' + if [[ -f "$HOME/.cargo/env" ]]; then + . "$HOME/.cargo/env" + fi + export NODE_NO_WARNINGS=1 + '' + + lib.optionalString pkgs.stdenv.isDarwin '' + # Ghostty shell integration expects a resource directory; the Nix app + # bundle lives in the store instead of /Applications. + export GHOSTTY_RESOURCES_DIR="${pkgs.ghostty-bin}/Applications/Ghostty.app/Contents/Resources/ghostty" + '' + + '' + export MANPAGER="nvim +Man!" + ''; initContent = lib.mkMerge [ (lib.mkOrder 550 '' @@ -88,9 +86,7 @@ export BUN_INSTALL="$HOME/.bun" export PNPM_HOME="${ - if pkgs.stdenv.isDarwin - then "$HOME/Library/pnpm" - else "${config.xdg.dataHome}/pnpm" + if pkgs.stdenv.isDarwin then "$HOME/Library/pnpm" else "${config.xdg.dataHome}/pnpm" }" bindkey -v typeset -U path PATH @@ -107,9 +103,9 @@ "/run/current-system/sw/bin" "/nix/var/nix/profiles/default/bin" ${lib.optionalString pkgs.stdenv.isDarwin '' - "/opt/homebrew/bin" - "/opt/homebrew/sbin" - ''} + "/opt/homebrew/bin" + "/opt/homebrew/sbin" + ''} $path ) diff --git a/hosts/darwin/default.nix b/hosts/darwin/default.nix index 33bd501..05d30ad 100644 --- a/hosts/darwin/default.nix +++ b/hosts/darwin/default.nix @@ -4,7 +4,8 @@ username, hostname, ... -}: { +}: +{ imports = [ ../../modules/base.nix ../../modules/macos.nix diff --git a/hosts/netty/configuration.nix b/hosts/netty/configuration.nix index 9fcbe92..e983743 100644 --- a/hosts/netty/configuration.nix +++ b/hosts/netty/configuration.nix @@ -5,9 +5,11 @@ username, self, ... -}: let - packageSets = import ../../lib/package-sets.nix {inherit inputs lib pkgs;}; -in { +}: +let + packageSets = import ../../lib/package-sets.nix { inherit inputs lib pkgs; }; +in +{ imports = [ ./hardware-configuration.nix ./disk-config.nix @@ -25,7 +27,11 @@ in { networking = { hostName = "netty"; useDHCP = true; - firewall.allowedTCPPorts = [22 80 443]; + firewall.allowedTCPPorts = [ + 22 + 80 + 443 + ]; }; services.qemuGuest.enable = true; @@ -44,7 +50,7 @@ in { users.users.${username} = { isNormalUser = true; - extraGroups = ["wheel"]; + extraGroups = [ "wheel" ]; shell = pkgs.zsh; openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM6tzq33IQcurWoQ7vhXOTLjv8YkdTGb7NoNsul3Sbfu rathi@mac" diff --git a/hosts/netty/default.nix b/hosts/netty/default.nix index 138dceb..d903921 100644 --- a/hosts/netty/default.nix +++ b/hosts/netty/default.nix @@ -4,9 +4,11 @@ pkgs, username, ... -}: let - packageSets = import ../../lib/package-sets.nix {inherit inputs lib pkgs;}; -in { +}: +let + packageSets = import ../../lib/package-sets.nix { inherit inputs lib pkgs; }; +in +{ imports = [ ../../home/netty.nix ]; diff --git a/hosts/netty/hardware-configuration.nix b/hosts/netty/hardware-configuration.nix index c4f3529..47bbb8c 100644 --- a/hosts/netty/hardware-configuration.nix +++ b/hosts/netty/hardware-configuration.nix @@ -4,7 +4,8 @@ lib, modulesPath, ... -}: { +}: +{ imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; @@ -15,9 +16,9 @@ "ahci" "sd_mod" ]; - boot.initrd.kernelModules = []; - boot.kernelModules = []; - boot.extraModulePackages = []; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; virtualisation.hypervGuest.enable = false; diff --git a/lib/package-sets.nix b/lib/package-sets.nix index 1041c2f..99be11a 100644 --- a/lib/package-sets.nix +++ b/lib/package-sets.nix @@ -2,15 +2,12 @@ inputs, lib, pkgs, -}: let - gwsPackage = - inputs.googleworkspace-cli.packages.${pkgs.stdenv.hostPlatform.system}.default; - claudePackage = - inputs.claudeCode.packages.${pkgs.stdenv.hostPlatform.system}.default; - agentcomputerPackage = - inputs.agentcomputer-cli.packages.${pkgs.stdenv.hostPlatform.system}.default; - openspecPackage = - inputs.openspec.packages.${pkgs.stdenv.hostPlatform.system}.default; +}: +let + gwsPackage = inputs.googleworkspace-cli.packages.${pkgs.stdenv.hostPlatform.system}.default; + claudePackage = inputs.claudeCode.packages.${pkgs.stdenv.hostPlatform.system}.default; + agentcomputerPackage = inputs.agentcomputer-cli.packages.${pkgs.stdenv.hostPlatform.system}.default; + openspecPackage = inputs.openspec.packages.${pkgs.stdenv.hostPlatform.system}.default; memex = pkgs.stdenvNoCC.mkDerivation rec { pname = "memex"; @@ -76,12 +73,16 @@ meta = { description = "CLI for Git worktree management"; homepage = "https://worktrunk.dev"; - license = with lib.licenses; [asl20 mit]; + license = with lib.licenses; [ + asl20 + mit + ]; mainProgram = "wt"; platforms = lib.platforms.darwin; }; }; -in { +in +{ core = with pkgs; [ bitwarden-cli curl diff --git a/lib/theme.nix b/lib/theme.nix index 8459991..b4c2c8d 100644 --- a/lib/theme.nix +++ b/lib/theme.nix @@ -1,4 +1,5 @@ -{config, ...}: let +{ config, ... }: +let defaultMode = "dark"; sharedPalette = { red = "#ea6962"; @@ -93,43 +94,60 @@ }; }; - renderGhostty = mode: let - theme = themes.${mode}; - paletteLines = - builtins.concatStringsSep "\n" - (builtins.genList - (index: "palette = ${toString index}=${builtins.elemAt theme.palette index}") - (builtins.length theme.palette)); - in '' - background = ${theme.background} - foreground = ${theme.foreground} - cursor-color = ${theme.cursorColor} - cursor-text = ${theme.cursorText} - selection-background = ${theme.selectionBackground} - selection-foreground = ${theme.selectionForeground} - ${paletteLines} - ''; + renderGhostty = + mode: + let + theme = themes.${mode}; + paletteLines = builtins.concatStringsSep "\n" ( + builtins.genList (index: "palette = ${toString index}=${builtins.elemAt theme.palette index}") ( + builtins.length theme.palette + ) + ); + in + '' + background = ${theme.background} + foreground = ${theme.foreground} + cursor-color = ${theme.cursorColor} + cursor-text = ${theme.cursorText} + selection-background = ${theme.selectionBackground} + selection-foreground = ${theme.selectionForeground} + ${paletteLines} + ''; - renderTmux = mode: let - theme = themes.${mode}; - in '' - set-option -g @cozybox-mode '${mode}' - set-option -g @cozybox-accent '${theme.purple}' - set-option -g status-style bg=${theme.background},fg=${theme.text} - set-option -g window-status-format " #I#[fg=${theme.purple}]:#[fg=default]#W " - set-option -g window-status-current-format " #[fg=${theme.purple}]*#[fg=default]#I#[fg=${theme.purple}]:#[fg=default]#W " - set-option -g window-status-separator "" - set-option -g pane-border-style fg=${theme.border} - set-option -g pane-active-border-style fg=${theme.border} - ''; + renderTmux = + mode: + let + theme = themes.${mode}; + in + '' + set-option -g @cozybox-mode '${mode}' + set-option -g @cozybox-accent '${theme.purple}' + set-option -g status-style bg=${theme.background},fg=${theme.text} + set-option -g window-status-format " #I#[fg=${theme.purple}]:#[fg=default]#W " + set-option -g window-status-current-format " #[fg=${theme.purple}]*#[fg=default]#I#[fg=${theme.purple}]:#[fg=default]#W " + set-option -g window-status-separator "" + set-option -g pane-border-style fg=${theme.border} + set-option -g pane-active-border-style fg=${theme.border} + ''; - renderFzf = mode: let - theme = themes.${mode}; - in '' - --color=fg:${theme.text},bg:${theme.background},hl:${theme.blue} - --color=fg+:${theme.text},bg+:${theme.surface},hl+:${theme.blue} - --color=info:${theme.green},prompt:${theme.blue},pointer:${theme.text},marker:${theme.green},spinner:${theme.text} - ''; -in { - inherit defaultMode paths renderFzf renderGhostty renderTmux themes; + renderFzf = + mode: + let + theme = themes.${mode}; + in + '' + --color=fg:${theme.text},bg:${theme.background},hl:${theme.blue} + --color=fg+:${theme.text},bg+:${theme.surface},hl+:${theme.blue} + --color=info:${theme.green},prompt:${theme.blue},pointer:${theme.text},marker:${theme.green},spinner:${theme.text} + ''; +in +{ + inherit + defaultMode + paths + renderFzf + renderGhostty + renderTmux + themes + ; } diff --git a/modules/base.nix b/modules/base.nix index 8e1ed86..0eab198 100644 --- a/modules/base.nix +++ b/modules/base.nix @@ -4,9 +4,11 @@ pkgs, username, ... -}: let - packageSets = import ../lib/package-sets.nix {inherit inputs lib pkgs;}; -in { +}: +let + packageSets = import ../lib/package-sets.nix { inherit inputs lib pkgs; }; +in +{ nix.enable = true; nix.settings = { @@ -22,30 +24,29 @@ in { use-xdg-base-directories = true; }; - nix.gc = - { - automatic = true; - options = "--delete-older-than 14d"; - } - // ( - if pkgs.stdenv.isDarwin then - { - interval = { - Weekday = 7; - Hour = 3; - Minute = 0; - }; - } - else - { - dates = "weekly"; - } - ); + nix.gc = { + automatic = true; + options = "--delete-older-than 14d"; + } + // ( + if pkgs.stdenv.isDarwin then + { + interval = { + Weekday = 7; + Hour = 3; + Minute = 0; + }; + } + else + { + dates = "weekly"; + } + ); nixpkgs.config.allowUnfree = true; programs.zsh.enable = true; - environment.shells = [pkgs.zsh]; + environment.shells = [ pkgs.zsh ]; environment.systemPackages = packageSets.core; diff --git a/modules/homebrew.nix b/modules/homebrew.nix index d1e1a89..7bb5c95 100644 --- a/modules/homebrew.nix +++ b/modules/homebrew.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ homebrew = { enable = true; diff --git a/modules/macos.nix b/modules/macos.nix index db0abf1..cec7122 100644 --- a/modules/macos.nix +++ b/modules/macos.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ security.pam.services.sudo_local.touchIdAuth = true; # Karabiner-Elements is managed via Homebrew cask because nix-darwin's diff --git a/modules/nixpkgs.nix b/modules/nixpkgs.nix index cbc9007..32212fa 100644 --- a/modules/nixpkgs.nix +++ b/modules/nixpkgs.nix @@ -20,15 +20,13 @@ let hostname = host.hostname; }; - mkHomeManagerModule = - host: - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = mkSpecialArgs host; - home-manager.backupCommand = "bash ${../scripts/home-manager-backup.sh}"; - home-manager.users.${username} = import host.homeModule; - }; + mkHomeManagerModule = host: { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = mkSpecialArgs host; + home-manager.backupCommand = "bash ${../scripts/home-manager-backup.sh}"; + home-manager.users.${username} = import host.homeModule; + }; in { systems = lib.unique (map (host: host.system) (builtins.attrValues hosts)); diff --git a/modules/packages.nix b/modules/packages.nix index 74a6cea..3870833 100644 --- a/modules/packages.nix +++ b/modules/packages.nix @@ -3,9 +3,11 @@ lib, pkgs, ... -}: let - packageSets = import ../lib/package-sets.nix {inherit inputs lib pkgs;}; -in { +}: +let + packageSets = import ../lib/package-sets.nix { inherit inputs lib pkgs; }; +in +{ environment.systemPackages = packageSets.extras; fonts.packages = packageSets.fonts; } diff --git a/scripts/default.nix b/scripts/default.nix index 7735e03..f32a0f6 100644 --- a/scripts/default.nix +++ b/scripts/default.nix @@ -2,52 +2,67 @@ config, lib, pkgs, -}: let - theme = import ../lib/theme.nix {inherit config;}; +}: +let + theme = import ../lib/theme.nix { inherit config; }; tmuxConfigs = { dark = pkgs.writeText "tmux-theme-dark.conf" (theme.renderTmux "dark"); light = pkgs.writeText "tmux-theme-light.conf" (theme.renderTmux "light"); }; - mkScript = { - file, - name, - runtimeInputs ? [], - replacements ? {}, - }: + mkScript = + { + file, + name, + runtimeInputs ? [ ], + replacements ? { }, + }: pkgs.writeShellApplication { inherit name runtimeInputs; - text = - lib.replaceStrings - (builtins.attrNames replacements) - (builtins.attrValues replacements) - (builtins.readFile file); + text = lib.replaceStrings (builtins.attrNames replacements) (builtins.attrValues replacements) ( + builtins.readFile file + ); }; packages = { ga = mkScript { name = "ga"; file = ./ga.sh; - runtimeInputs = with pkgs; [git]; + runtimeInputs = with pkgs; [ git ]; }; ghpr = mkScript { name = "ghpr"; file = ./ghpr.sh; - runtimeInputs = with pkgs; [gh git gnugrep gnused coreutils]; + runtimeInputs = with pkgs; [ + gh + git + gnugrep + gnused + coreutils + ]; }; gpr = mkScript { name = "gpr"; file = ./gpr.sh; - runtimeInputs = with pkgs; [gh fzf gnugrep coreutils]; + runtimeInputs = with pkgs; [ + gh + fzf + gnugrep + coreutils + ]; }; iosrun = mkScript { name = "iosrun"; file = ./iosrun.sh; - runtimeInputs = with pkgs; [findutils gnugrep coreutils]; + runtimeInputs = with pkgs; [ + findutils + gnugrep + coreutils + ]; }; mdview = mkScript { @@ -58,13 +73,18 @@ ni = mkScript { name = "ni"; file = ./ni.sh; - runtimeInputs = with pkgs; [nix]; + runtimeInputs = with pkgs; [ nix ]; }; theme = mkScript { name = "theme"; file = ./theme.sh; - runtimeInputs = with pkgs; [coreutils findutils neovim tmux]; + runtimeInputs = with pkgs; [ + coreutils + findutils + neovim + tmux + ]; replacements = { "@DEFAULT_MODE@" = theme.defaultMode; "@STATE_DIR@" = theme.paths.stateDir; @@ -90,6 +110,7 @@ file = ./wtc.sh; }; }; -in { +in +{ inherit packages theme tmuxConfigs; }