From 49641e0de006fdc5edd11292b1e94410c3bb8d79 Mon Sep 17 00:00:00 2001 From: Dan Peebles Date: Wed, 22 Feb 2017 23:47:24 +0000 Subject: make-disk-image.nix: support additional filesystem contents This makes make-disk-image.nix slightly more consistent with other image builders we have. Unfortunately I duplicated some code in doing so, but this is temporary duplication on the path to consolidating everything. See https://github.com/NixOS/nixpkgs/issues/23052 for more details on that. I'm also exposing the option in the amazon-image.nix maintainer module. --- nixos/maintainers/scripts/ec2/amazon-image.nix | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'nixos/maintainers/scripts/ec2/amazon-image.nix') diff --git a/nixos/maintainers/scripts/ec2/amazon-image.nix b/nixos/maintainers/scripts/ec2/amazon-image.nix index bfa4f4b3ca5..b4190df8335 100644 --- a/nixos/maintainers/scripts/ec2/amazon-image.nix +++ b/nixos/maintainers/scripts/ec2/amazon-image.nix @@ -2,15 +2,34 @@ with lib; -{ +let + cfg = config.amazonImage; +in { imports = [ ../../../modules/installer/cd-dvd/channel.nix ../../../modules/virtualisation/amazon-image.nix ]; - system.build.amazonImage = import ../../../lib/make-disk-image.nix { + options.amazonImage = { + contents = mkOption { + example = literalExample '' + [ { source = pkgs.memtest86 + "/memtest.bin"; + target = "boot/memtest.bin"; + } + ] + ''; + default = []; + description = '' + This option lists files to be copied to fixed locations in the + generated image. Glob patterns work. + ''; + }; + }; + + config.system.build.amazonImage = import ../../../lib/make-disk-image.nix { inherit lib config; + inherit (cfg) contents; pkgs = import ../../../.. { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package partitioned = config.ec2.hvm; diskSize = if config.ec2.hvm then 2048 else 8192; -- cgit 1.4.1