commit
b1fc183639
@ -0,0 +1,35 @@ |
||||
{ system ? builtins.currentSystem |
||||
, config ? {} |
||||
, pkgs ? import ../.. { inherit system config; } |
||||
, lib ? pkgs.lib |
||||
, testing ? import ../lib/testing-python.nix { inherit system pkgs; } |
||||
}: |
||||
let |
||||
secretInStore = pkgs.writeText "topsecret" "iamasecret"; |
||||
testWithCompressor = compressor: testing.makeTest { |
||||
name = "initrd-secrets-${compressor}"; |
||||
|
||||
meta.maintainers = [ lib.maintainers.lheckemann ]; |
||||
|
||||
machine = { ... }: { |
||||
virtualisation.useBootLoader = true; |
||||
boot.initrd.secrets."/test" = secretInStore; |
||||
boot.initrd.postMountCommands = '' |
||||
cp /test /mnt-root/secret-from-initramfs |
||||
''; |
||||
boot.initrd.compressor = compressor; |
||||
# zstd compression is only supported from 5.9 onwards. Remove when 5.10 becomes default. |
||||
boot.kernelPackages = pkgs.linuxPackages_latest; |
||||
}; |
||||
|
||||
testScript = '' |
||||
start_all() |
||||
machine.wait_for_unit("multi-user.target") |
||||
machine.succeed( |
||||
"cmp ${secretInStore} /secret-from-initramfs" |
||||
) |
||||
''; |
||||
}; |
||||
in lib.flip lib.genAttrs testWithCompressor [ |
||||
"cat" "gzip" "bzip2" "xz" "lzma" "lzop" "pigz" "pixz" "zstd" |
||||
] |
@ -0,0 +1,53 @@ |
||||
rec { |
||||
cat = { |
||||
executable = pkgs: "cat"; |
||||
ubootName = "none"; |
||||
extension = ".cpio"; |
||||
}; |
||||
gzip = { |
||||
executable = pkgs: "${pkgs.gzip}/bin/gzip"; |
||||
defaultArgs = ["-9n"]; |
||||
ubootName = "gzip"; |
||||
extension = ".gz"; |
||||
}; |
||||
bzip2 = { |
||||
executable = pkgs: "${pkgs.bzip2}/bin/bzip2"; |
||||
ubootName = "bzip2"; |
||||
extension = ".bz2"; |
||||
}; |
||||
xz = { |
||||
executable = pkgs: "${pkgs.xz}/bin/xz"; |
||||
defaultArgs = ["--check=crc32" "--lzma2=dict=512KiB"]; |
||||
extension = ".xz"; |
||||
}; |
||||
lzma = { |
||||
executable = pkgs: "${pkgs.xz}/bin/lzma"; |
||||
defaultArgs = ["--check=crc32" "--lzma1=dict=512KiB"]; |
||||
ubootName = "lzma"; |
||||
extension = ".lzma"; |
||||
}; |
||||
lz4 = { |
||||
executable = pkgs: "${pkgs.lz4}/bin/lz4"; |
||||
defaultArgs = ["-l"]; |
||||
ubootName = "lz4"; |
||||
extension = ".lz4"; |
||||
}; |
||||
lzop = { |
||||
executable = pkgs: "${pkgs.lzop}/bin/lzop"; |
||||
ubootName = "lzo"; |
||||
extension = ".lzo"; |
||||
}; |
||||
zstd = { |
||||
executable = pkgs: "${pkgs.zstd}/bin/zstd"; |
||||
defaultArgs = ["-10"]; |
||||
ubootName = "zstd"; |
||||
extension = ".zst"; |
||||
}; |
||||
pigz = gzip // { |
||||
executable = pkgs: "${pkgs.pigz}/bin/pigz"; |
||||
}; |
||||
pixz = xz // { |
||||
executable = pkgs: "${pkgs.pixz}/bin/pixz"; |
||||
defaultArgs = []; |
||||
}; |
||||
} |
Loading…
Reference in new issue