ci + lint

This commit is contained in:
Harivansh Rathi 2026-03-30 00:28:59 -04:00
parent d088a98954
commit 66d9b25682
39 changed files with 395 additions and 225 deletions

63
.github/workflows/quality.yml vendored Normal file
View file

@ -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

View file

@ -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"
'';
}
);
};
}

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
programs.bat = { programs.bat = {
enable = true; enable = true;

View file

@ -2,10 +2,11 @@
inputs, inputs,
pkgs, pkgs,
... ...
}: let }:
claudePackage = let
inputs.claudeCode.packages.${pkgs.stdenv.hostPlatform.system}.default; claudePackage = inputs.claudeCode.packages.${pkgs.stdenv.hostPlatform.system}.default;
in { in
{
# Keep the managed Claude binary on the same path the live machine was using # Keep the managed Claude binary on the same path the live machine was using
# so the Nix package cleanly replaces the prior manual install. # so the Nix package cleanly replaces the prior manual install.
home.file.".local/bin/claude".source = "${claudePackage}/bin/claude"; home.file.".local/bin/claude".source = "${claudePackage}/bin/claude";

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
home.file.".codex/AGENTS.md".source = ../config/codex/AGENTS.md; home.file.".codex/AGENTS.md".source = ../config/codex/AGENTS.md;
home.file.".codex/config.toml".source = ../config/codex/config.toml; home.file.".codex/config.toml".source = ../config/codex/config.toml;
} }

View file

@ -2,9 +2,11 @@
config, config,
pkgs, pkgs,
... ...
}: let }:
let
defaultProfile = "default"; defaultProfile = "default";
in { in
{
home.packages = with pkgs; [ home.packages = with pkgs; [
docker-buildx docker-buildx
docker-client docker-client

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
imports = [ imports = [
./bat.nix ./bat.nix
./eza.nix ./eza.nix

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
imports = [ imports = [
./common.nix ./common.nix
./colima.nix ./colima.nix

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
programs.eza = { programs.eza = {
enable = true; enable = true;
enableZshIntegration = true; enableZshIntegration = true;

View file

@ -1,6 +1,8 @@
{config, ...}: let { config, ... }:
theme = import ../lib/theme.nix {inherit config;}; let
in { theme = import ../lib/theme.nix { inherit config; };
in
{
home.sessionVariables = { home.sessionVariables = {
FZF_DEFAULT_OPTS_FILE = theme.paths.fzfCurrentFile; FZF_DEFAULT_OPTS_FILE = theme.paths.fzfCurrentFile;
}; };

View file

@ -1,7 +1,8 @@
{lib, ...}: { { lib, ... }:
{
xdg.configFile."gcloud/active_config".text = "default\n"; 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 = { core = {
account = "rathiharivansh@gmail.com"; account = "rathiharivansh@gmail.com";
project = "hari-gc"; project = "hari-gc";

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
programs.gh = { programs.gh = {
enable = true; enable = true;
gitCredentialHelper.enable = true; gitCredentialHelper.enable = true;

View file

@ -3,8 +3,9 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
theme = import ../lib/theme.nix {inherit config;}; let
theme = import ../lib/theme.nix { inherit config; };
ghosttyConfig = '' ghosttyConfig = ''
theme = "cozybox-current" theme = "cozybox-current"
font-family = Berkeley Mono font-family = Berkeley Mono
@ -52,13 +53,11 @@
focus-follows-mouse = true focus-follows-mouse = true
link-url = true link-url = true
''; '';
in { in
{
programs.ghostty = { programs.ghostty = {
enable = true; enable = true;
package = package = if pkgs.stdenv.isDarwin then pkgs.ghostty-bin else pkgs.ghostty;
if pkgs.stdenv.isDarwin
then pkgs.ghostty-bin
else pkgs.ghostty;
installBatSyntax = true; installBatSyntax = true;
}; };

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
programs.git = { programs.git = {
enable = true; enable = true;
lfs.enable = true; lfs.enable = true;

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
programs.k9s = { programs.k9s = {
enable = true; enable = true;

View file

@ -2,11 +2,12 @@
config, config,
lib, lib,
... ...
}: { }:
{
# Karabiner-Elements destroys file-level symlinks (unlink + rewrite), but # Karabiner-Elements destroys file-level symlinks (unlink + rewrite), but
# directory-level symlinks survive. Point ~/.config/karabiner at the repo # directory-level symlinks survive. Point ~/.config/karabiner at the repo
# directory so changes are tracked in git and Karabiner can write freely. # 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_link="${config.home.homeDirectory}/.config/karabiner"
karabiner_src="/Users/rathi/Documents/GitHub/nix/config/karabiner" karabiner_src="/Users/rathi/Documents/GitHub/nix/config/karabiner"

View file

@ -2,11 +2,11 @@
lib, lib,
pkgs, pkgs,
... ...
}: { }:
{
xdg.configFile."lazygit/config.yml".source = ../config/lazygit/config.yml; xdg.configFile."lazygit/config.yml".source = ../config/lazygit/config.yml;
home.file = lib.mkIf pkgs.stdenv.isDarwin { home.file = lib.mkIf pkgs.stdenv.isDarwin {
"Library/Application Support/lazygit/config.yml".source = "Library/Application Support/lazygit/config.yml".source = ../config/lazygit/config.yml;
../config/lazygit/config.yml;
}; };
} }

View file

@ -1,8 +1,9 @@
{lib, ...}: { { lib, ... }:
{
# Transitional cleanup for files previously owned by ~/dots. Keeping this # Transitional cleanup for files previously owned by ~/dots. Keeping this
# separate from steady-state modules makes it obvious what can be deleted # separate from steady-state modules makes it obvious what can be deleted
# once every managed path has been fully handed over to Home Manager. # 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 for path in "$HOME/.zshenv" "$HOME/.zshrc"; do
if [ -L "$path" ]; then if [ -L "$path" ]; then
target="$(readlink "$path")" target="$(readlink "$path")"
@ -15,7 +16,7 @@
done done
''; '';
home.activation.removeLegacyTmuxLink = lib.hm.dag.entryBefore ["checkLinkTargets"] '' home.activation.removeLegacyTmuxLink = lib.hm.dag.entryBefore [ "checkLinkTargets" ] ''
path="$HOME/.config/tmux/tmux.conf" path="$HOME/.config/tmux/tmux.conf"
if [ -L "$path" ]; then if [ -L "$path" ]; then
target="$(readlink "$path")" target="$(readlink "$path")"

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
programs.mise = { programs.mise = {
enable = true; enable = true;
globalConfig = { globalConfig = {

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
imports = [ imports = [
./common.nix ./common.nix
]; ];

View file

@ -3,22 +3,23 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
let
nvimConfig = lib.cleanSourceWith { nvimConfig = lib.cleanSourceWith {
src = ../config/nvim; src = ../config/nvim;
filter = path: type: filter =
builtins.baseNameOf path != ".git" path: type: builtins.baseNameOf path != ".git" && builtins.baseNameOf path != "lazy-lock.json";
&& builtins.baseNameOf path != "lazy-lock.json";
}; };
lazyLockSeed = ../config/nvim/lazy-lock.json; lazyLockSeed = ../config/nvim/lazy-lock.json;
lazyLockPath = "${config.xdg.stateHome}/nvim/lazy-lock.json"; lazyLockPath = "${config.xdg.stateHome}/nvim/lazy-lock.json";
python = pkgs.writeShellScriptBin "python" '' python = pkgs.writeShellScriptBin "python" ''
exec ${pkgs.python3}/bin/python3 "$@" exec ${pkgs.python3}/bin/python3 "$@"
''; '';
in { in
{
# Keep rust-analyzer in the user profile so it shadows rustup's proxy 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. # /run/current-system/sw/bin when Neovim resolves LSP executables.
home.packages = [pkgs.rust-analyzer]; home.packages = [ pkgs.rust-analyzer ];
programs.neovim = { programs.neovim = {
enable = true; enable = true;
@ -59,7 +60,7 @@ in {
recursive = true; recursive = true;
}; };
home.activation.seedNvimLazyLock = lib.hm.dag.entryAfter ["writeBoundary"] '' home.activation.seedNvimLazyLock = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
state_dir="${config.xdg.stateHome}/nvim" state_dir="${config.xdg.stateHome}/nvim"
lockfile="${lazyLockPath}" lockfile="${lazyLockPath}"

View file

@ -1,5 +1,6 @@
{lib, ...}: { { lib, ... }:
home.activation.importRectanglePreferences = lib.hm.dag.entryAfter ["writeBoundary"] '' {
home.activation.importRectanglePreferences = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
/usr/bin/defaults import com.knollsoft.Rectangle ${../config/rectangle/Rectangle.plist} /usr/bin/defaults import com.knollsoft.Rectangle ${../config/rectangle/Rectangle.plist}
''; '';
} }

View file

@ -3,12 +3,14 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
customScripts = import ../scripts {inherit config lib pkgs;}; let
in { customScripts = import ../scripts { inherit config lib pkgs; };
in
{
home.packages = builtins.attrValues customScripts.packages; 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}" 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 if [[ -f "${customScripts.theme.paths.stateFile}" ]]; then

View file

@ -3,7 +3,8 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
let
globalSkills = [ globalSkills = [
{ {
name = "rams"; name = "rams";
@ -42,8 +43,9 @@
needs_sync=1 needs_sync=1
fi fi
'') globalSkills; '') globalSkills;
in { in
home.activation.ensureGlobalSkills = lib.hm.dag.entryAfter ["writeBoundary"] '' {
home.activation.ensureGlobalSkills = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
state_dir="${config.xdg.stateHome}/skills" state_dir="${config.xdg.stateHome}/skills"
stamp_file="$state_dir/global-skills-manifest.sha256" stamp_file="$state_dir/global-skills-manifest.sha256"
desired_hash=${lib.escapeShellArg manifestHash} desired_hash=${lib.escapeShellArg manifestHash}
@ -58,14 +60,16 @@ in {
${missingChecks} ${missingChecks}
if [ "$needs_sync" -eq 1 ]; then if [ "$needs_sync" -eq 1 ]; then
export PATH="${lib.makeBinPath [ export PATH="${
pkgs.nodejs_22 lib.makeBinPath [
pkgs.git pkgs.nodejs_22
pkgs.coreutils pkgs.git
pkgs.findutils pkgs.coreutils
pkgs.gnugrep pkgs.findutils
pkgs.gnused pkgs.gnugrep
]}:$PATH" pkgs.gnused
]
}:$PATH"
${installCommands} ${installCommands}

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
programs.ssh = { programs.ssh = {
enable = true; enable = true;
enableDefaultConfig = false; enableDefaultConfig = false;

View file

@ -3,9 +3,11 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
theme = import ../lib/theme.nix {inherit config;}; let
in { theme = import ../lib/theme.nix { inherit config; };
in
{
programs.tmux = { programs.tmux = {
enable = true; enable = true;
plugins = with pkgs.tmuxPlugins; [ plugins = with pkgs.tmuxPlugins; [

View file

@ -3,15 +3,15 @@
lib, lib,
pkgs, 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" mkdir -p "${config.xdg.cacheHome}/oh-my-zsh"
''; '';
home.packages = [pkgs.oh-my-zsh]; home.packages = [ pkgs.oh-my-zsh ];
programs.zsh = { programs.zsh = {
enable = true; enable = true;
@ -22,42 +22,40 @@
autosuggestion.enable = true; autosuggestion.enable = true;
syntaxHighlighting.enable = true; syntaxHighlighting.enable = true;
shellAliases = shellAliases = {
{ co = "codex --dangerously-bypass-approvals-and-sandbox";
co = "codex --dangerously-bypass-approvals-and-sandbox"; ca = "cursor-agent";
ca = "cursor-agent"; cc = "claude";
cc = "claude"; ch = "claude-handoff";
ch = "claude-handoff"; cl = "clear";
cl = "clear"; gc = "git commit";
gc = "git commit"; gd = "git diff";
gd = "git diff"; gk = "git checkout";
gk = "git checkout"; gp = "git push";
gp = "git push"; gpo = "git pull origin";
gpo = "git pull origin"; gs = "git status";
gs = "git status"; ld = "lumen diff";
ld = "lumen diff"; lg = "lazygit";
lg = "lazygit"; nim = "nvim .";
nim = "nvim .";
} }
// lib.optionalAttrs pkgs.stdenv.isDarwin { // lib.optionalAttrs pkgs.stdenv.isDarwin {
tailscale = "/Applications/Tailscale.app/Contents/MacOS/Tailscale"; tailscale = "/Applications/Tailscale.app/Contents/MacOS/Tailscale";
}; };
envExtra = envExtra = ''
'' if [[ -f "$HOME/.cargo/env" ]]; then
if [[ -f "$HOME/.cargo/env" ]]; then . "$HOME/.cargo/env"
. "$HOME/.cargo/env" fi
fi export NODE_NO_WARNINGS=1
export NODE_NO_WARNINGS=1 ''
'' + lib.optionalString pkgs.stdenv.isDarwin ''
+ lib.optionalString pkgs.stdenv.isDarwin '' # Ghostty shell integration expects a resource directory; the Nix app
# Ghostty shell integration expects a resource directory; the Nix app # bundle lives in the store instead of /Applications.
# bundle lives in the store instead of /Applications. export GHOSTTY_RESOURCES_DIR="${pkgs.ghostty-bin}/Applications/Ghostty.app/Contents/Resources/ghostty"
export GHOSTTY_RESOURCES_DIR="${pkgs.ghostty-bin}/Applications/Ghostty.app/Contents/Resources/ghostty" ''
'' + ''
+ '' export MANPAGER="nvim +Man!"
export MANPAGER="nvim +Man!" '';
'';
initContent = lib.mkMerge [ initContent = lib.mkMerge [
(lib.mkOrder 550 '' (lib.mkOrder 550 ''
@ -88,9 +86,7 @@
export BUN_INSTALL="$HOME/.bun" export BUN_INSTALL="$HOME/.bun"
export PNPM_HOME="${ export PNPM_HOME="${
if pkgs.stdenv.isDarwin if pkgs.stdenv.isDarwin then "$HOME/Library/pnpm" else "${config.xdg.dataHome}/pnpm"
then "$HOME/Library/pnpm"
else "${config.xdg.dataHome}/pnpm"
}" }"
bindkey -v bindkey -v
typeset -U path PATH typeset -U path PATH
@ -107,9 +103,9 @@
"/run/current-system/sw/bin" "/run/current-system/sw/bin"
"/nix/var/nix/profiles/default/bin" "/nix/var/nix/profiles/default/bin"
${lib.optionalString pkgs.stdenv.isDarwin '' ${lib.optionalString pkgs.stdenv.isDarwin ''
"/opt/homebrew/bin" "/opt/homebrew/bin"
"/opt/homebrew/sbin" "/opt/homebrew/sbin"
''} ''}
$path $path
) )

View file

@ -4,7 +4,8 @@
username, username,
hostname, hostname,
... ...
}: { }:
{
imports = [ imports = [
../../modules/base.nix ../../modules/base.nix
../../modules/macos.nix ../../modules/macos.nix

View file

@ -5,9 +5,11 @@
username, username,
self, self,
... ...
}: let }:
packageSets = import ../../lib/package-sets.nix {inherit inputs lib pkgs;}; let
in { packageSets = import ../../lib/package-sets.nix { inherit inputs lib pkgs; };
in
{
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
./disk-config.nix ./disk-config.nix
@ -25,7 +27,11 @@ in {
networking = { networking = {
hostName = "netty"; hostName = "netty";
useDHCP = true; useDHCP = true;
firewall.allowedTCPPorts = [22 80 443]; firewall.allowedTCPPorts = [
22
80
443
];
}; };
services.qemuGuest.enable = true; services.qemuGuest.enable = true;
@ -44,7 +50,7 @@ in {
users.users.${username} = { users.users.${username} = {
isNormalUser = true; isNormalUser = true;
extraGroups = ["wheel"]; extraGroups = [ "wheel" ];
shell = pkgs.zsh; shell = pkgs.zsh;
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM6tzq33IQcurWoQ7vhXOTLjv8YkdTGb7NoNsul3Sbfu rathi@mac" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM6tzq33IQcurWoQ7vhXOTLjv8YkdTGb7NoNsul3Sbfu rathi@mac"

View file

@ -4,9 +4,11 @@
pkgs, pkgs,
username, username,
... ...
}: let }:
packageSets = import ../../lib/package-sets.nix {inherit inputs lib pkgs;}; let
in { packageSets = import ../../lib/package-sets.nix { inherit inputs lib pkgs; };
in
{
imports = [ imports = [
../../home/netty.nix ../../home/netty.nix
]; ];

View file

@ -4,7 +4,8 @@
lib, lib,
modulesPath, modulesPath,
... ...
}: { }:
{
imports = [ imports = [
(modulesPath + "/profiles/qemu-guest.nix") (modulesPath + "/profiles/qemu-guest.nix")
]; ];
@ -15,9 +16,9 @@
"ahci" "ahci"
"sd_mod" "sd_mod"
]; ];
boot.initrd.kernelModules = []; boot.initrd.kernelModules = [ ];
boot.kernelModules = []; boot.kernelModules = [ ];
boot.extraModulePackages = []; boot.extraModulePackages = [ ];
virtualisation.hypervGuest.enable = false; virtualisation.hypervGuest.enable = false;

View file

@ -2,15 +2,12 @@
inputs, inputs,
lib, lib,
pkgs, pkgs,
}: let }:
gwsPackage = let
inputs.googleworkspace-cli.packages.${pkgs.stdenv.hostPlatform.system}.default; gwsPackage = inputs.googleworkspace-cli.packages.${pkgs.stdenv.hostPlatform.system}.default;
claudePackage = claudePackage = inputs.claudeCode.packages.${pkgs.stdenv.hostPlatform.system}.default;
inputs.claudeCode.packages.${pkgs.stdenv.hostPlatform.system}.default; agentcomputerPackage = inputs.agentcomputer-cli.packages.${pkgs.stdenv.hostPlatform.system}.default;
agentcomputerPackage = openspecPackage = inputs.openspec.packages.${pkgs.stdenv.hostPlatform.system}.default;
inputs.agentcomputer-cli.packages.${pkgs.stdenv.hostPlatform.system}.default;
openspecPackage =
inputs.openspec.packages.${pkgs.stdenv.hostPlatform.system}.default;
memex = pkgs.stdenvNoCC.mkDerivation rec { memex = pkgs.stdenvNoCC.mkDerivation rec {
pname = "memex"; pname = "memex";
@ -76,12 +73,16 @@
meta = { meta = {
description = "CLI for Git worktree management"; description = "CLI for Git worktree management";
homepage = "https://worktrunk.dev"; homepage = "https://worktrunk.dev";
license = with lib.licenses; [asl20 mit]; license = with lib.licenses; [
asl20
mit
];
mainProgram = "wt"; mainProgram = "wt";
platforms = lib.platforms.darwin; platforms = lib.platforms.darwin;
}; };
}; };
in { in
{
core = with pkgs; [ core = with pkgs; [
bitwarden-cli bitwarden-cli
curl curl

View file

@ -1,4 +1,5 @@
{config, ...}: let { config, ... }:
let
defaultMode = "dark"; defaultMode = "dark";
sharedPalette = { sharedPalette = {
red = "#ea6962"; red = "#ea6962";
@ -93,43 +94,60 @@
}; };
}; };
renderGhostty = mode: let renderGhostty =
theme = themes.${mode}; mode:
paletteLines = let
builtins.concatStringsSep "\n" theme = themes.${mode};
(builtins.genList paletteLines = builtins.concatStringsSep "\n" (
(index: "palette = ${toString index}=${builtins.elemAt theme.palette index}") builtins.genList (index: "palette = ${toString index}=${builtins.elemAt theme.palette index}") (
(builtins.length theme.palette)); builtins.length theme.palette
in '' )
background = ${theme.background} );
foreground = ${theme.foreground} in
cursor-color = ${theme.cursorColor} ''
cursor-text = ${theme.cursorText} background = ${theme.background}
selection-background = ${theme.selectionBackground} foreground = ${theme.foreground}
selection-foreground = ${theme.selectionForeground} cursor-color = ${theme.cursorColor}
${paletteLines} cursor-text = ${theme.cursorText}
''; selection-background = ${theme.selectionBackground}
selection-foreground = ${theme.selectionForeground}
${paletteLines}
'';
renderTmux = mode: let renderTmux =
theme = themes.${mode}; mode:
in '' let
set-option -g @cozybox-mode '${mode}' theme = themes.${mode};
set-option -g @cozybox-accent '${theme.purple}' in
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 @cozybox-mode '${mode}'
set-option -g window-status-current-format " #[fg=${theme.purple}]*#[fg=default]#I#[fg=${theme.purple}]:#[fg=default]#W " set-option -g @cozybox-accent '${theme.purple}'
set-option -g window-status-separator "" set-option -g status-style bg=${theme.background},fg=${theme.text}
set-option -g pane-border-style fg=${theme.border} set-option -g window-status-format " #I#[fg=${theme.purple}]:#[fg=default]#W "
set-option -g pane-active-border-style fg=${theme.border} 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 renderFzf =
theme = themes.${mode}; mode:
in '' let
--color=fg:${theme.text},bg:${theme.background},hl:${theme.blue} theme = themes.${mode};
--color=fg+:${theme.text},bg+:${theme.surface},hl+:${theme.blue} in
--color=info:${theme.green},prompt:${theme.blue},pointer:${theme.text},marker:${theme.green},spinner:${theme.text} ''
''; --color=fg:${theme.text},bg:${theme.background},hl:${theme.blue}
in { --color=fg+:${theme.text},bg+:${theme.surface},hl+:${theme.blue}
inherit defaultMode paths renderFzf renderGhostty renderTmux themes; --color=info:${theme.green},prompt:${theme.blue},pointer:${theme.text},marker:${theme.green},spinner:${theme.text}
'';
in
{
inherit
defaultMode
paths
renderFzf
renderGhostty
renderTmux
themes
;
} }

View file

@ -4,9 +4,11 @@
pkgs, pkgs,
username, username,
... ...
}: let }:
packageSets = import ../lib/package-sets.nix {inherit inputs lib pkgs;}; let
in { packageSets = import ../lib/package-sets.nix { inherit inputs lib pkgs; };
in
{
nix.enable = true; nix.enable = true;
nix.settings = { nix.settings = {
@ -22,30 +24,29 @@ in {
use-xdg-base-directories = true; use-xdg-base-directories = true;
}; };
nix.gc = nix.gc = {
{ automatic = true;
automatic = true; options = "--delete-older-than 14d";
options = "--delete-older-than 14d"; }
} // (
// ( if pkgs.stdenv.isDarwin then
if pkgs.stdenv.isDarwin then {
{ interval = {
interval = { Weekday = 7;
Weekday = 7; Hour = 3;
Hour = 3; Minute = 0;
Minute = 0; };
}; }
} else
else {
{ dates = "weekly";
dates = "weekly"; }
} );
);
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
programs.zsh.enable = true; programs.zsh.enable = true;
environment.shells = [pkgs.zsh]; environment.shells = [ pkgs.zsh ];
environment.systemPackages = packageSets.core; environment.systemPackages = packageSets.core;

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
homebrew = { homebrew = {
enable = true; enable = true;

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
security.pam.services.sudo_local.touchIdAuth = true; security.pam.services.sudo_local.touchIdAuth = true;
# Karabiner-Elements is managed via Homebrew cask because nix-darwin's # Karabiner-Elements is managed via Homebrew cask because nix-darwin's

View file

@ -20,15 +20,13 @@ let
hostname = host.hostname; hostname = host.hostname;
}; };
mkHomeManagerModule = mkHomeManagerModule = host: {
host: home-manager.useGlobalPkgs = true;
{ home-manager.useUserPackages = true;
home-manager.useGlobalPkgs = true; home-manager.extraSpecialArgs = mkSpecialArgs host;
home-manager.useUserPackages = true; home-manager.backupCommand = "bash ${../scripts/home-manager-backup.sh}";
home-manager.extraSpecialArgs = mkSpecialArgs host; home-manager.users.${username} = import host.homeModule;
home-manager.backupCommand = "bash ${../scripts/home-manager-backup.sh}"; };
home-manager.users.${username} = import host.homeModule;
};
in in
{ {
systems = lib.unique (map (host: host.system) (builtins.attrValues hosts)); systems = lib.unique (map (host: host.system) (builtins.attrValues hosts));

View file

@ -3,9 +3,11 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
packageSets = import ../lib/package-sets.nix {inherit inputs lib pkgs;}; let
in { packageSets = import ../lib/package-sets.nix { inherit inputs lib pkgs; };
in
{
environment.systemPackages = packageSets.extras; environment.systemPackages = packageSets.extras;
fonts.packages = packageSets.fonts; fonts.packages = packageSets.fonts;
} }

View file

@ -2,52 +2,67 @@
config, config,
lib, lib,
pkgs, pkgs,
}: let }:
theme = import ../lib/theme.nix {inherit config;}; let
theme = import ../lib/theme.nix { inherit config; };
tmuxConfigs = { tmuxConfigs = {
dark = pkgs.writeText "tmux-theme-dark.conf" (theme.renderTmux "dark"); dark = pkgs.writeText "tmux-theme-dark.conf" (theme.renderTmux "dark");
light = pkgs.writeText "tmux-theme-light.conf" (theme.renderTmux "light"); light = pkgs.writeText "tmux-theme-light.conf" (theme.renderTmux "light");
}; };
mkScript = { mkScript =
file, {
name, file,
runtimeInputs ? [], name,
replacements ? {}, runtimeInputs ? [ ],
}: replacements ? { },
}:
pkgs.writeShellApplication { pkgs.writeShellApplication {
inherit name runtimeInputs; inherit name runtimeInputs;
text = text = lib.replaceStrings (builtins.attrNames replacements) (builtins.attrValues replacements) (
lib.replaceStrings builtins.readFile file
(builtins.attrNames replacements) );
(builtins.attrValues replacements)
(builtins.readFile file);
}; };
packages = { packages = {
ga = mkScript { ga = mkScript {
name = "ga"; name = "ga";
file = ./ga.sh; file = ./ga.sh;
runtimeInputs = with pkgs; [git]; runtimeInputs = with pkgs; [ git ];
}; };
ghpr = mkScript { ghpr = mkScript {
name = "ghpr"; name = "ghpr";
file = ./ghpr.sh; file = ./ghpr.sh;
runtimeInputs = with pkgs; [gh git gnugrep gnused coreutils]; runtimeInputs = with pkgs; [
gh
git
gnugrep
gnused
coreutils
];
}; };
gpr = mkScript { gpr = mkScript {
name = "gpr"; name = "gpr";
file = ./gpr.sh; file = ./gpr.sh;
runtimeInputs = with pkgs; [gh fzf gnugrep coreutils]; runtimeInputs = with pkgs; [
gh
fzf
gnugrep
coreutils
];
}; };
iosrun = mkScript { iosrun = mkScript {
name = "iosrun"; name = "iosrun";
file = ./iosrun.sh; file = ./iosrun.sh;
runtimeInputs = with pkgs; [findutils gnugrep coreutils]; runtimeInputs = with pkgs; [
findutils
gnugrep
coreutils
];
}; };
mdview = mkScript { mdview = mkScript {
@ -58,13 +73,18 @@
ni = mkScript { ni = mkScript {
name = "ni"; name = "ni";
file = ./ni.sh; file = ./ni.sh;
runtimeInputs = with pkgs; [nix]; runtimeInputs = with pkgs; [ nix ];
}; };
theme = mkScript { theme = mkScript {
name = "theme"; name = "theme";
file = ./theme.sh; file = ./theme.sh;
runtimeInputs = with pkgs; [coreutils findutils neovim tmux]; runtimeInputs = with pkgs; [
coreutils
findutils
neovim
tmux
];
replacements = { replacements = {
"@DEFAULT_MODE@" = theme.defaultMode; "@DEFAULT_MODE@" = theme.defaultMode;
"@STATE_DIR@" = theme.paths.stateDir; "@STATE_DIR@" = theme.paths.stateDir;
@ -90,6 +110,7 @@
file = ./wtc.sh; file = ./wtc.sh;
}; };
}; };
in { in
{
inherit packages theme tmuxConfigs; inherit packages theme tmuxConfigs;
} }