mirror of
https://github.com/nix-community/home-manager.git
synced 2026-11-04 11:50:08 +00:00
Keep application settings writable while applying declared values. Restore unchanged immutable links through the shared helper and keep private-key management explicit.
48 lines
1.3 KiB
Nix
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}
|
|
'';
|
|
}
|