1 { lib, gnused, nixos, nixosTest, trustix, trustixSrc, writeShellScript
4 inherit (lib) filterAttrs hasPrefix mapAttrsToList optional;
6 trustixModule = trustixSrc + "/nixos";
8 trustixKeyConfig = writeText "trustixKeyConfig" ''
11 system.activationScripts.trustix-create-key = '''
12 if [[ ! -e /keys/trustix-priv ]];then
14 ''${pkgs.trustix}/bin/trustix generate-key --privkey /keys/trustix-priv --pubkey /keys/trustix-pub
21 publisherConfig = writeText "publisherConfig" ''
25 signers.aisha-snakeoil = {
27 ed25519 = { private-key-path = "/keys/trustix-priv"; };
30 signer = "aisha-snakeoil";
41 mkConfig = writeShellScript "mkConfig" ''
44 ${gnused}/bin/sed "s,@pubkey@,$(< /keys/trustix-pub)," ${publisherConfig} > /etc/nixos/publisher.nix
45 cat > /etc/nixos/configuration.nix <<EOF
48 ${../lib/nixosTest-rebuild-switch.nix}
58 name = "one-publisher";
60 alisha = { pkgs, ... }: {
62 ../lib/nixosTest-rebuild-switch.nix
66 system.extraDependencies = [
67 pkgs.hello.inputDerivation
68 pkgs.remarshal # For building trustix-config.toml
71 ../lib/nixosTest-rebuild-switch.nix
78 virtualisation.diskSize = "1000";
79 virtualisation.memorySize = "1G";
83 alisha.wait_for_file("/keys/trustix-pub")
86 "nixos-rebuild switch --show-trace",
88 alisha.succeed("nix-build '<nixpkgs>' -A hello")