NixOS / nixops

NixOps is a tool for deploying to NixOS machines in a network or cloud.
https://nixos.org/nixops
GNU Lesser General Public License v3.0
1.84k stars 364 forks source link

Cannot deploy trivial example #1027

Open ghost opened 6 years ago

ghost commented 6 years ago

trivial.nix

{
    network.description = "Web Server";

    webserver = { config, pkgs, ... }: { 
        services.httpd.enable = true;
        services.httpd.adminAddr = "alice@example.org";
        services.httpd.documentRoot = "${pkgs.valgrind.doc}/share/doc/valgrind/html";
        networking.firewall.allowedTCPPorts = [80 22];     
    };
}

trivial-vbox.nix

{
  webserver =
    { config, pkgs, ... }:
    { deployment.targetEnv = "virtualbox";
      deployment.virtualbox.headless = true;
      deployment.virtualbox.memorySize = 1024; # megabytes
      deployment.virtualbox.vcpu = 2; # number of cpus
    };
}

after creating the deploy with the files above, when i run $ nixops deploy -d trivial it fails to buld because nix can't find some hashes

copying path '/nix/store/y6lkznrphrb5q914my4cah6cnjcc7czw-findutils-4.6.0' to 'ssh://root@192.168.56.9'...
copying path '/nix/store/6wm0g6b6xwnx3qccn5af5mb3x8ksk035-stdenv-linux' to 'ssh://root@192.168.56.9'...
copying 1 paths...
copying path '/nix/store/fpffgjw3bvwba6kf3adwnmqlny6i49ps-append-initrd-secrets' from 'ssh://root@192.168.56.9'...
error: cannot add path '/nix/store/fpffgjw3bvwba6kf3adwnmqlny6i49ps-append-initrd-secrets' because it lacks a hash
builder for '/nix/store/l3awjif9sgvyml3qjkinpj3aqsx4yvn6-append-initrd-secrets.drv' failed with exit code 1
cannot build derivation '/nix/store/4ij1cky4czqqd9ijjisasrfg0yh5755v-nixos-system-webserver-19.03pre155614.ac7bf94f6df.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/js8hfd7902hwbv5viy0gljrkrfh2f62m-nixops-machines.drv': 1 dependencies couldn't be built
error: build of '/nix/store/js8hfd7902hwbv5viy0gljrkrfh2f62m-nixops-machines.drv' failed
error: unable to build all machine configurations

os version:

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.14
BuildVersion:   18A391

nix version:

$ nix-env --version
nix-env (Nix) 2.1.3

nixops version:

$ nixops --version
NixOps 1.6

virtualbox version

$ VBoxManage -version
5.2.20r125813
mtesseract commented 5 years ago

Update: see below.

Pretty much the same situation here. Just tried the trivial example from the NixOps manual and got this:

error: cannot add path '/nix/store/a1zbfqipa1sl4bnnayla17z5p48kxiza-audit-disable' because it lacks a hash
builder for '/nix/store/j8ifh77jywc3s79gn5xkb6wr1jh68l2f-audit-disable.drv' failed with exit code 1
cannot build derivation '/nix/store/nmb3j2wy64z4g2y62vq8srq4b3b14aml-unit-audit.service.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/63slpmvix0yzc3qziy9qf2k517ahg7j2-system-units.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/2cvfh1msz8xhzvp877yzjzxlp1jmfkl2-etc.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/jmq6xd1ypfk48x0621yvsvn0qchndbji-nixos-system-webserver-19.03pre158151.69522a0acf8.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/6i5cw377i1rbdxii9c6x725m9fkpjnvg-nixops-machines.drv': 1 dependencies couldn't be built
error: build of '/nix/store/6i5cw377i1rbdxii9c6x725m9fkpjnvg-nixops-machines.drv' failed
error: unable to build all machine configurations

I am running the same version of nix, nixops and VirtualBox, but a slightly more recent version of macOS:

ProductName:    Mac OS X
ProductVersion: 10.14.1
BuildVersion:   18B75

How can we fix this? Thanks!

Update: See here: https://discourse.nixos.org/t/newbie-question-cant-get-trivial-example-of-nixops-to-work-on-my-mac/1125