I’m trying to learn nixOps basics by following along the documentation. I’m on a Mac (10.13.6) if that makes any difference.
➜ nix-env -i nixops
installing 'nixops-1.6'
[...proceeds to install.... looks good ....]
Great, so I move on to Deploying on VirtualBox. I cut and paste the example files from the docs, and write them locally.
➜ cat 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 ];
};
}
➜ cat trivial-vbox.nix
{
webserver =
{ config, pkgs, ... }:
{ deployment.targetEnv = "virtualbox";
deployment.virtualbox.memorySize = 1024; # megabytes
deployment.virtualbox.vcpu = 2; # number of cpus
};
}
I create my deployment using the command given, and list the result.
➜ nixops create ./trivial.nix ./trivial-vbox.nix -d trivial
created deployment ‘8e7527dc-312a-11e9-ba88-80e65003443c’
8e7527dc-312a-11e9-ba88-80e65003443c
➜ nixops list
+--------------------------------------+---------+------------------------+------------+------+
| UUID | Name | Description | # Machines | Type |
+--------------------------------------+---------+------------------------+------------+------+
| 8e7527dc-312a-11e9-ba88-80e65003443c | trivial | Unnamed NixOps network | 0 | |
+--------------------------------------+---------+------------------------+------------+------+
Hang on! Unnamed?!?!
Next step is to get more information, so let’s try that…
➜ nixops info -d trivial
error: value is null while a set was expected, at /nix/store/nrbxkhpq5xbxc0mbiw011nw8z7vzins5-nixpkgs-19.03pre167327.11cf7d6e1ff/nixpkgs/pkgs/top-level/default.nix:63:5
warning: evaluation of the deployment specification failed; status info may be incorrect
Network name: trivial
Network UUID: 8e7527dc-312a-11e9-ba88-80e65003443c
Network description: Unnamed NixOps network
Nix expressions: /Users/pauls/nix/trivial.nix /Users/pauls/nix/trivial-vbox.nix
+------+--------+------+-------------+------------+
| Name | Status | Type | Resource Id | IP address |
+------+--------+------+-------------+------------+
+------+--------+------+-------------+------------+
Error! What’s gone wrong? Help! What have I done?
I’ve looked at the file it references, but it means nothing to me. Line 63 is the line begining with builtins.intersectAttrs
.
# From a minimum of `system` or `config` (actually a target triple, *not*
# nixpkgs configuration), infer the other one and platform as needed.
localSystem = lib.systems.elaborate (
# Allow setting the platform in the config file. This take precedence over
# the inferred platform, but not over an explicitly passed-in one.
builtins.intersectAttrs { platform = null; } config
// args.localSystem);