nix/home/devin.nix
Hari 1860fa6dcb
Some checks are pending
quality / changes (push) Waiting to run
quality / Flake Check (push) Blocked by required conditions
quality / Nix Format Check (push) Blocked by required conditions
quality / Deploy netty (push) Blocked by required conditions
add declerative devin conf (#39)
2026-04-02 20:52:46 +00:00

26 lines
742 B
Nix

{
config,
lib,
pkgs,
...
}:
let
sourceFile = ../config/devin/config.json;
targetDir = "${config.xdg.configHome}/devin";
targetFile = "${targetDir}/config.json";
bin = "${pkgs.coreutils}/bin";
in
{
# Devin rewrites this file when settings change, so seed a mutable copy
# instead of pointing the path at the read-only Nix store.
home.activation.installDevinConfig = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
${bin}/mkdir -p "${targetDir}"
if [ -f "${targetFile}" ] && ! ${bin}/cmp -s "${sourceFile}" "${targetFile}"; then
timestamp="$(${bin}/date +%Y%m%d%H%M%S)"
${bin}/cp "${targetFile}" "${targetFile}.hm-bak.$timestamp"
fi
${bin}/install -m 600 "${sourceFile}" "${targetFile}"
'';
}