codex: preserve generated local config sections
This commit is contained in:
@@ -4,9 +4,9 @@ service_tier = "fast"
|
|||||||
personality = "pragmatic"
|
personality = "pragmatic"
|
||||||
suppress_unstable_features_warning = true
|
suppress_unstable_features_warning = true
|
||||||
|
|
||||||
# Portable Codex defaults. Home Manager appends host-local fragments from
|
# Portable Codex defaults. Home Manager regenerates ~/.codex/config.toml from
|
||||||
# ~/.codex/config.local.toml and ~/.codex/config.local-state.toml when it
|
# this file, ~/.codex/config.local.toml, and Codex-owned sections preserved in
|
||||||
# regenerates ~/.codex/config.toml.
|
# ~/.codex/config.local-state.toml.
|
||||||
|
|
||||||
[mcp_servers.chrome-devtools]
|
[mcp_servers.chrome-devtools]
|
||||||
command = "npx"
|
command = "npx"
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ in {
|
|||||||
generatedStateConfig = lib.mkOption {
|
generatedStateConfig = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "${cfg.codexHome}/config.local-state.toml";
|
default = "${cfg.codexHome}/config.local-state.toml";
|
||||||
description = "Codex-generated host-local state harvested from config.toml.";
|
description = "Codex-owned host-local config sections harvested from config.toml.";
|
||||||
};
|
};
|
||||||
|
|
||||||
skillsDir = lib.mkOption {
|
skillsDir = lib.mkOption {
|
||||||
@@ -156,7 +156,7 @@ in {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function flush_block() {
|
function flush_block() {
|
||||||
if (keep && section != "" && !(section in base_sections) && !rejected_project(section)) {
|
if (section != "" && !(section in base_sections) && !rejected_project(section)) {
|
||||||
if (printed) {
|
if (printed) {
|
||||||
print ""
|
print ""
|
||||||
}
|
}
|
||||||
@@ -172,7 +172,6 @@ in {
|
|||||||
/^\[[^]]+\]$/ {
|
/^\[[^]]+\]$/ {
|
||||||
flush_block()
|
flush_block()
|
||||||
section = $0
|
section = $0
|
||||||
keep = ($0 ~ /^\[projects\./ || $0 ~ /^\[tui\./)
|
|
||||||
block = $0 "\n"
|
block = $0 "\n"
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
@@ -184,7 +183,9 @@ in {
|
|||||||
END {
|
END {
|
||||||
flush_block()
|
flush_block()
|
||||||
}
|
}
|
||||||
' "$base" "$target" > "$local_state"
|
' "$base" "$target" \
|
||||||
|
| ${lib.getExe pkgs.perl} -0pe 's/\n{3,}/\n\n/g' \
|
||||||
|
> "$local_state"
|
||||||
|
|
||||||
if [ -s "$local_state" ]; then
|
if [ -s "$local_state" ]; then
|
||||||
chmod 600 "$local_state"
|
chmod 600 "$local_state"
|
||||||
|
|||||||
Reference in New Issue
Block a user