mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-06 17:11:03 +01:00
Fixes #7577 This lets us better express activation order dependencies on secret provisioners that run as systemd services
41 lines
1.1 KiB
Nix
41 lines
1.1 KiB
Nix
{ pkgs, ... }:
|
|
let
|
|
module = pkgs.writeText "with-secrets-in-store-module" ''
|
|
{
|
|
programs.rclone.remotes = {
|
|
alices-cool-remote-v2 = {
|
|
config = {
|
|
type = "b2";
|
|
hard_delete = true;
|
|
};
|
|
secrets = {
|
|
account = "${pkgs.writeText "acc" "super-secret-account-id"}";
|
|
key = "${pkgs.writeText "key" "api-key-from-file"}";
|
|
};
|
|
};
|
|
};
|
|
}
|
|
'';
|
|
|
|
expected = pkgs.writeText "with-secrets-in-store-expected" ''
|
|
[alices-cool-remote-v2]
|
|
hard_delete = true
|
|
type = b2
|
|
account = super-secret-account-id
|
|
key = api-key-from-file
|
|
|
|
'';
|
|
in
|
|
{
|
|
script = ''
|
|
with subtest("Generate with secrets from store"):
|
|
succeed_as_alice("install -m644 ${module} /home/alice/.config/home-manager/test-remote.nix")
|
|
|
|
actual = succeed_as_alice("home-manager switch")
|
|
expected = "rclone-config.service"
|
|
assert "Starting units: " in actual and expected in actual, \
|
|
f"expected home-manager switch to contain {expected}, but got {actual}"
|
|
|
|
succeed_as_alice("diff -u ${expected} /home/alice/.config/rclone/rclone.conf")
|
|
'';
|
|
}
|