[Nix-dev] How to bootstrap a server using Nixops?

Jeffrey David Johnson jefdaj at gmail.com
Fri May 1 01:17:42 CEST 2015


It's possible I'm getting the wrong idea about what nixops is for, but I used
it to set up an Amazon EC2 instance with the idea of logging into the server
and administering it using local commands afterward. The initial install goes
fine. Afterward I clone my nixcfg repo (including nixpkgs submodule) and try to
set it up the way I would a physical machine, by copying everything from
/etx/nixos/* into nixcfg/configs/cyno.nix and modifying it to
point inside the repo:

{ config, pkgs, ... }:

{
  imports = [
    ../nixpkgs/nixos/modules/virtualization/amazon-config.nix
  ];
  ec2.hvm = true;
  services.journald.rateLimitBurst = 0;
}


When I do a `nixos-rebuild` (part of install.sh) though, it gives this error:

[root at cyno:~/nixcfg]# ./install.sh test
building Nix...
error: getting status of ‘/root/nixcfg/nixpkgs/nixos/modules/virtualization/amazon-config.nix’: No such file or directory
(use ‘--show-trace’ to show detailed location information)
error: getting status of ‘/root/nixcfg/nixpkgs/nixos/modules/virtualization/amazon-config.nix’: No such file or directory
(use ‘--show-trace’ to show detailed location information)
building the system configuration...
error: getting status of ‘/root/nixcfg/nixpkgs/nixos/modules/virtualization/amazon-config.nix’: No such file or directory
(use ‘--show-trace’ to show detailed location information)

Now I notice something strange:
/root/nixcfg/nixpkgs/nixos/modules/virtualization/amazon-config.nix exists, but
`ls` throws an error when listing it:

ls /root/nixcfg/nixpkgs/nixos/modules/virtualization/amazon-config.nix
ls: cannot access /root/nixcfg/nixpkgs/nixos/modules/virtualization/amazon-config.nix: No such file or directory

If I approach it "slowly" by listing /root/nixcfg, then /root/nixcfg/nixpkgs,
all the way to the full path it *does* work. I googled around a little and
according to this:

http://superuser.com/questions/446280/no-such-file-or-directory

The error can also mean a missing dynamically linked library. So I tried ldd as
directed (though I don't understand the output), and got this:

ldd $(which ls)
	linux-vdso.so.1 (0x00007fff01dec000)
	libacl.so.1 => /nix/store/6mz0jhl389h7panazs5sayrydajia1s2-acl-2.2.52/lib/libacl.so.1 (0x00007f55d0f54000)
	libc.so.6 => /nix/store/93zfs0zzndi7pkjkjxawlafdj8m90kg5-glibc-2.20/lib/libc.so.6 (0x00007f55d0bb7000)
	libattr.so.1 => /nix/store/ndszpck395bi55jnz50ny99y4pvj6dqn-attr-2.4.47/lib/libattr.so.1 (0x00007f55d09b3000)
	/nix/store/93zfs0zzndi7pkjkjxawlafdj8m90kg5-glibc-2.20/lib/ld-linux-x86-64.so.2 (0x00007f55d115c000)

Anyway I think there's something wrong with how the system is set up, but not
sure what. Is there a correct way to bootstrap it to the point of using
the same config as my other machines?

Thanks
Jeff


More information about the nix-dev mailing list