chore(home): drop mutableFiles machinery
The aoe config was the last tracked file, and it drifts the same way settings.json did. With no consumers left, the module, its repo-path option and the tracked aoe-config.toml go too. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,105 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
self,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.home.mutableFiles;
|
||||
repoPath = config.home.mutableFilesRepoPath;
|
||||
flakePrefix = self.outPath;
|
||||
|
||||
fileEntries = lib.attrsToList cfg;
|
||||
|
||||
toRepoPath = storePath: repoPath + lib.removePrefix flakePrefix (toString storePath);
|
||||
|
||||
checkScript = lib.concatMapStringsSep "\n" (
|
||||
{ name, value }:
|
||||
let
|
||||
target = "${config.home.homeDirectory}/${name}";
|
||||
storePath = value.source;
|
||||
# toRepoPath only works for sources that live in the flake tree. A
|
||||
# generated source is not under flakePrefix, so removePrefix is a no-op
|
||||
# and the hint would print a /nix/store path to copy back onto.
|
||||
originalPath =
|
||||
if value.upstreamPath != null then "${repoPath}/${value.upstreamPath}" else toRepoPath value.source;
|
||||
in
|
||||
''
|
||||
if [ -f "${target}" ] && ! ${lib.getExe' pkgs.diffutils "diff"} -q "${storePath}" "${target}" > /dev/null 2>&1; then
|
||||
echo ""
|
||||
echo "!! mutable file changed: ${name}"
|
||||
echo " To bring changes upstream:"
|
||||
echo " cp ${target} ${originalPath}"
|
||||
echo ""
|
||||
${lib.getExe' pkgs.diffutils "diff"} -u "${storePath}" "${target}" || true
|
||||
_mutable_changed=1
|
||||
fi
|
||||
''
|
||||
) fileEntries;
|
||||
|
||||
copyScript = lib.concatMapStringsSep "\n" (
|
||||
{ name, value }:
|
||||
let
|
||||
target = "${config.home.homeDirectory}/${name}";
|
||||
inherit (value) source;
|
||||
dirName = builtins.dirOf target;
|
||||
in
|
||||
''
|
||||
mkdir -p "${dirName}"
|
||||
cp -f "${source}" "${target}"
|
||||
chmod ${if value.executable then "755" else "644"} "${target}"
|
||||
''
|
||||
) fileEntries;
|
||||
in
|
||||
{
|
||||
options.home.mutableFilesRepoPath = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Absolute path to the nixos-config repo on disk.";
|
||||
};
|
||||
|
||||
options.home.mutableFiles = lib.mkOption {
|
||||
type = lib.types.attrsOf (
|
||||
lib.types.submodule {
|
||||
options = {
|
||||
source = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
description = "Path to the source file.";
|
||||
};
|
||||
executable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Whether the file should be executable.";
|
||||
};
|
||||
|
||||
upstreamPath = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
example = "home/yolo/aoe-config.toml";
|
||||
description = ''
|
||||
Repo-relative file to name in the "bring changes upstream" hint.
|
||||
Required when `source` is generated rather than a file in the
|
||||
flake tree, since the store path cannot be mapped back.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
default = { };
|
||||
description = "Files to copy (not symlink) into the home directory, with change detection.";
|
||||
};
|
||||
|
||||
config = lib.mkIf (cfg != { }) {
|
||||
home.activation.mutableFiles = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
_mutable_changed=0
|
||||
${checkScript}
|
||||
if [ "$_mutable_changed" -eq 1 ]; then
|
||||
echo ""
|
||||
echo "!! Aborting: mutable files have been modified outside of nix."
|
||||
echo " Bring the changes upstream first, then re-run."
|
||||
exit 1
|
||||
fi
|
||||
${copyScript}
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -5,7 +5,6 @@
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
../features/mutable-file.nix
|
||||
./zsh.nix
|
||||
./nix.nix
|
||||
./neovim
|
||||
@@ -28,10 +27,6 @@
|
||||
};
|
||||
|
||||
home = {
|
||||
# mkDefault: hosts whose clone lives elsewhere (yolo, under ~/tea) override
|
||||
# this with a plain assignment.
|
||||
mutableFilesRepoPath = lib.mkDefault "${config.home.homeDirectory}/projects/nixos-config";
|
||||
|
||||
username = lib.mkDefault "naps62";
|
||||
homeDirectory = lib.mkDefault "/home/${config.home.username}";
|
||||
stateVersion = lib.mkDefault "24.05";
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
default_profile = "default"
|
||||
|
||||
[acp]
|
||||
allow_agent_install = false
|
||||
allowed_agents = []
|
||||
auto_stop_idle_secs = 0
|
||||
compaction_reminder = false
|
||||
compaction_reminder_percent = 75
|
||||
default_agent = "claude"
|
||||
max_concurrent_workers = 5
|
||||
node_path = ""
|
||||
offer_structured_in_new_session = true
|
||||
rate_limit_auto_resume = false
|
||||
replay_events = 0
|
||||
restrict_agents = false
|
||||
show_tool_durations = true
|
||||
silent_orphan_grace_secs = 120
|
||||
|
||||
[hooks]
|
||||
|
||||
[host_hooks]
|
||||
|
||||
[logging]
|
||||
default_level = "info"
|
||||
file_path = "debug.log"
|
||||
keep_count = 5
|
||||
max_size_mib = 50
|
||||
output = "file"
|
||||
rotation = "size"
|
||||
show_spans = false
|
||||
|
||||
[logging.targets]
|
||||
|
||||
[session]
|
||||
agent_status_hooks = true
|
||||
auto_resume_on_restart = true
|
||||
auto_stop_idle_secs = 0
|
||||
click_action = "live_send"
|
||||
confirm_before_quit = false
|
||||
confirm_delete = true
|
||||
default_attach_mode = "tmux"
|
||||
delete_to_trash = false
|
||||
favorites_first = true
|
||||
inherit_host_environment = false
|
||||
live_send_exit_chord = "C-q"
|
||||
live_send_leader = "C-b"
|
||||
live_send_on_view_switch = false
|
||||
merge_hooks_into_selected_agent = true
|
||||
mouse_capture = true
|
||||
opencode_preassign_session_id = false
|
||||
prevent_sleep_idle_grace_minutes = 15
|
||||
prevent_sleep_when_active = false
|
||||
restart_wake_message = "wake up: pick up what you were doing"
|
||||
row_tag = "none"
|
||||
show_session_colors = true
|
||||
smart_rename = true
|
||||
smart_rename_agent = ""
|
||||
strict_hotkeys = false
|
||||
tie_workdir_to_name = true
|
||||
trash_retention_days = 30
|
||||
unread_indicator = true
|
||||
yolo_mode_default = true
|
||||
|
||||
[session.agent_detect_as]
|
||||
synclaude = "claude"
|
||||
|
||||
[session.custom_agents]
|
||||
synclaude = "synclaude"
|
||||
|
||||
[status_hooks]
|
||||
enabled = false
|
||||
|
||||
[theme]
|
||||
color_mode = "truecolor"
|
||||
idle_decay_minutes = 0
|
||||
name = "zinc"
|
||||
|
||||
[tmux]
|
||||
clipboard = "auto"
|
||||
mouse = "auto"
|
||||
status_bar = "auto"
|
||||
vt_live = true
|
||||
|
||||
[worktree]
|
||||
auto_cleanup = true
|
||||
bare_repo_path_template = "./{branch}"
|
||||
delete_branch_on_cleanup = false
|
||||
enabled = true
|
||||
init_submodules = true
|
||||
path_template = "../{repo-name}-worktrees/{branch}"
|
||||
workspace_path_template = "../{branch}-workspace-{session-id}"
|
||||
+3
-16
@@ -28,8 +28,8 @@ in
|
||||
./ssh.nix
|
||||
];
|
||||
|
||||
# Host-local, like the aoe config below: bash goes from "ask" to
|
||||
# "allow" so unattended opencode sessions stop stalling on every git and grep.
|
||||
# Host-local: bash goes from "ask" to "allow" so unattended opencode sessions
|
||||
# stop stalling on every git and grep.
|
||||
# It also drops the prompt on branches under review, which is the tradeoff.
|
||||
xdg.configFile."opencode/opencode.json".source = lib.mkForce mergedOpencodeConfig;
|
||||
|
||||
@@ -44,22 +44,9 @@ in
|
||||
light = "Bibata-Modern-Amber";
|
||||
};
|
||||
|
||||
home = {
|
||||
# Headless browser driver the agent tooling shells out to. Was a global npm
|
||||
# install on the ubuntu box.
|
||||
packages = [ pkgs.agent-browser ];
|
||||
|
||||
# Both default to ~/projects/nixos-config in common/programs; this clone
|
||||
# lives under ~/tea. nh.flake sets NH_FLAKE, so without it `nh home switch`
|
||||
# with no argument resolves to a path that does not exist.
|
||||
mutableFilesRepoPath = "/home/naps62/tea/nixos-config";
|
||||
|
||||
mutableFiles = {
|
||||
# Host-local, not shared: this sets yolo_mode_default = true, which starts
|
||||
# aoe sessions with permission checks skipped. Only correct on this box.
|
||||
".config/agent-of-empires/config.toml".source = ./aoe-config.toml;
|
||||
};
|
||||
};
|
||||
home.packages = [ pkgs.agent-browser ];
|
||||
|
||||
# This is the one box that runs the agent-skills units; each starts a session,
|
||||
# so a second machine enabling them would run the same job twice.
|
||||
|
||||
Reference in New Issue
Block a user