From 27dce7bc3400bbe4d97ee8bd3f841df2cb179f60 Mon Sep 17 00:00:00 2001 From: aszlig Date: Sat, 27 Jun 2015 17:22:18 +0200 Subject: machines: Allow to easily build ISO images. I know it's a somewhat hacky approach to strip off "_module", "boot.loader" and "fileSystems" from the machine config, but that should be the options which are to be set by iso-image.nix but that way we can re-use the upstream module. Also, if one of our modules sets an option without a proper "vuizvui." namespace, we get an error as well. But it's our policy anyway to always namespace with "vuizvui." so it's even good to get an error here. Signed-off-by: aszlig --- machines/default.nix | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/machines/default.nix b/machines/default.nix index 84d70423..fe293692 100644 --- a/machines/default.nix +++ b/machines/default.nix @@ -1,12 +1,38 @@ { system ? builtins.currentSystem, ... }: let + nixpkgs = import ../nixpkgs-path.nix; + callMachine = path: rec { config = import path; - build = import "${import ../nixpkgs-path.nix}/nixos/lib/eval-config.nix" { + build = import "${nixpkgs}/nixos/lib/eval-config.nix" { inherit system; modules = [ config ] ++ import ../modules/module-list.nix; }; + iso = import "${nixpkgs}/nixos/lib/eval-config.nix" { + inherit system; + modules = [ + { options = { inherit (build.options) vuizvui; }; + config = (builtins.removeAttrs build.config [ + "_module" "boot" "fileSystems" + ]) // { + boot = builtins.removeAttrs build.config.boot [ "loader" ]; + }; + } + "${nixpkgs}/nixos/modules/installer/cd-dvd/iso-image.nix" + ( + { lib, ... }: let + name = build.config.networking.hostName; + upperName = lib.toUpper name; + in rec { + isoImage.isoName = "${name}.iso"; + isoImage.volumeID = builtins.substring 0 11 "${upperName}_LIVE"; + isoImage.makeEfiBootable = true; + isoImage.makeUsbBootable = true; + } + ) + ]; + }; use = { imports = [ config ] ++ import ../modules/module-list.nix; }; -- cgit 1.4.1