summary refs log tree commit diff
path: root/nixos/maintainers/scripts/ec2/amazon-image.nix
diff options
context:
space:
mode:
authorDan Peebles <pumpkin@me.com>2017-02-22 23:47:24 +0000
committerDan Peebles <pumpkin@me.com>2017-02-22 23:49:49 +0000
commit49641e0de006fdc5edd11292b1e94410c3bb8d79 (patch)
tree180b17aa8e5df508f4cecdb8306c91cba4352887 /nixos/maintainers/scripts/ec2/amazon-image.nix
parentdf4c0aeff864f8d3308afc1f4386895fcd3e990d (diff)
downloadnixpkgs-49641e0de006fdc5edd11292b1e94410c3bb8d79.tar
nixpkgs-49641e0de006fdc5edd11292b1e94410c3bb8d79.tar.gz
nixpkgs-49641e0de006fdc5edd11292b1e94410c3bb8d79.tar.bz2
nixpkgs-49641e0de006fdc5edd11292b1e94410c3bb8d79.tar.lz
nixpkgs-49641e0de006fdc5edd11292b1e94410c3bb8d79.tar.xz
nixpkgs-49641e0de006fdc5edd11292b1e94410c3bb8d79.tar.zst
nixpkgs-49641e0de006fdc5edd11292b1e94410c3bb8d79.zip
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.
Diffstat (limited to 'nixos/maintainers/scripts/ec2/amazon-image.nix')
-rw-r--r--nixos/maintainers/scripts/ec2/amazon-image.nix23
1 files changed, 21 insertions, 2 deletions
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;