Following steps in NixOS Manual chapter 31. failes.
$ export NIXOS_CONFIG=/etc/nixos/configuration.nix
$ cd ~/.nix-defexpr/channels_root/nixos/nixos
$ nix-build -A config.system.build.isoImage -I nixos-config=modules/installer/cd-dvd/installation-cd-minimal.nix
error: attribute ‘isoImage’ in selection path ‘config.system.build.isoImage’ not found
Analysis: nixos/default.nix includes via ./lib/from-env.nix NIXOS_CONFIG and not nixos-config.
$ cd ~/.nix-defexpr/channels_root/nixos/nixos
$ nix-build -A config.system.build.isoImage -I nixos-config=modules/installer/cd-dvd/installation-cd-minimal.nix
...
error: creating a garbage collector root (/nix/store/933gjnzyi22z4l0qbsnhvm7r7136g144-nixos-17.03pre98682.f673243/nixos/nixos/result) in the Nix store is forbidden (are you running nix-build inside the store?)
It seems, that write access is needed in current working directory.
$ git clone --branch nixos-unstable https://github.com/NixOS/nixpkgs-channels.git nixpkgs
$ cd nixpkgs/nixos
$ nix-build -A config.system.build.isoImage -I nixos-config=modules/installer/cd-dvd/installation-cd-minimal.nix
...
Making image hybrid...
/nix/store/askpf8v8gmy14cwqayn0yx0h88zl8cyz-nixos-17.03.git.f673243-x86_64-linux.iso
It created an image, but without my custom configuration.nix.
By specifying -I nixos-config= you set location of your configuration.nix. You want to use your own and import that ISO config into it (via imports = [ ...]).
Thanks, that works.
If I understand correctly this works and can be closed?
I think that manual section would deserve to get clearer.
Back on the topic, I was attempting to build a minimal-cd with a new user with this file (configuration.nix):
{ pkgs, config, ... }:
{
# based on cd-minimal
imports = [
modules/installer/cd-dvd/installation-cd-minimal.nix
];
services.time.timeZone = "Europe/Paris";
}
I cloned the latest nixpkgs from github in a directory named nixpkgs, and then I moved configuration.nix to nixpkgs/nixos/, then I run:
$ cd nixpkgs/nixos
$ nix-build -A config.system.build.isoImage -I nixos-config=configuration.nix
This fails with:
error: The option services.time defined in dir/nixpkgs/nixos/configuration.nix does not exist.
@vcunat
You want to use your own and import that ISO config into it (via imports = [ ...]).
To me it seems it is not that simple
The option is called "time.timeZone". No "service". See configuration.nix manual page.
You are right of course… I f* up my configuration.nix somehow :)
Fixed in 4bee34dcc5e6886aac8c868410f12a670da03062.
Most helpful comment
I think that manual section would deserve to get clearer.