at 22.05-pre 1.1 kB view raw
1{ system ? builtins.currentSystem 2, config ? {} 3, pkgs ? import ../.. { inherit system config; } 4, lib ? pkgs.lib 5, testing ? import ../lib/testing-python.nix { inherit system pkgs; } 6}: 7let 8 secretInStore = pkgs.writeText "topsecret" "iamasecret"; 9 testWithCompressor = compressor: testing.makeTest { 10 name = "initrd-secrets-${compressor}"; 11 12 meta.maintainers = [ lib.maintainers.lheckemann ]; 13 14 machine = { ... }: { 15 virtualisation.useBootLoader = true; 16 boot.initrd.secrets."/test" = secretInStore; 17 boot.initrd.postMountCommands = '' 18 cp /test /mnt-root/secret-from-initramfs 19 ''; 20 boot.initrd.compressor = compressor; 21 # zstd compression is only supported from 5.9 onwards. Remove when 5.10 becomes default. 22 boot.kernelPackages = pkgs.linuxPackages_latest; 23 }; 24 25 testScript = '' 26 start_all() 27 machine.wait_for_unit("multi-user.target") 28 machine.succeed( 29 "cmp ${secretInStore} /secret-from-initramfs" 30 ) 31 ''; 32 }; 33in lib.flip lib.genAttrs testWithCompressor [ 34 "cat" "gzip" "bzip2" "xz" "lzma" "lzop" "pigz" "pixz" "zstd" 35]