mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
nixos/virtualisation: add contents setting to googleComputeImage
Allow placing files and directories in the image
This commit is contained in:
parent
b841c624fd
commit
38f2ca6b80
1 changed files with 28 additions and 0 deletions
|
@ -56,6 +56,33 @@ in
|
|||
GZIP compression level of the resulting disk image (1-9).
|
||||
'';
|
||||
};
|
||||
|
||||
virtualisation.googleComputeImage.contents = mkOption {
|
||||
type = with types; listOf attrs;
|
||||
default = [ ];
|
||||
description = ''
|
||||
The files and directories to be placed in the image.
|
||||
This is a list of attribute sets {source, target, mode, user, group} where
|
||||
`source' is the file system object (regular file or directory) to be
|
||||
grafted in the file system at path `target', `mode' is a string containing
|
||||
the permissions that will be set (ex. "755"), `user' and `group' are the
|
||||
user and group name that will be set as owner of the files.
|
||||
`mode', `user', and `group' are optional.
|
||||
When setting one of `user' or `group', the other needs to be set too.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
[
|
||||
{
|
||||
source = ./default.nix;
|
||||
target = "/etc/nixos/default.nix";
|
||||
mode = "0644";
|
||||
user = "root";
|
||||
group = "root";
|
||||
}
|
||||
];
|
||||
'';
|
||||
};
|
||||
|
||||
virtualisation.googleComputeImage.efi = mkEnableOption "EFI booting";
|
||||
};
|
||||
|
||||
|
@ -99,6 +126,7 @@ in
|
|||
'';
|
||||
format = "raw";
|
||||
configFile = if cfg.configFile == null then defaultConfigFile else cfg.configFile;
|
||||
inherit (cfg) contents;
|
||||
partitionTableType = if cfg.efi then "efi" else "legacy";
|
||||
inherit (config.virtualisation) diskSize;
|
||||
inherit config lib pkgs;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue