-
-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make-disk-image: allow pre/post format files in vm #778
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add some tests for this?
type = lib.types.attrsOf (lib.types.either lib.types.str lib.types.path); | ||
description = '' | ||
Files to copy into the image builder VM before disko is run. | ||
This is useful to provide secrets like LUKS keys, or other files you need for formatting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we not have a disclaimer, that this leaks secrets into the nix store?
For image builder that runs outside of the nix store, we have a parameter that can be used instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A warning that it could leak is probably a good idea.
But the second variant of passing a shell snippet should be usable without leaking secrets into the store? i.e.
preFormatFiles."/tmp/secret" = "cat /my-secret-out-side-nix store > $out"
shouldn't leak. $out is just a tempfile here, see prepareFiles above.
example = lib.literalExpression '' | ||
{ | ||
"/tmp/pre/file" = pkgs.writeText "foo" "bar"; | ||
"/tmp/pre/script" = "mkdir -p $out/foo; echo bar > $out/foo"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"/tmp/pre/script" = "mkdir -p $out/foo; echo bar > $out/foo"; | |
"/tmp/pre/script" = "mkdir -p $out; echo bar > $out/foo"; |
...via
disko.imageBuilder.preFormatFiles
anddisko.imageBuilder.postFormatFiles
.This enables users to add secrets to their diskoVMs.
diskoImageScripts
does include--pre-format-files
, butdiskoImages
didn't supportthe same feature so far - making it harder to pre-generate encrypted disk images or to test such images in a VM.