Git Product home page Git Product logo

nixos-generators's Introduction

nixos-generators - one config, multiple formats

The nixos-generators project allows to take the same NixOS configuration, and generate outputs for different target formats.

Just put your stuff into the configuration.nix and then call one of the image builders.

For example:

nixos-generate -f iso

or

nixos-generate -f iso -c /etc/nixos/configuration.nix

it echoes the path to a iso image, which you then can flash onto an usb-stick or mount & boot in a virtual machine.

Installation

nixos-generators is part of nixpkgs and can be installed from there.

nixos-generators can be also installed from source into the user profile like this:

nix-env -f https://github.com/nix-community/nixos-generators/archive/master.tar.gz -i

or for flakes users like this:

nix profile install github:nix-community/nixos-generators

or run from the nix flake without installing:

nix run github:nix-community/nixos-generators -- --help

Supported formats

format description
amazon Amazon EC2 image
azure Microsoft azure image (Generation 1 / VHD)
cloudstack qcow2 image for cloudstack
do Digital Ocean image
docker Docker image (uses systemd to run, probably only works in podman)
gce Google Compute image
hyperv Hyper-V Image (Generation 2 / VHDX)
install-iso Installer ISO
install-iso-hyperv Installer ISO with enabled hyper-v support
iso ISO
kexec kexec tarball (extract to / and run /kexec_nixos)
kexec-bundle same as before, but it's just an executable
kubevirt KubeVirt image
linode Linode image
lxc create a tarball which is importable as an lxc container, use together with lxc-metadata
lxc-metadata the necessary metadata for the lxc image to start, usage: lxc image import $(nixos-generate -f lxc-metadata) $(nixos-generate -f lxc)
openstack qcow2 image for openstack
proxmox VMA file for proxmox
proxmox-lxc LXC template for proxmox
qcow qcow2 image
qcow-efi qcow2 image with efi support
raw raw image with bios/mbr. for physical hardware, see the 'raw and raw-efi' section
raw-efi raw image with efi support. for physical hardware, see the 'raw and raw-efi' section
sd-aarch64 Like sd-aarch64-installer, but does not use default installer image config.
sd-aarch64-installer create an installer sd card for aarch64. For cross compiling use --system aarch64-linux and read the cross-compile section.
vagrant-virtualbox VirtualBox image for Vagrant
virtualbox virtualbox VM
vm only used as a qemu-kvm runner
vm-bootloader same as vm, but uses a real bootloader instead of netbooting
vm-nogui same as vm, but without a GUI
vmware VMWare image (VMDK)

Usage

Run nixos-generate --help for detailed usage information.

select a specific nixpkgs channel

Adds ability to select a specific channel version.

Example:

nix-shell --command './nixos-generate -f iso -I nixpkgs=channel:nixos-19.09'

Using a particular nixpkgs

To use features found in a different nixpkgs (for instance the Digital Ocean image was recently merged in nixpkgs):

NIX_PATH=nixpkgs=../nixpkgs nixos-generate -f do

Setting the disk image size

To specify the size of the generated disk image, use the --disk-size argument, specifying the size in megabytes. This is currently supported by the following formats. If this argument is unspecified it defaults to automatic sizing based on the generated NixOS build.

  • hyperv
  • proxmox
  • qcow
  • raw-efi
  • raw
  • vm
  • vm-nogui
  • vmware

Example (20GB disk):

nixos-generate -c <your_config.nix> -f <format> --disk-size 20480

To set the disk size in flake.nix, set diskSize in the specialArgs argument of the nixosGenerate function.

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
    nixos-generators = {
      url = "github:nix-community/nixos-generators";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    xc = {
      url = "github:joerdav/xc";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { nixpkgs, nixos-generators, xc, ... }:
    let
      pkgsForSystem = system: import nixpkgs {
        inherit system;
        overlays = [
          (final: prev: { xc = xc.packages.${system}.xc; })
        ];
      };
      allVMs = [ "x86_64-linux" "aarch64-linux" ];
      forAllVMs = f: nixpkgs.lib.genAttrs allVMs (system: f {
        inherit system;
        pkgs = pkgsForSystem system;
      });
    in
    {
      packages = forAllVMs ({ system, pkgs }: {
        vm = nixos-generators.nixosGenerate {
          system = system;
          specialArgs = {
            pkgs = pkgs;
            diskSize = 20 * 1024;
          };
          modules = [
            # Pin nixpkgs to the flake input, so that the packages installed
            # come from the flake inputs.nixpkgs.url.
            ({ ... }: { nix.registry.nixpkgs.flake = nixpkgs; })
            # Apply the rest of the config.
            ./configuration.nix
          ];
          format = "raw";
        };
      });
    };
}

Cross Compiling

To cross compile nixos images for other architectures you have to configure boot.binfmt.emulatedSystems or boot.binfmt.registrations on your host system.

In your system configuration.nix:

{
  # Enable binfmt emulation of aarch64-linux.
  boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
}

Alternatively, if you want to target other architectures:

# Define qemu-arm-static source.
let qemu-arm-static = pkgs.stdenv.mkDerivation {
  name = "qemu-arm-static";
  src = builtins.fetchurl {
    url = "https://github.com/multiarch/qemu-user-static/releases/download/v6.1.0-8/qemu-arm-static";
    sha256 = "06344d77d4f08b3e1b26ff440cb115179c63ca8047afb978602d7922a51231e3";
  };
  dontUnpack = true;
  installPhase = "install -D -m 0755 $src $out/bin/qemu-arm-static";
};
in {
  # Enable binfmt emulation of extra binary formats (armv7l-linux, for exmaple).
  boot.binfmt.registrations.arm = {
    interpreter = "${qemu-arm-static}/bin/qemu-arm-static";
    magicOrExtension = ''\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00'';
    mask = ''\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\x00\xff\xfe\xff\xff\xff'';
  };

  # Define additional settings for nix.
  nix.extraOptions = ''
    extra-platforms = armv7l-linux
  '';
  nix.sandboxPaths = [ "/run/binfmt/arm=${qemu-arm-static}/bin/qemu-arm-static" ];
}

For more details on configuring binfmt, have a look at: binfmt options, binfmt.nix, this comment and clevers qemu-user.

Once you've run nixos-rebuild with these options, you can use the --system option to create images for other architectures.

Using as a nixos-module

nixos-generators can be included as a NixOS module into your existing configuration.nix making all available formats available through config.formats and configurable through config.formatConfigs. New formats can be defined by adding a new entry like config.formatConfigs.my-new-format = {config, ...}: {}.

An example flake.nix demonstrating this approach is below.

Images can be built from that flake by running:

  • nix build .#nixosConfigurations.my-machine.config.formats.vmware or
  • nix build .#nixosConfigurations.my-machine.config.formats.my-custom-format or
  • nix build .#nixosConfigurations.my-machine.config.formats.<any-other-format>
{
  inputs = {
    nixpkgs.url = "nixpkgs/nixos-unstable";
    nixos-generators = {
      url = "github:nix-community/nixos-generators";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };
  outputs = { self, nixpkgs, nixos-generators, ... }: {

    # A single nixos config outputting multiple formats.
    # Alternatively put this in a configuration.nix.
    nixosModules.my-machine = { config, ... }: {
      imports = [
        nixos-generators.nixosModules.all-formats
      ];

      nixpkgs.hostPlatform = "x86_64-linux";

      # customize an existing format
      formatConfigs.vmware = { config, ... }: {
        services.openssh.enable = true;
      };

      # define a new format
      formatConfigs.my-custom-format = { config, modulesPath, ... }: {
        imports = [ "${toString modulesPath}/installer/cd-dvd/installation-cd-base.nix" ];
        formatAttr = "isoImage";
        fileExtension = ".iso";
        networking.wireless.networks = {
          # ...
        };
      };

      # the evaluated machine
      nixosConfigurations.my-machine = nixpkgs.lib.nixosSystem {
        modules = [ self.nixosModules.my-machine ];
      };
    };
  };
}

Using in a Flake

nixos-generators can be included as a Flake input and provides a nixosGenerate function for building images as Flake outputs. This approach pins all dependencies and allows for conveniently defining multiple output types based on one config.

An example flake.nix demonstrating this approach is below. vmware or virtualbox images can be built from the same configuration.nix by running nix build .#vmware or nix build .#virtualbox

Custom formats can be defined by building a format module (see the formats directory for examples) and passing it to nixosGenerate via an the customFormats argument. customFormats should be in the form of an attribute sets of the form <format name> = <format module> and can define multiple custom formats. nixosGenerate will then match against these custom formats as well as the built in ones.

{
  inputs = {
    nixpkgs.url = "nixpkgs/nixos-unstable";
    nixos-generators = {
      url = "github:nix-community/nixos-generators";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };
  outputs = { self, nixpkgs, nixos-generators, ... }: {
    packages.x86_64-linux = {
      vmware = nixos-generators.nixosGenerate {
        system = "x86_64-linux";
        modules = [
          # you can include your own nixos configuration here, i.e.
          # ./configuration.nix
        ];
        format = "vmware";
        
        # optional arguments:
        # explicit nixpkgs and lib:
        # pkgs = nixpkgs.legacyPackages.x86_64-linux;
        # lib = nixpkgs.legacyPackages.x86_64-linux.lib;
        # additional arguments to pass to modules:
        # specialArgs = { myExtraArg = "foobar"; };
        
        # you can also define your own custom formats
        # customFormats = { "myFormat" = <myFormatModule>; ... };
        # format = "myFormat";
      };
      vbox = nixos-generators.nixosGenerate {
        system = "x86_64-linux";
        format = "virtualbox";
      };
    };
  };
}

Format-specific notes

raw and raw-efi

raw and raw-efi images can be used on physical hardware, but benefit from some tweaks.

  • These images are configured to log to the serial console, and not to your display. One workaround for this is to add boot.kernelParams = [ "console=tty0" ]; to your configuration, which will override the image's default console=ttyS0.
  • By default, grub will timeout after 1 second. To extend this, set boot.loader.timeout = 5; (or longer)
  • If boot fails for some reason, you will not get a recovery shell unless the root user is enabled, which you can do by setting a password for them (users.users.root.password = "something";, possibly users.mutableUsers = true; so you can interactively change the passwords after boot)
  • After booting, if you intend to use nixos-switch, consider using nixos-generate-config.

License

This project is licensed under the MIT License.

FAQ

No space left on device

This means either /tmp, /run/user/$UID or your TMPFS runs full. Sometimes setting TMPDIR to some other location can help, sometimes /tmp needs to be on a bigger partition (not a tmpfs).

nixos-generators's People

Contributors

a-h avatar alan-strohm avatar blaggacao avatar bors[bot] avatar collindewey avatar davhau avatar davidak avatar dependabot[bot] avatar dfrankland avatar evanjs avatar farcaller avatar foo-dogsquared avatar github-actions[bot] avatar illustris avatar jd91mzm2 avatar lassulus avatar macxylo avatar mayl avatar mic92 avatar mkg20001 avatar mrvandalo avatar n8henrie avatar pacman99 avatar pveierland avatar thpham avatar tomeon avatar tylerjl avatar vivlim avatar yanganto avatar zimbatm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nixos-generators's Issues

The error when nonexistent name is passed to -f is not helpful

$ result/bin/nixos-generate -I nixpkgs=channel:nixos-unstable -c configuration.nix -f qcow2
warning: Nix search path entry '/nix/store/928qba68lw06k6vxpk41lhpbxvy8x4zh-nixos-generators/share/nixos-generator/formats/qcow2.nix' does not exist, ignoring
error: file 'format-config' was not found in the Nix search path (add it using $NIX_PATH or -I), at /nix/store/928qba68lw06k6vxpk41lhpbxvy8x4zh-nixos-generators/share/nixos-generator/nixos-generate.nix:3:19
(use '--show-trace' to show detailed location information)

The correct argument would have been qcow instead of qcow2

Make this project a module system?

Often my use case is to generate something that is a mixture of different formats available in this project. One example:
I currently want to create a usb stick with a base nixos system to use as a target for nixops.
Therefore formats raw or raw-efi wuild be suitable.
Since I do not know the size of my usb stick yet, I want the root partition to automatically enlarge itself on first boot which is a feature only of the sdimage-aarch64 format. But i don't use aarch64.

It's currently not possible to merge different formats without inheriting lots of unnecessary stuff or getting conflicts.

Wouldn't it be better to make this project a module system? It could have config options like:

  • resizeRootFS = true
  • output-format = raw
  • system = aarch64-linux

...or something like this.
This would allow more granular configuration. At the same time the tool could still provide default configurations for these options equivalent to the current formats.

Any thoughts about this?

Override disk image size and squashfs compression

I'm building a fairly large image for testing in VM and run into some issues:

The qcow and raw formats fail with the error below, probably because the disk size is hard-coded

copying path '/nix/store/c7zffvkqmyapgj9m9skdhhci2qjw0v9j-nixos-system-nixos-20.09pre226148.0f5ce2fac0c' to 'local'...
copying channel...
preallocating file of 470627 bytes: No space left on device
error: path '/nix/store/ygkxj7psmiril30n0a9qawydkk05gy61-nixos-20.09pre226148.0f5ce2fac0c' does not exist and cannot be created
builder for '/nix/store/wjgcnaj420djrpcl5sb51ralqa9g6iiy-nixos-disk-image.drv' failed with exit code 1
note: build failure may have been caused by lack of free disk space
error: build of '/nix/store/wjgcnaj420djrpcl5sb51ralqa9g6iiy-nixos-disk-image.drv' failed

The iso image works, but the squashfs command takes very long.

New release

There hasn't been a new release for quite some time

fsType conflict definition

When I ran the command nixos-generate -f openstack -c configuration.nix I have the following error:

error: The option `fileSystems./.fsType' has conflicting definition values:
- In `/nix/store/pnnffbr69z7p33p39bpyvn8xnc4v63ls-nixos-generators/share/nixos-generator/formats/raw.nix': "ext4"
- In `/nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/m

Inside my configuration.nix I had the following line:

imports = [ <nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix> ];

Which seems to be the root cause of the issue. Will it be safe to remove it?

Note that I had the same issue with qcow and raw.
Since I am new to nixos I do not know if it's normal or not and how to bypass this issue.

sd-aarch64: option sdImage.populateBootCommands not defined

nixos-channel: 20.03

$ nixos-generate -f sd-aarch64 --system aarch64-linux
error: The option `sdImage.populateBootCommands' defined in `/nix/store/254w3dn239iv71yc3xyf6dvvl6vb09gm-nixos-generators-1.0.0/share/nixos-generator/formats/sd-aarch64.nix' does not exist.
(use '--show-trace' to show detailed location information)

"No space left on device" for basic gce build

I just tried doing a default gce format build, but got a weird error message:

$ nixos-generate --format gce
...
copying path '/nix/store/39j8x5yq0zzqly7wq0c9ydyhzn26bwgy-user-units' to 'local'...
copying path '/nix/store/261xr3gan4b9wc4klw78cnw7rjdj05ym-system-units' to 'local'...
copying path '/nix/store/aq468br023nfmy85vxv82k30l2cy8kq1-etc' to 'local'...
copying path '/nix/store/769rm215k6vip6ndvgwb01lbfwjkvkvw-nixos-system-unnamed-21.03pre244772.502845c3e31' to 'local'...
copying channel...
error: --- SysError --- nix-env
preallocating file of 4383 bytes: No space left on device
error: --- Error --- nix-env
path '/nix/store/z71jjw3cccpvdcwyngx8b9vhkii4rv09-nixos-21.03pre244772.502845c3e31' does not exist and cannot be created
builder for '/nix/store/plzvg9nc9nx89w5y7nrk0ys7rmyshlv4-google-compute-image.drv' failed with exit code 1
note: build failure may have been caused by lack of free disk space
error: build of '/nix/store/plzvg9nc9nx89w5y7nrk0ys7rmyshlv4-google-compute-image.drv' failed

I have plenty of space left on my hard drive, so I'm really not sure what this could possibly mean.

Here's the complete log: https://gist.github.com/samuela/c84b52e5ffb629312c2294c43477e1ba

What does this mean? How do I create a basic gce image?

LXC: Changes don't persist on restart

Whenever I make a change to an LXC container, either by manually editing /etc/nixos/configuration.nix or push changes from a config management tool like morph or nixops, the changes to the container don't persist if it gets restarted.

I generate an image from this config:

{ config, lib, pkgs, ... }:

{
  boot.isContainer = true;
}

I then change /etc/nixos/configuration.nix on the container to reflect the boot options and add a test:

{ config, pkgs, ... }:

{
  imports = [  ];
  boot.isContainer = true;
  environment.systemPackages = with pkgs; [ hello ];
  
}

After rebuilding the system, hello is found and I can run it. If I print the current generation I'm on...

[root@nixos:~]# hello
Hello, world!

[root@nixos:~]# nix-env --list-generations --profile /nix/var/nix/profiles/system
   1   2020-11-21 09:55:44   
   2   2020-11-21 10:03:18   
   3   2020-11-21 10:04:49   
   4   2020-11-21 10:12:04   
   5   2020-11-21 10:12:27   
   6   2020-11-21 10:30:44   (current)

... and then restart the container, not only will it revert back to the base config used to generate the image (and therefore hello will be gone), but it also creates another generation from the base config for some reason:

[root@nixos:~]# nix-env --list-generations --profile /nix/var/nix/profiles/system
   1   2020-11-21 09:55:44   
   2   2020-11-21 10:03:18   
   3   2020-11-21 10:04:49   
   4   2020-11-21 10:12:04   
   5   2020-11-21 10:12:27   
   6   2020-11-21 10:30:44   
   7   2020-11-21 10:32:46   (current)

Not sure if this is expected behavior or I'm not configuring something correctly, but I don't have this issue with containers for other OS images.

auto-installer ISO?

This project seems like a nice way to install custom images on cloud services that don't allow image uploads (like vultr).

It would be nice if we could:

  • make an ISO
  • upload it to the cloud provider
  • create a new VM with the ISO set as the boot drive
  • if the VM disk isn't bootable:
    • auto-install nixos by running a custom install script that does the partitioning etc (1)
  • boot the VM (2)

The steps I don't know how to do are:

  1. Run a script before booting the VM
  2. Boot the VM when the ISO is set as boot drive

Thoughts?

Can't build LXC with Flake

This is probably something to do with nixpkgs, but I figured I'd report here in case other folks are having the same issue or know work-arounds.

With a fresh install or using the nixos/nix Docker image, this always returns error: path '/nix/store/...-nixos-system-nixos-21.05.20210410.a73020b/init' is not in the Nix store

set -e;

nix-channel --list;
nix-channel --update;

nix-env -iA nixpkgs.git;
git init test;
cd ./test;
echo '
{
  description = "test";

  inputs = {
    nixpkgs = { url = "github:nixos/nixpkgs/nixos-unstable"; };
  };

  outputs = inputs @ { self, nixpkgs, ... }:
    let
      lib = nixpkgs.lib;
    in
    {
      nixosConfigurations = {
        test = lib.makeOverridable lib.nixosSystem {
          system = "x86_64-linux";
          modules = [];
        };
      };
    };
}
' > flake.nix;
git add .;

nix-env -iA nixpkgs.nixUnstable;
mkdir -p ~/.config/nix;
echo 'experimental-features = nix-command flakes' > ~/.config/nix/nix.conf;

nix-env -if https://github.com/nix-community/nixos-generators/archive/master.tar.gz;
nixos-generate -f lxc --flake './#test'

Make output less verbose by default

It should not output anything except the image path when no error happen by default. You can introduce a verbose flag for the current output.

Then we can pipe the output (image path) to something else and build some workflow.

(it's also a problem with nixos-rebuild and other official tools and should be fixed upstream if possible)

Use meaningful name for image file

It should include:

  • nixos
  • version (including commit id)
  • image format
  • ?

So you know what it is when you have just the image file!

See for example the official installer image name: nixos-graphical-19.03.173375.e02148563af-x86_64-linux.iso

Source: https://releases.nixos.org/nixos/19.03/nixos-19.03.173375.e02148563af

Current behavior:

$ for format in $(nixos-generate --list); do echo -n "$format: " ; nixos-generate -f $format; done
azure: /nix/store/9r98x8vjqhghbslp3aljsi08lcbx18rh-azure-image/disk.vhd
cloudstack: /nix/store/9li2w85xj53glzh8sxc3d4xi6cfyhz78-nixos-disk-image/nixos.qcow2
gce: /nix/store/yl90g8jabagp0jmnabl9pcpraj48a2cn-google-compute-image/nixos-image-19.03.173202.31d476b8797-x86_64-linux.raw.tar.gz
install-iso: /nix/store/0l8k0pijgxl9s3gky69qi01xx8nd8vlp-nixos-19.03.173202.31d476b8797-x86_64-linux.isonixos.iso/iso/nixos-19.03.173202.31d476b8797-x86_64-linux.isonixos.iso
iso: /nix/store/2vcykhq3d4gwjm3q0gfsg8hlwkcv0kr7-nixos.iso/iso/nixos.iso
kexec-bundle: /nix/store/fv2kb1avfj4vz5j341jv90cs821lb57d-kexec_bundle
kexec: /nix/store/9yk2d822iszn9mb8zgx8112zbb70chcr-tarball/tarball/nixos-system-x86_64-linux.tar.xz
openstack: /nix/store/35ha7hd437y08q410n4fip00mad03lra-nixos-disk-image/nixos.qcow2
qcow: /nix/store/7bchmgnd3nxx3kzxn5nnwl6yn1jbkgb0-nixos-disk-image/nixos.qcow2
raw: /nix/store/pnp1zndrzcfqn8j6ifylkijk1q4kig48-nixos-disk-image/nixos.img
sd-aarch64-installer: error: refusing to evaluate.
sd-aarch64: error: refusing to evaluate.
virtualbox: /nix/store/v2wnwgzvv1ykgf4cixar5z1hih4a8sa9-nixos-ova-19.03.173202.31d476b8797-x86_64-linux/nixos-19.03.173202.31d476b8797-x86_64-linux.ova
vm: vm-nogui: 

UEFI/BIOS Image

Heya, it would be fantastic if nixos-generator could generate a basic image similar to sd-aarch64 but to directly dd onto a hard drive.
I tried writing a RAW image onto an usb-stick but it does not seem to work, couldn't check out virtualbox because virtualboxguest is broken again.

Mount local /nix/store optionally in LXC

I want to run thousands of instances of the same LXC image.

The /nix/store is always 551MB even tho its basically just:

  services = {
    openssh.enable = true;
    dnsmasq.enable = true;
    nginx.enable = true;
  };

To deduplicate the used storage, i want to mount the hosts /nix/store into the container like NixOS containers do.

How can i achieve that and can it become an option?

I got the hint to add this to container config in NixOS/nixpkgs#88955 (comment) but it has no effect,

lxc.mount.entry = /nix/store nix/store none defaults,bind.ro 0.0

I added it in metadata.yaml as

raw: lxc.mount.entry = /nix/store nix/store none defaults,bind.ro 0 0.

"Unsupported compression" when importing nixos-generate generated metadata in lxc

I tried to play around a little bit with the new lxc image on an Ubuntu 19.04 installation with nix 2.3. But I'm unable to import the image.

vm@vm:~$ lxc image import $(nixos-generate -f lxc-metadata) $(nixos-generate -f lxc)
Error: detectCompression failed, err='Unsupported compression', tarfile='/var/snap/lxd/common/lxd/images/lxd_build_654202587/lxd_tar_425079749'
root@vm:/home/vm# cat /var/snap/lxd/common/lxd/logs/lxd.log | grep compression
t=2019-09-10T21:00:25+0200 lvl=eror msg="Failed to get image metadata" err="detectCompression failed, err='Unsupported compression', tarfile='/var/snap/lxd/common/lxd/images/lxd_build_087986735/lxd_tar_237888569'" function=getImgPostInfo

Seems that the metadata compression could not be detected: https://github.com/lxc/lxd/blob/lxd-3.17/shared/archive_linux.go#L55

A 'x86_64-linux' with features {kvm} is required to build...

I have a basic config.nix as follow:

{ config, pkgs, ... }:

{
  boot.kernelModules = [ "kvm-amd" "kvm-intel" ];

  environment.systemPackages = with pkgs; [
    cloud-init
    iptables
    qemu

    docker_18_09
  ];

  users.users.root.password = "nixos";

  services = {
    xserver = {
      videoDrivers = [ "qxl" ];
    };

    qemuGuest = {
      enable = true;
    };

    cloud-init = {
      enable = true;
    };

    openssh = {
        enable = true;
    };
  };
}

And when I run nixos-generate -f qcow -c configuration.nix I have the following error:

error: a 'x86_64-linux' with features {kvm} is required to build '/nix/store/8lv9iwhsn0jpxcirnq1kgbagvvvk5m2x-nixos-disk-image.drv', but I am a 'x86_64-linux' with features {benchmark, big-parallel, nixos-test}

I am using nixos/nix docker to build the os if it matters.
Any help would be appreciated :)

PS: My goal is to make a qcow image with ssh, cloud-init, docker and qemu-agent to be used with proxmox.

Note -c requires absolute path

I tried using -c with a relative path and it didn't work:

$ ./nixos-generate  -f install-iso -c configuration.nix                                                                       |                                                                                                                                                              
error: undefined variable 'configuration' at (string):1:1

An absolute path works:

$ ./nixos-generate  -f install-iso -c /home/ryantm/p/nixos-generators/configuration.nix 

QEMU errors with 'Duplicate ID 'user.0' for netdev'

When running nixos-generate -f vm --run or nixos-generate -f vm-bootloader --run I get the following error:

qemu-system-x86_64: -netdev user,id=user.0,hostfwd=tcp::8088-:80,hostfwd=tcp::8022-:22: Duplicate ID 'user.0' for netdev

After some trial and error, I was able to get it working by creating a custom format identical to formats/vm.nix, but without the virtualisation.qemu.networkingOptions key. I believe this is because the options specified in the format collide with those passed to QEMU in the generated run-nixos-vm script which nixos-generate uses to run the VM.

`nixos-rebuild` ready image

Hello. I'm trying to create an image (currently for Raspberry Pi 3) where its configuration is copied to it and one can use nixos-rebuild out of the box.
Here is my setup https://gitlab.com/grawp/nixos-raspberry-experiment

Image-building-only related configuration should be inside sd-aarch64-custom.nix while general configuration (which may also be used during image building) should be in nixos/configuration.nix. But I failed somewhere because when I boot a freshly built image on a Raspberry and then run nixos-rebuild switch without any configuration changes, it still tries to download and rebuild derivations galore (and it works OK but that's not the point).

Here I explicitly disconnected internet from the raspberry before executing the nixos-rebuild switch to better visualize what it tried downloading: https://gist.github.com/Grawp/daeb4106a3d9086a70e3c5608c83c782

I want to get to a state where a nixos-generators built system is the same system as the one after running nixos-rebuild switch. In other word I want a system where running first nixos-rebuild switch without changing configuration produce 0 changes.
Any ideas what can be the problem in my setup?

RPi zero/1/2 support?

Is it possible to build RPi 0/1/2 images with this tool at the moment? I can only see a reference to RPi 3 devices at present.

Upstream virtualization fix sprint

I've noticed that some upstream modules under nixos/modules/virtualisation are actually in pretty bad shape.

To gather and coordinate a fixing sprint, I've just setup https://matrix.to/#/!LhhFDmfZUkcXRvvvxM:matrix.org?via=matrix.org&via=nordgedanken.dev

Please join if you're interested.

I open this issue here, since I assume several users of nixos-generators have vested interests in the possible outcomes of this.

@Lassulus It would be really amazing if we could somehow team up to push this agenda. (together with other stranded devos users)

Mount host `/nix/store` as guest's store

I recently heard of nixos-generators, and Iย tried to use it to build images that are meant to be ran exclusively on the host building them.

So far, I could not get any result trying to use -f qcow, as I always reach a no space left on device error after hours of building (similar to - and maybe related to - #73)...

When using nixos-rebuild build-vm, the resulting image (and related VM startup script) seems to mount the host's /nix/store (as read-only) as the store for the guest.
Is there something similar that could be achieved here?
As my guest will run exclusively on my host, there is no point "duplicating" the store, or building packages that are already present on the host: This could save both time and space.

Cheers,

Format raw/qcow autoResize not supported for fsType auto

Hi,

Firstly thank you for creating this repo, it's incredibly useful!

I'm running into an issue where calling either nixos-generate -f raw or nixos-generate -f qcow result in the following error:

error:
Failed assertions:
- Mountpoint '/': 'autoResize = true' is not supported for 'fsType = "auto"': fsType has to be explicitly set and only the ext filesystems and f2fs support it.
(use '--show-trace' to show detailed location information)

Is there anyway I could fix this?

sd-aarch64(-installer) fails for channels newer than 20.03

Error:
builder for '/nix/store/aixbwq9xqwy5b52dmfxj2983b8lvyqa8-ext4-fs.img.zst.drv' failed with exit code 1; last 10 log lines:
ERROR: ld.so: object '/nix/store/mpcfc780k9wr50dgvvlq0krnq68c2waz-libfaketime-0.9.8/lib/libfaketime.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

Not sure if this is related to post 20.03 changes in make-ext4-fs

Or maybe libfaketime is broken.

Note jq dependency or add nix-shell shebang

The script depends on jq

$ ./nixos-generate  -f install-iso                                                                                       |                                                                                                                                                              
./nixos-generate: line 104: jq: command not found  

I got around this by doing

nix-shell -p jq

It would be nice to note this dependency in the readme, or use a nix-shell shebang to automatically make jq available tot he script.

cd-dvd/sd-image.nix is deprecated

I'm compiling some images for an rPi, and came across a warning that installer/cd-dvd/sd-image.nix is deprecated. I believe all that needs to be done is to swap out cd-dvd with sd-card in formats/sd-aarch64.nix and formats/sd-aarch64-installer.nix`, pseudo-patch below:

  imports = [
-  "${toString modulesPath}/installer/cd-dvd/sd-image.nix
+  "${toString modulesPath}/installer/sd-card/sd-image.nix
  ];

I'm not at all familiar with this project and only slightly experienced with Nix, so I'm not sure if the above would break things. As it stands, though, it does look like installer/cd-dvd/sd-image.nix is deprecated and needs to be moved away from. Thanks!

Building aarch64 installer fails due to Exec format Error

I am running the following command:

nixos-generate -f sd-aarch64-installer --system aarch64-linux -c sd-card.nix -I nixpkgs=$(pwd)/nixpkgs

I made sure to set boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; in my nixos configuration and successfully ran nixos-rebuild switch.

But I get the following error when trying to generate the sd-aarch64-installer:

while setting up the build environment: executing '/nix/store/qap2krb706ia4czm89xzmlqj72wysf5h-bash-4.4-p23/bin/bash': Exec format error
while setting up the build environment: executing '/nix/store/qap2krb706ia4czm89xzmlqj72wysf5h-bash-4.4-p23/bin/bash': Exec format error
while setting up the build environment: executing '/nix/store/qap2krb706ia4czm89xzmlqj72wysf5h-bash-4.4-p23/bin/bash': Exec format error
while setting up the build environment: executing '/nix/store/qap2krb706ia4czm89xzmlqj72wysf5h-bash-4.4-p23/bin/bash': Exec format error
while setting up the build environment: executing '/nix/store/qap2krb706ia4czm89xzmlqj72wysf5h-bash-4.4-p23/bin/bash': Exec format error
while setting up the build environment: executing '/nix/store/qap2krb706ia4czm89xzmlqj72wysf5h-bash-4.4-p23/bin/bash': Exec format error
while setting up the build environment: executing '/nix/store/qap2krb706ia4czm89xzmlqj72wysf5h-bash-4.4-p23/bin/bash': Exec format error
while setting up the build environment: executing '/nix/store/qap2krb706ia4czm89xzmlqj72wysf5h-bash-4.4-p23/bin/bash': Exec format error
while setting up the build environment: executing '/nix/store/qap2krb706ia4czm89xzmlqj72wysf5h-bash-4.4-p23/bin/bash': Exec format error
copying path '/nix/store/qlxmgca1c2xy4qq3h7sv62syh406pla9-cryptsetup-2.1.0' from 'https://cache.nixos.org'...
builder for '/nix/store/alsgzjpik8pfxgd34s5bk31fvp16c5bj-append-initrd-secrets.drv' failed with exit code 1
builder for '/nix/store/sjb884crp8xipmly6kw8fqcvflx6mx4f-builder.pl.drv' failed with exit code 1
builder for '/nix/store/q1mg6czzm8mvibb3xqm39p3hiq2q4d4b-client.conf.drv' failed with exit code 1
builder for '/nix/store/67hil69msf2yx9xp345mszyvn7gznk7g-command-not-found.drv' failed with exit code 1
builder for '/nix/store/a2rw7yfgbmdk67gk0s3x4j4bjp2zgvvn-config.txt.drv' failed with exit code 1
builder for '/nix/store/0i209vkp27iwvbaqasv278x2155iybds-dhcpcd.exit-hook.drv' failed with exit code 1
builder for '/nix/store/gcwd8xrcqz8k0glrlbikg6hzhbi4yi4n-extlinux-conf-builder.sh.drv' failed with exit code 1
builder for '/nix/store/x4ajp7m99z5akizm38szd5wp5zzd3gfk-mounts.sh.drv' failed with exit code 1
builder for '/nix/store/yvfjyhnnr3zpj39pyka7p5qr5szkl7kb-users-groups.json.drv' failed with exit code 1
cannot build derivation '/nix/store/9ykzzjwml9gg55d8frb63wjv9ihh9glq-nixos-sd-image-20.09pre-git-aarch64-linux.img.drv': 1 dependencies couldn't be built
error: build of '/nix/store/9ykzzjwml9gg55d8frb63wjv9ihh9glq-nixos-sd-image-20.09pre-git-aarch64-linux.img.drv' failed

"format-module.nix" not installed

It seems nixos-generate expects a file called format-module.nix to be in ${storepath}/share/nixos-generator/format-module.nix which is not there:

โžœ nix-shell -p "(import (builtins.fetchTarball https://github.com/nix-community/nixos-generators/archive/master.tar.gz))" --run "nixos-generate -f iso --show-trace"
error: while evaluating 'evalModules' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:63:17, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/lib/eval-config.nix:58:12:
while evaluating 'mapAttrsRecursiveCond' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:293:36, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:140:28:
while evaluating 'recurse' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:295:23, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:303:8:
while evaluating the attribute 'matchedOptions' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:427:14:
while evaluating 'flip' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/trivial.nix:138:16, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:395:23:
while evaluating 'byName' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:364:25, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:383:21:
while evaluating 'reverseList' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:393:17, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:132:33:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:253:37, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:128:25:
while evaluating 'filterModules' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:243:36, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:254:7:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:247:31, called from undefined position:
while evaluating 'loadModule' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:189:53, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:230:22:
while evaluating 'isFunction' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/trivial.nix:342:16, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:190:12:
getting status of '/nix/store/2mv2af24nqlbr1lzh7ydf34f74hbrc19-nixos-generators/share/nixos-generator/format-module.nix': No such file or directory

Am I missing something here or is the current master broken? Is this an issue with 21.03? I also tried installing into the env like described in the readme but that has the same effect (as expected)

`nix run nixpkgs.nix-info` don't work in generated ISO

[root@targets-host:~]# nix run nixpkgs.nix-info -c nix-info -m
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)

[root@targets-host:~]# nix-channel --list
nixos https://nixos.org/channels/nixos-19.03

Adding virtio kernel modules to initrd for qcow format

TLDR; might be good to add some extra initrd kernel headers to the qcow format to support their use as virtio disks (sample config below).

I'm playing with terraform-provider-libvirt, and building a config based on their ubuntu-example.tf, which maps a qcow image to a libvirt volume, and adds that volume to the VM config as a virtio disk. This was giving me trouble (VM wasn't able to find the disk /dev/disk/by-label/nixos during boot), but I didn't have any issues creating a VM w/ Virt Manager, whose wizard maps the disk to an IDE port instead.

After searching around, I saw a virtualization page on the NixOS wiki with a section on building a base image that mentioned adding some headers to support virtio. After copying those headers into a config and regenerating the image I was finally able to boot with it mapped as a virtio disk. Throwing my config below in case it helps anyone else, or if you'd want to add these options into the qcow format by default (they didn't seem to hurt booting w/ the qcow attached as IDE).

To get this working, drop the following into configuration.nix, and then run nixos-generate --format qcow --configuration ./configuration.nix:

{ config, lib, pkgs, ... }:
{
  # Add these modules 
  boot.initrd.availableKernelModules = [
    "xhci_pci"
    "ehci_pci"
    "ahci"
    "usbhid"
    "usb_storage"
    "sd_mod"
    "virtio_balloon"
    "virtio_blk"
    "virtio_pci"
    "virtio_ring"
  ];

  # Convenience things
  services.sshd.enable = true;

  # Enable cloud-init (not necessary to get volume to boot, but see mention of terraform-provider-libvirt above that uses this).
  services.cloud-init = {
    enable = true;
    ext4.enable = true;
  };
}

Start porting pieces to nixpks

In the long run this repository probably should be integrated into nixpkgs.

  • competing and complementary source of truth
  • nixpkgs' nixos/modules/installer machinery could welcome some polishing (by all means , "installer" seems as an add on to image generators just as this repository corrrectly interprets)
  • see also how nixos/modules/installer/netboot is not actually an "installer"

Additional context:
https://discourse.nixos.org/t/sd-images-are-they-really-installation-devices/11190/7?u=blaggacao

Error: bad value ('armv8-a') for '-march=' switch

Hey y'all! I'm running Flakes on NixOS WSL, and want to compile to my RPi 4 (sd-aarch64). Regrettable, after running nixos-generate -f sd-aarch64, I get the following error:

error: bad value ('armv8-a') for '-march=' switch
I've attached the full output for more details.
these derivations will be built:
  /nix/store/1d0894dgwbfdwss6ss4sgknfivf8xjrr-nixos-help.drv
  /nix/store/hvznlp1b652rxdqdc7w4nkpxhjakqsaz-nixos-container.drv
  /nix/store/mgfhy3da62r6clh2lw4r0p5vy6kvzprz-nixos-install.drv
  /nix/store/sj4ngb0j4m06q0wv6j8dyb297w1ljm6i-nixos-rebuild.drv
  /nix/store/vj89x5hhysf7kcqgj9dik228rqz13nck-nixos-version.drv
  /nix/store/dvzw86ysf66734qykchsnqrpm85h2l1x-system-path.drv
  /nix/store/066n5z2s93n2prp755n4gy6dzvfm20lx-dbus-1.drv
  /nix/store/1if6l2ppdi94ax0bsivdz84lxkikj6cj-set-environment.drv
  /nix/store/0w1k07b3s6vb7xhkm0b0zv9lvzb6wf3q-etc-profile.drv
  /nix/store/1660wdk9vhnxbvx4cfxkkz23l23rh4n1-extra-udev-rules.drv
  /nix/store/6ryfm94dvccg4hk58zah6vmbsyb8m2c0-ipv6-privacy-extensions.rules.drv
  /nix/store/bb5p4s9lax7hsfkdl08xfjcgxzm2qhvy-ipv6-privacy-extensions.rules.drv
  /nix/store/gxkxr1crwhks5mg773pa17x4ksgw6dy4-extra-hwdb-file.drv
  /nix/store/i8h6mh4srw18jb6hqj5y15x1zlhblv8v-udev-path.drv
  /nix/store/10j36pjfm57nw0jjra9d74022cxanrw4-udev-rules.drv
  /nix/store/1chw1acxbdw727xc3qvafhvw08b3qv5k-unit-systemd-user-sessions.service.drv
  /nix/store/1ill2sq5r1562kfjaisyq5innhplvz25-unit-systemd-udevd.service.drv
  /nix/store/1snpbr1xlxnq9izc81llzl39p73ca25q-users-groups.json.drv
  /nix/store/2gs1z60xl23d8z0hfnskhxd0mz6kazfr-dhcpcd.conf.drv
  /nix/store/2qdzxvpqqk7pc87a5cgh3f5hdjmy6p17-nixos.conf.drv
  /nix/store/2waqwva6lmki5yssbb8ri8jzhjbbajvc-unit-script-container_-post-start.drv
  /nix/store/4k2zbr4qbq9r8q0kbddisp3qwmj3dd80-unit-user-.service.drv
  /nix/store/hx961hh2al6nra3xssk7y9cx3mj0hww6-dhcpcd.exit-hook.drv
  /nix/store/4mgn92g06pkjmia1mnk1054rnz9ff5l3-unit-dhcpcd.service.drv
  /nix/store/mwwvpmmjs3kgr3y3s67lk4y6cf1mvy4m-nginx.conf.drv
  /nix/store/q44pch31n4gic714b887h1h4vvd5bfa8-unit-script-nginx-pre-start.drv
  /nix/store/4yc7h9d10d2cxzia86rsp3xh2jmjsk8j-unit-nginx.service.drv
  /nix/store/j6dp2h983z3dzhl05nbkwz498ml5fqww-etc-resolvconf.conf.drv
  /nix/store/53hw98q2j0ffqfdv3rg4qqkbxv172khb-unit-resolvconf.service.drv
  /nix/store/59lq19ssqydymz0izfjivc8lv3iqw7j3-unit-serial-getty-.service.drv
  /nix/store/5r7iih8mjjjpkiz8gzkq2whcrfv2yyvi-systemd-user.pam.drv
  /nix/store/5xq2g932b99jslhl7zi43j8569hzj61c-nixos-tmpfiles.d.drv
  /nix/store/649y0c7f97cbg3skkm7q46h5hqhf84yh-mdadm.conf.drv
  /nix/store/6fxbl0pkdm1naka3nrvfs2mx6l1rvn7n-unit-systemd-fsck-.service.drv
  /nix/store/6ywy7516arl0sz64yp1i5aacarg4xfh2-unit-systemd-remount-fs.service.drv
  /nix/store/72yak3mvvcs66c6j68s6jfmlax35kf5y-unit-systemd-modules-load.service.drv
  /nix/store/7529cgr9cgk4xwsyxnsrn1ki945bai96-config.txt.drv
  /nix/store/76jqh4csw7i23qg2scbqgmyg3c4n93sm-unit-systemd-random-seed.service.drv
  /nix/store/80ysjqj958wwnkn5dpz8q7f5qdrc1vh8-login.pam.drv
  /nix/store/81s1yh5misj65f0h44xav1clg2iqxq5m-unit-multi-user.target.drv
  /nix/store/89hlvyrkpcn9yvs8ri28a32bfknrj9pz-unit-script-sshd-pre-start.drv
  /nix/store/8hvmqsqka7vrvihkbhnaadc93mmj54vv-unit-nscd.service.drv
  /nix/store/xg81prmpqqf3xfc1cp6hl2iays7yf0y8-unit-script-pre-sleep-start.drv
  /nix/store/8mdkm7k4wxznmrx9z35lb38f72rv2nkr-unit-pre-sleep.service.drv
  /nix/store/8sviipyr6617dx3cggskcqxq56b610p2-unit-container-getty-.service.drv
  /nix/store/9bss23cprgq6bnyx8gz2fimm8najs258-tmpfiles.d.drv
  /nix/store/a1vqzibscy5knvvw3virk7qil4kv60wr-issue.drv
  /nix/store/aad91sgf1kb1jkfb6sgy6b3v8mxh9r3b-unit-systemd-update-utmp.service.drv
  /nix/store/p9fhrw2a5vsxmwj96k759jil5msiv4ga-firewall-start.drv
  /nix/store/xa34fj4ldr4jw1ddw032mdg15ixhy2bz-firewall-stop.drv
  /nix/store/abfw3jgcvni0irjxmlsigzq801lid32i-firewall-reload.drv
  /nix/store/anblwl5r4m1rdaqdqjij5y7nhd5k9zr1-raspberrypi-firmware-1.20200601.drv
  /nix/store/c0z06gn4l29wrv53kff9ixz49xrg820z-mounts.sh.drv
  /nix/store/c6vb5ryzbq26i70r7yfybv4a4blfbal5-kernel-modules.drv
  /nix/store/c99hxhxz71c69hpyy84fqrz1gbv3dk0r-append-initrd-secrets.drv
  /nix/store/h758dcx20a8gqx5wi916ayj10hsr2wzr-initrd-fsinfo.drv
  /nix/store/ynkmakf403165ixxyw47hfqd2fzwyf0x-stage-1-init.sh.drv
  /nix/store/h2ir69zd3y3zkgn8qhkjdrcgcfixlds6-initrd-linux-5.4.111.drv
  /nix/store/k90jc9bpbiq1xd703qilif0dicf2j5gh-firmware.drv
  /nix/store/ayf6dsqd40dgjy0bzllfssmx1l2fhc95-hwdb.bin.drv
  /nix/store/gnbfgb5zv660lm5wdi2ac11cx6bm9il9-etc-timesyncd.conf.drv
  /nix/store/ib8cqgvp3k67zip6g15a1isa5j71jdma-console-env.drv
  /nix/store/lz36lyp0n2kr9igbndghdxcd4cpb202y-etc-60-nixos.conf.drv
  /nix/store/i29c1gzb81fdh57vdhy0mk5117hqj7v4-unit-nixos-activation.service.drv
  /nix/store/psx48fs7pa2yb6jk2zi2hzaqwqkc50jf-unit-dbus.service.drv
  /nix/store/mldmvm6xz2y07i7hg07mgrni2a7c0pp7-user-units.drv
  /nix/store/pij51b78ibx3py1rccn3xzh37yigqg7a-etc-fstab.drv
  /nix/store/q9irgqwji5171183qskl1klkb48y7iya-etc-nixos.conf.drv
  /nix/store/qw8xa1207wkix5gkhyy5qak8vhmmlagd-vconsole.conf.drv
  /nix/store/rwacz3lfyzgz4mxs7cznk9pfxm4mr88a-etc-hostname.drv
  /nix/store/sc9xy2l7ri44m64r61a5gvh6blhh7506-sshd.pam.drv
  /nix/store/brd6955d93l98ykvdkfq9mpimj10j8n1-unit-script-nix-gc-start.drv
  /nix/store/b2jdyyh68iqm00n26j6y5mwxk16fikzd-unit-nix-gc.service.drv
  /nix/store/br48y84lardic9sw7qmq4znycbrqbl89-unit-prepare-kexec.service.drv
  /nix/store/cnmmffyspawvrfkgxiqijib35g7zi54g-unit-systemd-nspawn-.service.drv
  /nix/store/cwk25y1hyq5c68ivv7fxknvc67724iwj-unit-systemd-timesyncd.service.drv
  /nix/store/dd7rbhv20fmqn2n630qvkccamx3fvkw8-unit-network-local-commands.service.drv
  /nix/store/dn4ycryl80jdb1ccrn0jwjjy8b2zh9r2-unit-sshd.service.drv
  /nix/store/dnnfn8z1h7v56gl9rmgz4p6733jy7fq3-unit-console-getty.service-disabled.drv
  /nix/store/fisffm0y6nkbi2sbq3css4gv1r1xdnwg-unit-nix-optimise.service.drv
  /nix/store/gr0qyq4jg2d1jsamv3bfnilh52r2q2zy-unit-systemd-vconsole-setup.service.drv
  /nix/store/hgavrlr25cjlk5gg7chqmqy78lvjz7f6-unit-systemd-timedated.service.drv
  /nix/store/icqj9vj40k81a315sbrp2dab60ys3z88-unit-firewall.service.drv
  /nix/store/ilf7dyyrgw22c10b46nakz7wfg83gq21-unit-save-hwclock.service.drv
  /nix/store/ilwra3wjfb1mmsv9rzw6riyjk98ziraz-unit-dbus.service.drv
  /nix/store/jb3hh5vx8fpcw8nfndfm1svnb8ps6ibw-unit-post-resume.target.drv
  /nix/store/lf2vd72m82ip3vpxjvrzmpylwi9gvldm-unit-systemd-journal-flush.service.drv
  /nix/store/lfpfwamnnfqcw19v1p2mx6lcifkfqkk5-unit-audit.service.drv
  /nix/store/lv2gwwlngi4fms6k6wcybjpaxf7c7kaa-unit-systemd-journald.service.drv
  /nix/store/mlzyx4agikwi1srzbzxaf6h5iwgyp1z3-unit-systemd-importd.service.drv
  /nix/store/mwq53af0vw9ag25qqnkhsmjs2b8z1fbq-unit-systemd-backlight-.service.drv
  /nix/store/n5zficavy6828rkqfx8n77xdffszx98b-unit-polkit.service.drv
  /nix/store/q7annbhfwxkdz5ag6xxk0pqwcz9ixz42-unit-script-post-resume-start.drv
  /nix/store/nqafg4iafpgx5si2m7w02n1yf8sbv98v-unit-post-resume.service.drv
  /nix/store/ppl56hd046akg5klbqpb0xngvmhkvqf0-unit-systemd-udev-settle.service.drv
  /nix/store/zzj7gzgrszgladcdjw4ymk4n4mzgfs9z-unit-script-network-setup-start.drv
  /nix/store/sbc7h1rdx8aqqpm8a3vybid86j30bzkg-unit-network-setup.service.drv
  /nix/store/szx11w1fzg87v4vvni3w3g1ilmhv206q-unit-getty-.service.drv
  /nix/store/whlaqgc68fwrw2968hn1bb42i2q0xbyg-unit-systemd-sysctl.service.drv
  /nix/store/xgmjjvgq60hqcy9ri8z8fj1vglc96i18-unit-systemd-logind.service.drv
  /nix/store/yn8ynv9pcr4fap03c53qr2ki8lh4s6s7-unit-nix-daemon.service.drv
  /nix/store/bmiy3rdhg38m2c09xajpyvwph6d2avgv-unit-script-container_-pre-stop.drv
  /nix/store/if9sb7wb6ic44ffx4zhpwqb7raql454v-container-init.drv
  /nix/store/jmc2whcp9b66910bl9kpafc775shzps6-unit-script-container_-start.drv
  /nix/store/kw7lq0pa6cmy1gvqsypvqpc49zcqppc8-unit-script-container_-pre-start.drv
  /nix/store/ldaadnhf90l6apgwg3g1lsr22i3vfcrx-reload-container.drv
  /nix/store/yxirmpa579azr934vf46i7gqcm7c37d1-unit-container-.service.drv
  /nix/store/zfhwhknn01jdld3qv056kahxcjjxgmpq-unit-user-runtime-dir-.service.drv
  /nix/store/v2890jqhwz5rzxl744iwnpp9vn2n0cjs-system-units.drv
  /nix/store/x1kdx69wv7b0cwlygsa5svqayddg95l8-etc-os-release.drv
  /nix/store/z52qd8w3cp07b2vvs8mrhmq9kg6k0w73-etc-man_db.conf.drv
  /nix/store/q41y32i5qd0xl9ckg2rzdjlnfk0z1d86-etc.drv
  /nix/store/gx256x5a2ngvmg3h2a06cbpvhclg8k4a-local-cmds.drv
  /nix/store/ync83ramq96lmqmq4y7lkix95l57hsyf-stage-2-init.sh.drv
  /nix/store/yw7zlxmq4kwpblhwn91q5hzrsjli091s-extlinux-conf-builder.sh.drv
  /nix/store/asfh4cg6klzkbqnn3fdl1781qa1gpqry-nixos-system-nixos-20.09pre-git.drv
  /nix/store/d7ckjpk2givzyjkvrmpm2cxacl2655xl-closure-info.drv
  /nix/store/k03fgifqba60ldj1qq7dlh5fxjz7wsh6-python3-3.8.8-env.drv
  /nix/store/iw1c1aghi434vzv4dpmnh5af8gvg9ilg-uboot-rpi_3_defconfig-2020.07.drv
  /nix/store/w3iqd756fm8ffpmi6cakdjy94g18zk7j-ext4-fs.img.zst.drv
  /nix/store/hsyxyvz0i2rnm8y5svnma4ydqnl5hrbb-nixos-sd-image-20.09pre-git-x86_64-linux.img.drv
these paths will be fetched (253.71 MiB download, 802.04 MiB unpacked):
  /nix/store/0cajz1k5pnahghx2a3qc78kndfgb51ha-link-units
  /nix/store/0dg1riwcgj7g4ia5zwha8iivpikvb265-libatasmart-0.19
  /nix/store/0k3cmy452h16yj5rab6bal2dhb9jhnhr-lvm2with-dmeventd-2.03.10
  /nix/store/1ca364nan8wqg3gpahr6r3ndhdvksxy5-bc-1.07.1
  /nix/store/1dwdn663pg5gfyqpvfgk4zbc0c6invnv-python2.7-MarkupSafe-1.1.1
  /nix/store/1fqjk4dhhxlw0b05jakhpx1qvapkhnh5-python2.7-ConfigArgParse-1.2.3
  /nix/store/1lia0g5z10yjq0665wfmmkdmcly91202-dmraid-1.0.0.rc16
  /nix/store/1m82vjiypjs298b78si71k1rw5l0qm4d-mtools-4.0.24
  /nix/store/1q1y8cvfzbbj5wybbfn1smlsy4kjf69x-extra-utils
  /nix/store/1smrvkia30q1yl5d0sj15vdaknykrw93-flex-2.6.4
  /nix/store/20dyxqvd9rnwzdnpdzb8vnv8w3vwa8wx-glibc-locales-2.31-74
  /nix/store/24c6v330nnpnp5rkw3bjcbj49raxcxxs-systemd-default-tmpfiles
  /nix/store/27mfgnbp1imgp90w3gjrdbhrj4249v6p-kmod-blacklist-22-1.1ubuntu1
  /nix/store/2iybkdv2ryh3cq5r1k71n82kgnlgj79l-dhcpcd-8.1.4
  /nix/store/2krd2izvibsbwzy85jk8idb9jl1pv2fb-ntfs3g-2017.3.23
  /nix/store/32q7hi8xnqr124178d9yq2ybllm1xysv-w3m-0.5.3+git20190105
  /nix/store/3h025w2k8lmvqf6cx2i93si50rrw6b18-btrfs-progs-5.7
  /nix/store/420nw2mc3r54s5f0jshnvvk66p2c9cp0-diffutils-3.7-info
  /nix/store/4d1yxj47aq1m4ig3d7kvb716xsirq3nn-acl-2.2.53-doc
  /nix/store/4qx0hbq1qbskni8pja1ni8c3kwl0xkvd-lvm2-2.03.10
  /nix/store/5ggn32qlj6vnlz6zkapyfa2csx48wlk7-sshd.conf-validated
  /nix/store/5z9k2i824pxnl0yj9wp6j6mm4z3wmfkh-bison-3.7.1
  /nix/store/62csr0wcs8g622bgw8gxhfh8r8bbd2fz-dbus-1.12.20-doc
  /nix/store/68wn6zh8xf9zd1vm5b4msf7fsrw0lwla-linux-5.4.111
  /nix/store/6ffm9wfc2c65c81wpj7pdx2mr49kkf6n-util-linux-2.36-dev
  /nix/store/6kdkdaapp67bjihki0l9kil04sjjv1k2-coreutils-8.31-info
  /nix/store/6npyjsh4068csys62nq2mcz6kpah2fij-xfsprogs-4.19.0
  /nix/store/6pb7j6kymf3y4xs5blp3g8mwin2j22kk-dav
  /nix/store/7xd2qgsnh1ld407jnrnl9wqzxy66wbmw-python2.7-nose-1.3.7
  /nix/store/81jygdkabm88p0fzsyjjqcnl8wly2g34-nixos-manual-html
  /nix/store/83gz0ghq9j1i040p66sfd6vflpmrbxym-libndctl-69-lib
  /nix/store/8diyxs2yq2hpplifg9j4wm8zhdqzk1cl-man-db-2.9.3-doc
  /nix/store/8k29z83c4xjvwxjn593jhsbfjq4zchcw-dtc-1.6.0
  /nix/store/96dzhz8vz31bcsx2krzvkkky3rksqw3y-system-shutdown
  /nix/store/a17919jnyi2dv5h91npplm0y3mzyf7br-nix-bash-completions-0.6.8
  /nix/store/a17hrznd123w756waf06574kps2d5yjq-gawk-5.1.0-info
  /nix/store/ad6cmfgmgprkshrh4adqncnv2mq6szd7-hosts
  /nix/store/b19l4yssh8d445xvajljpxxhs50jajbd-gnum4-1.4.18
  /nix/store/bzx4yl5rakq5ydbm1wpsn0z0p8j8wdvf-python2.7-setuptools-44.0.0
  /nix/store/c0z6x6npsbcij20y76n8b6pizi54sm8p-nilfs-utils-2.2.7
  /nix/store/cbpzjbhihrrlxwr81k433zmfv6clzqy6-dvp-1.2.1
  /nix/store/cgvsmcmbxv1aszhhzy8b86gmas58bvbr-busybox-1.31.1
  /nix/store/d87f4w0c4135kjym0f7wpxjy87qqxwjj-libbytesize-2.4
  /nix/store/dcmy4ccbc9pvpg7nnnnzknrg30wrk51y-geoip-1.6.12
  /nix/store/dg0xl05slhm0yzf3wkvxkcjw6pb0i9zz-nixos-manpages
  /nix/store/dr6n543igdhj589qirfh36m5a5fcg47d-rtmp
  /nix/store/drq2ar7m984b1dhjcd66lcq2lvaacnrx-volume_key-0.3.11
  /nix/store/f1czxqsb9frsjs8biqabxrr61pdnmrjw-nix.conf
  /nix/store/fm9h357xv2wpzbqj9h5mfw8376jyaz0f-nginx-1.18.0
  /nix/store/g1gbgmcm63dz475ql4i58dbav966f3i3-fakeroot-1.23
  /nix/store/gginxzqf3g4byd6hb3n2cyx5vs4y1z53-thin-provisioning-tools-0.9.0
  /nix/store/gqixyzkqqf3r96rhxg08sm12zm643qn1-nix-2.3.10-doc
  /nix/store/h6gpqc2y1n532fns49bivrqhxb623qk1-python2.7-cached-property-1.5.1
  /nix/store/hy5h74c5z65238jkybmd4b51qh69mwci-xfsprogs-4.19.0-bin
  /nix/store/hyk3dqjq0a6clzkdfwy6nn277k8xsq52-lvm2-2.03.10-bin
  /nix/store/i2x6m66mwa8ljbiaim90szw36ng30chg-zstd-1.4.5-dev
  /nix/store/idhjdak8n56dw69a930qgmr4dpx4drb1-gnutar-1.32-info
  /nix/store/iwqj95y5n3icbar4bdxi3lkw1lkm77ds-bind-9.14.12-man
  /nix/store/j084fwpcwkw3wqcpyihw70pbfc9fwx6z-exfat-1.3.0
  /nix/store/jkr0vzj41ncykbp07vxzcpiyxxz4c4zy-libcap-2.27-doc
  /nix/store/jl2ffrf2dhlghn7bhwncihba80ycz4i7-parted-3.3
  /nix/store/jqxg9zl9g0lpmcbl5m7vqv6n3nahc815-gixy-0.1.20
  /nix/store/k05yabxk0jkl6gpszm73mb8xn4n2hk0p-hook
  /nix/store/k7q4yqj395p44bvq5kvfhzgw5jjccvwl-python2.7-coverage-5.2.1
  /nix/store/kk0zngmaf8h0355xd2yl5ykyzvr71igr-sudoers
  /nix/store/klzakywx98cic6wg675lcfrky6xksffc-lzo-2.10
  /nix/store/kxzxzq5rgmr4289jfvzql5gzj2ml1czb-texinfo-6.7
  /nix/store/kzpz6bnvlplrffaribdgl8dr3xwa5147-udisks-2.8.4-man
  /nix/store/l1dhzwvdaki4f06zz09kjmq6awrr5x8z-texinfo-interactive-6.7
  /nix/store/l262yyqp7j0ynf5kiawvz3cwd6g8n7if-linux-5.4.111-modules-shrunk
  /nix/store/lcb83hgak1frn9j8j6rdpi3543f8qjp1-kmod-debian-aliases-22-1.1.conf
  /nix/store/lsgdsdr3py39i5cwwcgz4c4msmkla70w-nano-5.2-info
  /nix/store/lzyi6p5bj98bbq61g4215aij4icj6dmi-libfaketime-0.9.8
  /nix/store/ms6354yca7fa8gbxfjv7hwpq33q2q71m-bash-interactive-4.4-p23-doc
  /nix/store/myzqxfhqm8qnlv47ina44x96zy4nlcir-system-generators
  /nix/store/mzj8z91v40n27c3jbxbj1ha768k3cm35-gzip-1.10-info
  /nix/store/n4qdapw3d06ivzqpf6l1qf8qsylrp98x-gnugrep-3.4-info
  /nix/store/nivislbvpbg6pfjmy1frbysz0b9c4w7y-python2.7-pyparsing-2.4.6
  /nix/store/npkls90k60w8zhy9c05cs80z19fpgx3n-bash-interactive-4.4-p23-info
  /nix/store/pdscpgb01nbs5l98ccjx25wwxipg5m7h-gpgme-1.14.0
  /nix/store/pkm72brzyvlqd5i77l1qql5m62kyqpm6-f2fs-tools-1.14.0
  /nix/store/ppqkdn1nx4g7xsvz020ly8i05rx4hmsl-e2fsprogs-1.45.5-info
  /nix/store/px7r9kk27gilz5ns92jwr1am016p6dgx-hook
  /nix/store/q1kga8kg0lmin8i249709xjwz9km7b3w-libressl-3.1.3-man
  /nix/store/qjfzh8gas6bwdfl7cdjs4j662ak8s8xp-xz-5.2.5-doc
  /nix/store/qwbyvdnj3jw567b50pbrxbx14wb1v554-keymap
  /nix/store/r1rmxf4hcmja43kb9f15dz6dmfifr0m6-gptfdisk-1.0.5
  /nix/store/r2wvgnr54vmwnjvzyqdixv8xbn362jgh-mailcap-2.1.48
  /nix/store/r3jabvwb5pfyy932izrc8yqw52by42w2-findutils-4.7.0-info
  /nix/store/r4jhql8mchhk7iw164xd93q9cm6b52vl-neo-2476
  /nix/store/ri0i41435grh93zyk0x19acvfw1asb89-udisks-2.8.4
  /nix/store/rq7668jl38lxjm2ylcvqpa0fmjqf11q5-lvm2-2.03.10-man
  /nix/store/rzph684935ll7p5cc5xw72lybr2vypx7-e2fsprogs-1.45.5-dev
  /nix/store/s08k3b2p366xq2na9z85y4rm1jg8z4z6-boehm-gc-8.0.4
  /nix/store/s0jr5lqprw5rw0zm32zbk1hmwgfr2vfh-gnused-4.8-info
  /nix/store/smja6xx80rma1cb1xpw8bl8dijlm2mg4-swig-3.0.12
  /nix/store/v1pmi2g7cvpjlzidv5rxmlpicvzgcz23-python2.7-Jinja2-2.11.2
  /nix/store/vs3084jrx114ivzy222bzrhqbmwz4sn1-getopt-1.1.6
  /nix/store/vv47hc0yaz7fdjy6r3nzr2hjjfp6pbym-gpm-1.20.7
  /nix/store/w1m3pf2n6kzqkc7bglj501ak63r1mkjv-libaio-0.3.111
  /nix/store/w3h7yla389xrhhs77ps7brm3cazh7zky-gd-2.3.0
  /nix/store/w400879zqhz08bbh28m60ymm9mpm3jm2-source
  /nix/store/y2r8pbda46scd3bzmzswlbfwyrw29dqb-udev-rules
  /nix/store/y39g23fn8ikzcd1iy3b1bclqwjk2qmxd-moreheaders
  /nix/store/yp2fsq0kpa3ipniywizjbmw0zzlqw6ya-dtc-1.6.0
  /nix/store/yp8s1lpzw2gg6y1pjp35lk07fx9001yw-initrd-kmod-blacklist-ubuntu
  /nix/store/zlcp0p7zpwphmmm69ybq9cg9wdx9zhd4-u-boot-2020.07.tar.bz2
  /nix/store/znk9r866h54ay15k7vc705gsvij47d5k-libblockdev-2.24
  /nix/store/zqyk6mafdqf7ghn4w2zhqbhlj8pij4pf-linux-pam-1.3.1-doc
  /nix/store/zw5ghrac4avh62xrc3nf7998va16a0qi-attr-2.4.48-doc
error: builder for '/nix/store/iw1c1aghi434vzv4dpmnh5af8gvg9ilg-uboot-rpi_3_defconfig-2020.07.drv' failed with exit code 2;
       last 10 log lines:
       >   UPD     include/config/uboot.release
       >   UPD     include/generated/version_autogenerated.h
       >   UPD     include/generated/timestamp_autogenerated.h
       >   UPD     include/generated/dt.h
       >   CC      lib/asm-offsets.s
       > cc1: warning: unknown register name: x18
       > cc1: error: bad value ('armv8-a') for '-march=' switch
       > cc1: note: valid arguments to '-march=' switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client icelake-server cascadelake bonnell atom silvermont slm goldmont goldmont-plus tremont knl knm x86-64 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 btver1 btver2 native
       > make[1]: *** [scripts/Makefile.build:155: lib/asm-offsets.s] Error 1
       > make: *** [Makefile:1839: prepare0] Error 2
       For full logs, run 'nix log /nix/store/iw1c1aghi434vzv4dpmnh5af8gvg9ilg-uboot-rpi_3_defconfig-2020.07.drv'.
error: error: 1 dependencies of derivation '/nix/store/hsyxyvz0i2rnm8y5svnma4ydqnl5hrbb-nixos-sd-image-20.09pre-git-x86_64-linux.img.drv' failed to build
And here's the results from nix log :)
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/zlcp0p7zpwphmmm69ybq9cg9wdx9zhd4-u-boot-2020.07.tar.bz2
source root is u-boot-2020.07
setting SOURCE_DATE_EPOCH to timestamp 1594063373 of file u-boot-2020.07/tools/zynqmpimage.h
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
patching script interpreter paths in tools
tools/imx8m_image.sh: interpreter directive changed from "/bin/sh" to "/nix/store/9ywr69qi622lrmx5nn88gk8jpmihy0dz-bash-4.4-p23/bin/sh"
tools/microcode-tool.py: interpreter directive changed from "/usr/bin/env python3" to "/nix/store/p9hw3g46j9ms4x1nvkq9pv3x4iydx7la-python3-3.8.8-env/bin/python3"
tools/jtagconsole: interpreter directive changed from "/bin/sh" to "/nix/store/9ywr69qi622lrmx5nn88gk8jpmihy0dz-bash-4.4-p23/bin/sh"
tools/zynqmp_psu_init_minimize.sh: interpreter directive changed from "/bin/bash" to "/nix/store/9ywr69qi622lrmx5nn88gk8jpmihy0dz-bash-4.4-p23/bin/bash"
tools/dtoc/main.py: interpreter directive changed from "/usr/bin/env python3" to "/nix/store/p9hw3g46j9ms4x1nvkq9pv3x4iydx7la-python3-3.8.8-env/bin/python3"
tools/dtoc/test_fdt.py: interpreter directive changed from "/usr/bin/env python3" to "/nix/store/p9hw3g46j9ms4x1nvkq9pv3x4iydx7la-python3-3.8.8-env/bin/python3"
tools/dtoc/test_dtoc.py: interpreter directive changed from "/usr/bin/env python3" to "/nix/store/p9hw3g46j9ms4x1nvkq9pv3x4iydx7la-python3-3.8.8-env/bin/python3"
tools/mrvl_uart.sh: interpreter directive changed from "/bin/bash" to "/nix/store/9ywr69qi622lrmx5nn88gk8jpmihy0dz-bash-4.4-p23/bin/bash"
tools/binman/main.py: interpreter directive changed from "/usr/bin/env python3" to "/nix/store/p9hw3g46j9ms4x1nvkq9pv3x4iydx7la-python3-3.8.8-env/bin/python3"
tools/binman/cbfs_util_test.py: interpreter directive changed from "/usr/bin/env python" to "/nix/store/p9hw3g46j9ms4x1nvkq9pv3x4iydx7la-python3-3.8.8-env/bin/python"
tools/zynqmp_pm_cfg_obj_convert.py: interpreter directive changed from "/usr/bin/env python3" to "/nix/store/p9hw3g46j9ms4x1nvkq9pv3x4iydx7la-python3-3.8.8-env/bin/python3"
tools/rmboard.py: interpreter directive changed from " /usr/bin/python3" to "/nix/store/p9hw3g46j9ms4x1nvkq9pv3x4iydx7la-python3-3.8.8-env/bin/python3"
tools/moveconfig.py: interpreter directive changed from "/usr/bin/env python3" to "/nix/store/p9hw3g46j9ms4x1nvkq9pv3x4iydx7la-python3-3.8.8-env/bin/python3"
tools/patman/main.py: interpreter directive changed from "/usr/bin/env python3" to "/nix/store/p9hw3g46j9ms4x1nvkq9pv3x4iydx7la-python3-3.8.8-env/bin/python3"
tools/netconsole: interpreter directive changed from "/bin/sh" to "/nix/store/9ywr69qi622lrmx5nn88gk8jpmihy0dz-bash-4.4-p23/bin/sh"
tools/genboardscfg.py: interpreter directive changed from "/usr/bin/env python3" to "/nix/store/p9hw3g46j9ms4x1nvkq9pv3x4iydx7la-python3-3.8.8-env/bin/python3"
tools/rkmux.py: interpreter directive changed from "/usr/bin/env python3" to "/nix/store/p9hw3g46j9ms4x1nvkq9pv3x4iydx7la-python3-3.8.8-env/bin/python3"
tools/buildman/main.py: interpreter directive changed from "/usr/bin/env python3" to "/nix/store/p9hw3g46j9ms4x1nvkq9pv3x4iydx7la-python3-3.8.8-env/bin/python3"
tools/imx_cntr_image.sh: interpreter directive changed from "/bin/sh" to "/nix/store/9ywr69qi622lrmx5nn88gk8jpmihy0dz-bash-4.4-p23/bin/sh"
tools/k3_gen_x509_cert.sh: interpreter directive changed from "/bin/bash" to "/nix/store/9ywr69qi622lrmx5nn88gk8jpmihy0dz-bash-4.4-p23/bin/bash"
tools/k3_fit_atf.sh: interpreter directive changed from "/bin/sh" to "/nix/store/9ywr69qi622lrmx5nn88gk8jpmihy0dz-bash-4.4-p23/bin/sh"
patching script interpreter paths in arch/arm/mach-rockchip
arch/arm/mach-rockchip/fit_spl_optee.sh: interpreter directive changed from "/bin/sh" to "/nix/store/9ywr69qi622lrmx5nn88gk8jpmihy0dz-bash-4.4-p23/bin/sh"
arch/arm/mach-rockchip/make_fit_atf.py: interpreter directive changed from "/usr/bin/env python3" to "/nix/store/p9hw3g46j9ms4x1nvkq9pv3x4iydx7la-python3-3.8.8-env/bin/python3"
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  YACC    scripts/kconfig/zconf.tab.c
  LEX     scripts/kconfig/zconf.lex.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
@nix { "action": "setPhase", "phase": "buildPhase" }
building
build flags: SHELL=/nix/store/9ywr69qi622lrmx5nn88gk8jpmihy0dz-bash-4.4-p23/bin/bash DTC=dtc CROSS_COMPILE=
scripts/kconfig/conf  --syncconfig Kconfig
  UPD     include/config.h
  CFG     u-boot.cfg
cc1: warning: unknown register name: x18
  GEN     include/autoconf.mk
  GEN     include/autoconf.mk.dep
cc1: warning: unknown register name: x18
  UPD     include/config/uboot.release
  UPD     include/generated/version_autogenerated.h
  UPD     include/generated/timestamp_autogenerated.h
  UPD     include/generated/dt.h
  CC      lib/asm-offsets.s
cc1: warning: unknown register name: x18
cc1: error: bad value ('armv8-a') for '-march=' switch
cc1: note: valid arguments to '-march=' switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client icelake-server cascadelake bonnell atom silvermont slm goldmont goldmont-plus tremont knl knm x86-64 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 btver1 btver2 native
make[1]: *** [scripts/Makefile.build:155: lib/asm-offsets.s] Error 1
make: *** [Makefile:1839: prepare0] Error 2

What am I doing wrong?

Thank you in advance!

LXC image

It will be great to have lxc target, so I can just import generated nixos image with:
lxc image import

Thanks!

Add option to specify nixpkgs path or channel

I need nixpkgs with a patch, so this feature whould be useful!

Or can i already use an env var? Then, please document it.

Currently, i use nix-build like this:
[davidak@ethmoid:~/code/nixpkgs/nixos]$ time nix-build /home/davidak/code/nixpkgs/nixos -A config.system.build.isoImage -I nixos-config=/home/davidak/code/nixos-config-greenbone/machines/targets-image/configuration.nix default.nix

vmware seems to be broken

running

$> nixos-generate -f vmware -c config.nix
error: getting status of '/var/src/nixpkgs/nixos/modules/virtualisation/vmware-image.nix': No such file or directory

copy vmware-guest.nix to vmware-image.nix I get this error :

$> nixos-generate -f vmware -c config.nix
error: attribute 'vmwareImage' in selection path 'config.system.build.vmwareImage' not found

LXC image is unable to `nixos-rebuild switch`

Summary
nixos-generate generated image is not able to perform nixos-rebuild switch.

Host

  virtualisation.lxc = {
    enable = true;
    lxcfs.enable = true;
    defaultConfig = "lxc.include = ${pkgs.lxcfs}/share/lxc/config/common.conf.d/00-lxcfs.conf";
  };

  virtualisation.lxd.enable = true;

Guest

[root@nixos:~]# cat /etc/nixos/configuration.nix
{ config, pkgs, ... }:

{
  imports = [  ];

  boot.isContainer = true;

  systemd.services."getty@".enable = false;
}

[root@nixos:~]# nixos-rebuild switch
building Nix...
building the system configuration...
activating the configuration...
setting up /etc...
mount: /dev: cannot remount devtmpfs read-write, is write-protected.
mount: /dev/pts: cannot remount devpts read-write, is write-protected.
mount: /dev/shm: cannot remount tmpfs read-write, is write-protected.
mount: /proc: cannot remount proc read-write, is write-protected.
mount: /run: cannot remount tmpfs read-write, is write-protected.
mount: /run/keys: cannot remount ramfs read-write, is write-protected.
mount: /run/wrappers: cannot remount tmpfs read-write, is write-protected.
Activation script snippet 'specialfs' failed (32)
reloading user units for root...
setting up tmpfiles
warning: the following units failed: sys-kernel-debug.mount

โ— sys-kernel-debug.mount - Kernel Debug File System
   Loaded: loaded (/nix/store/jabq4nrn21fm49zvaqfpg9986xsr8g5r-systemd-239.20190219/example/systemd/system/sys-kernel-debug.mount; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2019-09-12 16:51:46 UTC; 28ms ago
    Where: /sys/kernel/debug
     What: debugfs
     Docs: https://www.kernel.org/doc/Documentation/filesystems/debugfs.txt
           https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems

Sep 12 16:51:46 nixos systemd[1]: Mounting Kernel Debug File System...
Sep 12 16:51:46 nixos mount[3231]: mount: /sys/kernel/debug: permission denied.
Sep 12 16:51:46 nixos systemd[1]: sys-kernel-debug.mount: Mount process exited, code=exited status=32
Sep 12 16:51:46 nixos systemd[1]: sys-kernel-debug.mount: Failed with result 'exit-code'.
Sep 12 16:51:46 nixos systemd[1]: Failed to mount Kernel Debug File System.
warning: error(s) occurred while switching to the new configuration

Maybe contains relevant information: NixOS/nixpkgs#9735 (comment)

No space left on device when using aws, azure, or gce formats

I am trying to build an image appropriate for cloud deployment. I was successfully able to build an iso using nixos-generate -f iso -c /etc/nixos/configuration.nix. However, if I try to build one for aws, azure, or gce I get nixos-generate-fails. I have approximately 30 GB of free space on the VM.

I found the file azure-image.nix and I presume I need to bump virtualisation.azureImage.diskSize to ~10GB. Is there documentation somewhere for this?

Note: I am in the Nix/NixOS Discord as @chiroptical if you would rather discuss it there. Thanks.

How to use `--flake`

it seems that nixosConfigurations.<machine> is not overridable, hence the question is how to use --flake.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.