colmena/integration-tests/apply/hive.nix

84 lines
1.9 KiB
Nix
Raw Normal View History

2021-11-22 10:52:35 +01:00
let
tools = import ./tools.nix { insideVm = true; };
testPkg = let
text = builtins.trace "must appear during evaluation" ''
echo "must appear during build"
mkdir -p $out
'';
in tools.pkgs.runCommand "test-package" {} text;
2021-11-22 10:52:35 +01:00
in {
meta = {
nixpkgs = tools.pkgs;
};
alpha = { lib, ... }: {
imports = [
(tools.getStandaloneConfigFor "alpha")
];
environment.systemPackages = [ testPkg ];
environment.etc."deployment".text = "SUCCESS";
system.activationScripts.colmena-test.text = ''
echo "must appear during activation"
'';
# Will be created during activation
users.users.testuser = {
isSystemUser = true;
group = "testgroup";
};
users.groups.testgroup = {};
# /run/keys/key-text
deployment.keys.key-text = {
text = ''
@poison@
'';
};
# /tmp/another-key-dir/key-command
deployment.keys.key-command = {
destDir = "/tmp/another-key-dir";
keyCommand = [ "hostname" ];
};
# /tmp/another-key-dir/key-file
deployment.keys.key-file = {
destDir = "/tmp/another-key-dir";
keyFile = "/tmp/bundle/key-file";
};
# /tmp/another-key-dir/key-file-2
deployment.keys.key-file-2 = {
destDir = "/tmp/another-key-dir";
keyFile = ./key-file;
};
# /run/keys/pre-activation
deployment.keys.pre-activation = {
text = "pre-activation key";
uploadAt = "pre-activation";
user = "testuser";
group = "testgroup";
permissions = "640";
};
# /run/keys/post-activation
deployment.keys.post-activation = {
text = "post-activation key";
uploadAt = "post-activation";
user = "testuser";
group = "testgroup";
permissions = "600";
};
2021-11-22 10:52:35 +01:00
};
deployer = tools.getStandaloneConfigFor "deployer";
beta = tools.getStandaloneConfigFor "beta";
gamma = tools.getStandaloneConfigFor "gamma";
}