mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 20:25:32 +03:00
make-disk-image: Add copyChannel argument
Add a copyChannel argument which controls whether the current source tree will be made available as a nix channel in the image or not. Previously, it always was. Making it available is useful for interactive use of nix utils, but changes the hash of the image when the sources are updated.
This commit is contained in:
parent
56c5efa25b
commit
398a73ac98
1 changed files with 12 additions and 2 deletions
|
@ -64,6 +64,12 @@
|
|||
|
||||
, # Disk image format, one of qcow2, qcow2-compressed, vdi, vpc, raw.
|
||||
format ? "raw"
|
||||
|
||||
, # Whether a nix channel based on the current source tree should be
|
||||
# made available inside the image. Useful for interactive use of nix
|
||||
# utils, but changes the hash of the image when the sources are
|
||||
# updated.
|
||||
copyChannel ? true
|
||||
}:
|
||||
|
||||
assert partitionTableType == "legacy" || partitionTableType == "legacy+gpt" || partitionTableType == "efi" || partitionTableType == "hybrid" || partitionTableType == "none";
|
||||
|
@ -166,7 +172,9 @@ let format' = format; in let
|
|||
users = map (x: x.user or "''") contents;
|
||||
groups = map (x: x.group or "''") contents;
|
||||
|
||||
closureInfo = pkgs.closureInfo { rootPaths = [ config.system.build.toplevel channelSources ]; };
|
||||
closureInfo = pkgs.closureInfo {
|
||||
rootPaths = [ config.system.build.toplevel ] ++ (lib.optional copyChannel channelSources);
|
||||
};
|
||||
|
||||
blockSize = toString (4 * 1024); # ext4fs block size (not block device sector size)
|
||||
|
||||
|
@ -254,7 +262,9 @@ let format' = format; in let
|
|||
chmod 755 "$TMPDIR"
|
||||
echo "running nixos-install..."
|
||||
nixos-install --root $root --no-bootloader --no-root-passwd \
|
||||
--system ${config.system.build.toplevel} --channel ${channelSources} --substituters ""
|
||||
--system ${config.system.build.toplevel} \
|
||||
${if copyChannel then "--channel ${channelSources}" else "--no-channel-copy"} \
|
||||
--substituters ""
|
||||
|
||||
diskImage=nixos.raw
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue