Files
home-manager/tests/modules/programs/algia/mutable-settings.nix
Austin Horstman e090a36ef0 algia: add opt-in mutable settings
Keep application settings writable while applying declared values.
Restore unchanged immutable links through the shared helper and keep
private-key management explicit.
2026-10-04 20:17:54 -05:00

48 lines
1.3 KiB
Nix

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