zefhemel / nixops-mac-setup

Script to easily setup Nix and NixOps for use on Mac
22 stars 6 forks source link

Update to current nix / nixops #4

Open rened opened 9 years ago

rened commented 9 years ago

This updates the scripts to be useable again, with the current versions of nix (1.8pre) / nixops (1.3pre), including a workaround for an outdated nix inside the VMs which prevents deployment.

Tested on 10.9 with XCode 5.1 and 10.10. with XCode 6.1

It fetches the latest binary builds for nix and nixops - this should be pinned to the release versions once available.

This also fixes #2.

ghost commented 9 years ago

Hi everyone,

I grabbed this PR as a patch, and used git am to apply it.

I then had to apply this patch:

diff --git a/install-nixops.sh b/install-nixops.sh
index 469b552..4cbb027 100755
--- a/install-nixops.sh
+++ b/install-nixops.sh
@@ -7,7 +7,7 @@ nix-channel --update
 export NIX_PATH=/nix/var/nix/profiles/per-user/$USER/channels/nixos

 # get the .nixpkg URL of the latest darwin build of nixops
-URL=`curl -sL http://hydra.nixos.org/job/nixops/master/build.x86_64-darwin/latest | grep .nixpkg | grep href | grep -o \
+URL=`curl -sL http://hydra.nixos.org/job/nixops/master/build.x86_64-darwin/latest | grep '\.nixpkg"' | grep href | grep 
 nix-install-package --non-interactive --url $URL

 RCFILE=~/.profile

to get install-nixops.sh to work correctly.

I seem to have my environment set up correctly:

psnively@Ragnarok ~$ nix-env --version
nix-env (Nix) 1.8pre3866_6062b12
psnively@Ragnarok ~$ nixops --version
NixOps 1.3pre1358_10aae84
psnively@Ragnarok ~$ echo $NIX_PATH
/nix/var/nix/profiles/per-user/psnively/channels/nixos

But:

psnively@Ragnarok ~/projects/nixops-mac-setup[master*]$ nixops create test/trivial-vbox.nix test/trivial.nix -d test
created deployment ‘ec890aa8-719d-11e4-a0d7-80e6502616e8’
ec890aa8-719d-11e4-a0d7-80e6502616e8
psnively@Ragnarok ~/projects/nixops-mac-setup[master*]$ nixops deploy -d test
error: Package ‘qemu-2.0.0’ in ‘/nix/var/nix/profiles/per-user/psnively/channels/nixos/nixpkgs/pkgs/applications/virtualization/qemu/default.nix:50’ is not supported on ‘x86_64-darwin’, refusing to evaluate.
You can set
  { nixpkgs.config.allowBroken = true; }
in configuration.nix to override this. If you use Nix standalone, you can add
  { allowBroken = true; }
to ~/.nixpkgs/config.nix.

(use ‘--show-trace’ to show detailed location information)
error: evaluation of the deployment specification failed

I'm at a loss to understand why qemu even enters into it, for a VirtualBox deployment.

Any advice?

Thanks!

rened commented 9 years ago

What happens when you set allowBroken = true? I am pretty new to nixops myself, but it might be that the expressions are evaluated first, and only then it looks for a build machine. And the evaluation only sees the local architecture, as it does not know about the target yet. But I am just guessing here...

ghost commented 9 years ago

@rened, unfortunately I run bang into a failed assertion in libcap that the platform is Linux.

I think you're right: when I add --show-trace, it does look like something is trying to operate over all packages, and this entails evaluation. But this cannot possibly work: some packages are platform-specific, and some include assertions to that effect. Nix seems very hostile to correctly handling staging, where we have a build environment that's different from the target environment. Recent versions of this repo claim a remote build VM is not necessary anymore. To be honest, I don't believe it.