mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-25 01:50:40 +00:00
Compare commits
1 Commits
devShellTo
...
make-disk-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc39343438 |
@@ -162,6 +162,12 @@ To solve this, you can run `fdisk -l $image` and generate `dd if=$image of=$imag
|
|||||||
# `installBootLoader` and `configFile`.
|
# `installBootLoader` and `configFile`.
|
||||||
onlyNixStore ? false
|
onlyNixStore ? false
|
||||||
|
|
||||||
|
, # Ensure that no "new" Nix store is written to the root of the image
|
||||||
|
# by symlinking the host Nix store.
|
||||||
|
# This saves a lot of disk space if you don't need an isolated Nix store.
|
||||||
|
# Incompatible with `additionalPaths`
|
||||||
|
noNixStore ? true
|
||||||
|
|
||||||
, name ? "nixos-disk-image"
|
, name ? "nixos-disk-image"
|
||||||
|
|
||||||
, # Disk image format, one of qcow2, qcow2-compressed, vdi, vpc, raw.
|
, # Disk image format, one of qcow2, qcow2-compressed, vdi, vpc, raw.
|
||||||
@@ -200,6 +206,7 @@ assert (lib.assertMsg (partitionTableType != "none" -> fsType == "ext4") "to pro
|
|||||||
assert (lib.assertMsg (touchEFIVars -> partitionTableType == "hybrid" || partitionTableType == "efi" || partitionTableType == "legacy+gpt") "EFI variables can be used only with a partition table of type: hybrid, efi or legacy+gpt.");
|
assert (lib.assertMsg (touchEFIVars -> partitionTableType == "hybrid" || partitionTableType == "efi" || partitionTableType == "legacy+gpt") "EFI variables can be used only with a partition table of type: hybrid, efi or legacy+gpt.");
|
||||||
# If only Nix store image, then: contents must be empty, configFile must be unset, and we should no install bootloader.
|
# If only Nix store image, then: contents must be empty, configFile must be unset, and we should no install bootloader.
|
||||||
assert (lib.assertMsg (onlyNixStore -> contents == [] && configFile == null && !installBootLoader) "In a only Nix store image, the contents must be empty, no configuration must be provided and no bootloader should be installed.");
|
assert (lib.assertMsg (onlyNixStore -> contents == [] && configFile == null && !installBootLoader) "In a only Nix store image, the contents must be empty, no configuration must be provided and no bootloader should be installed.");
|
||||||
|
assert (lib.assertMsg (noNixStore -> additionalPaths == []) "Without a Nix store in the rootfs, additional paths cannot be copied otherwise you would end up again with a Nix store.");
|
||||||
# Either both or none of {user,group} need to be set
|
# Either both or none of {user,group} need to be set
|
||||||
assert (lib.assertMsg (lib.all
|
assert (lib.assertMsg (lib.all
|
||||||
(attrs: ((attrs.user or null) == null)
|
(attrs: ((attrs.user or null) == null)
|
||||||
@@ -422,6 +429,15 @@ let format' = format; in let
|
|||||||
export NIX_STATE_DIR=$TMPDIR/state
|
export NIX_STATE_DIR=$TMPDIR/state
|
||||||
nix-store --load-db < ${closureInfo}/registration
|
nix-store --load-db < ${closureInfo}/registration
|
||||||
|
|
||||||
|
${optionalString noNixStore ''
|
||||||
|
# Ensure host Nix store is available so that `nixos-install` performs
|
||||||
|
# no extra operations.
|
||||||
|
mkdir -p $root/nix
|
||||||
|
# TODO: this needs to be made persistent or you need to run the nixos-install inside the namespace.
|
||||||
|
# then, we need to unmount.
|
||||||
|
unshare --mount --map-root-user mount --rbind ${builtins.storeDir} $root/nix
|
||||||
|
''}
|
||||||
|
|
||||||
chmod 755 "$TMPDIR"
|
chmod 755 "$TMPDIR"
|
||||||
echo "running nixos-install..."
|
echo "running nixos-install..."
|
||||||
nixos-install --root $root --no-bootloader --no-root-passwd \
|
nixos-install --root $root --no-bootloader --no-root-passwd \
|
||||||
|
|||||||
Reference in New Issue
Block a user