Files
home-manager/tests/modules/programs/andcli/mutable-settings.nix
Austin Horstman 4143d156c0 andcli: add opt-in mutable settings
Keep the application configuration writable while applying declared
settings. Preserve undeclared state and use ordinary collision handling
when returning to linked YAML configuration.
2026-10-04 20:17:49 -05:00

46 lines
1.3 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
relativePath =
if pkgs.stdenv.hostPlatform.isDarwin then
"Library/Application Support/andcli/config.yaml"
else
"custom-config/andcli/config.yaml";
in
{
programs.andcli = {
enable = true;
mutableSettings = true;
package = null;
settings.options.show_tokens = false;
};
xdg.configHome = "${config.home.homeDirectory}/custom-config";
assertions = [
{
assertion = config.home.activation.andcliMutableSettings.after == [ "linkGeneration" ];
message = "Mutable andcli settings must run after linkGeneration.";
}
{
assertion = !(config.home.activation ? andcliImmutableSettings);
message = "Mutable andcli settings must not create immutable cleanup.";
}
{
assertion = !(lib.any (package: lib.getName package == "andcli") config.home.packages);
message = "A null andcli package must not be installed.";
}
];
nmt.script = ''
assertPathNotExists "home-files/${relativePath}"
assertFileContains activate "${config.home.homeDirectory}/${relativePath}"
input0="$(grep -o '/nix/store/[^ ]*-andcli-config.yaml' "$TESTED/activate")" \
|| fail "andcli config.yaml input is missing from activation"
assertFileContent "$input0" ${./mutable-expected.yaml}
'';
}