Nixops flake gce

I’m working in doing a nix demo (two days from now :S ) that showcases nix flakes and nixops, but I’m running into problems that I hadn’t encountered before.

The code is in GitHub - hhefesto/nix-demo: A full demo of a nix web server and the error is:

$ nixops deploy -d nix-demo-deployment --show-trace                                                                                                                                                                                                                                                                                                              ghc-shell-for-nix-demo
warning: 'nix flake info' is a deprecated alias for 'nix flake metadata'
warning: Git tree '/home/hhefesto/src/nix-demo' is dirty
warning: Git tree '/home/hhefesto/src/nix-demo' is dirty
trace: haskell-nix.haskellLib.cleanGit: /nix/store/7vng2sjcqcwhg783f21mysx61cv49fg5-source does not seem to be a git repository,
assuming it is a clean checkout.
warning: Git tree '/home/hhefesto/src/nix-demo' is dirty
trace: haskell-nix.haskellLib.cleanGit: /nix/store/7vng2sjcqcwhg783f21mysx61cv49fg5-source does not seem to be a git repository,
assuming it is a clean checkout.
trace: warning: The extraArgs argument to eval-config.nix is deprecated. Please set config._module.args instead.
server0> creating GCE disk of 40 GiB from image 'nixos-18091228a4c4cbb613c-x86-64-linux' in project 'predictix-operations'...
Traceback (most recent call last):
  File "/nix/store/wqy1ppn644004pbx81f81p7dn3qr0ck0-python3-3.8.7-env/lib/python3.8/site-packages/nixops_gcp/gcp_common.py", line 93, in retrieve_gce_image
    image = _conn.ex_get_image(
  File "/nix/store/wqy1ppn644004pbx81f81p7dn3qr0ck0-python3-3.8.7-env/lib/python3.8/site-packages/libcloud/compute/drivers/gce.py", line 7304, in ex_get_image
    response = self.connection.request(partial_name, method='GET')
  File "/nix/store/wqy1ppn644004pbx81f81p7dn3qr0ck0-python3-3.8.7-env/lib/python3.8/site-packages/libcloud/compute/drivers/gce.py", line 126, in request
    response = super(GCEConnection, self).request(*args, **kwargs)
  File "/nix/store/wqy1ppn644004pbx81f81p7dn3qr0ck0-python3-3.8.7-env/lib/python3.8/site-packages/libcloud/common/google.py", line 811, in request
    return super(GoogleBaseConnection, self).request(
  File "/nix/store/wqy1ppn644004pbx81f81p7dn3qr0ck0-python3-3.8.7-env/lib/python3.8/site-packages/libcloud/common/base.py", line 655, in request
    response = responseCls(**kwargs)
  File "/nix/store/wqy1ppn644004pbx81f81p7dn3qr0ck0-python3-3.8.7-env/lib/python3.8/site-packages/libcloud/common/base.py", line 169, in __init__
    self.object = self.parse_body()
  File "/nix/store/wqy1ppn644004pbx81f81p7dn3qr0ck0-python3-3.8.7-env/lib/python3.8/site-packages/libcloud/common/google.py", line 278, in parse_body
    raise ResourceNotFoundError(message, self.status, code)
libcloud.common.google.ResourceNotFoundError: {'message': "The resource 'projects/predictix-operations' was not found. A missing project error may be an authentication issue. Please  ensure your auth credentials match your project. ", 'domain': 'global', 'reason': 'notFound'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/nix/store/sn3kr9xgskffvncwlgaia7i38p6zchsc-python3.8-nixops-2.0.0/bin/.nixops-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/wqy1ppn644004pbx81f81p7dn3qr0ck0-python3-3.8.7-env/lib/python3.8/site-packages/nixops/__main__.py", line 710, in main
    args.op(args)
  File "/nix/store/wqy1ppn644004pbx81f81p7dn3qr0ck0-python3-3.8.7-env/lib/python3.8/site-packages/nixops/script_defs.py", line 617, in op_deploy
    depl.deploy(
  File "/nix/store/wqy1ppn644004pbx81f81p7dn3qr0ck0-python3-3.8.7-env/lib/python3.8/site-packages/nixops/deployment.py", line 1479, in deploy
    self.run_with_notify("deploy", lambda: self._deploy(**kwargs))
  File "/nix/store/wqy1ppn644004pbx81f81p7dn3qr0ck0-python3-3.8.7-env/lib/python3.8/site-packages/nixops/deployment.py", line 1468, in run_with_notify
    f()
  File "/nix/store/wqy1ppn644004pbx81f81p7dn3qr0ck0-python3-3.8.7-env/lib/python3.8/site-packages/nixops/deployment.py", line 1479, in <lambda>
    self.run_with_notify("deploy", lambda: self._deploy(**kwargs))
  File "/nix/store/wqy1ppn644004pbx81f81p7dn3qr0ck0-python3-3.8.7-env/lib/python3.8/site-packages/nixops/deployment.py", line 1382, in _deploy
    nixops.parallel.run_tasks(
  File "/nix/store/wqy1ppn644004pbx81f81p7dn3qr0ck0-python3-3.8.7-env/lib/python3.8/site-packages/nixops/parallel.py", line 106, in run_tasks
    raise list(exceptions.values())[0]
  File "/nix/store/wqy1ppn644004pbx81f81p7dn3qr0ck0-python3-3.8.7-env/lib/python3.8/site-packages/nixops/parallel.py", line 70, in thread_fun
    work_result = (worker_fun(t), None, t.name)
  File "/nix/store/wqy1ppn644004pbx81f81p7dn3qr0ck0-python3-3.8.7-env/lib/python3.8/site-packages/nixops/deployment.py", line 1336, in worker
    r.create(
  File "/nix/store/wqy1ppn644004pbx81f81p7dn3qr0ck0-python3-3.8.7-env/lib/python3.8/site-packages/nixops_gcp/backends/gce.py", line 489, in create
    img = retrieve_gce_image(self.connect(), img=img)
  File "/nix/store/wqy1ppn644004pbx81f81p7dn3qr0ck0-python3-3.8.7-env/lib/python3.8/site-packages/nixops_gcp/gcp_common.py", line 99, in retrieve_gce_image
    raise Exception("Image '{0}' was not found..".format(img.name))
Exception: Image 'nixos-18091228a4c4cbb613c-x86-64-linux' was not found..

And I get this with the flake approach or a non-flake approach: the non flake approach I just have to comment out nixopsConfigurations, modify nix-demo-configuration.nix slightly and recreate with nixops create ./nix-demo-configuration.nix -d nix-demo-deployment (after having destroyed and deleted).

I’ve once been able to deploy with the flakes approach and have several times been able to deploy without the flake approach, but this time I just can’t do any.

My only fruitful search of predictix-operations was [Fix GCP plugin] Introduce public GCE Bootstrap Image by tewfik-ghariani · Pull Request #1 · nix-community/nixops-gce · GitHub

That project was later on removed and replaced by the official “nixos-cloud” GCP project

However, I believe that the only available image at the moment is “20.09”

Can you test with that OS version? The three more recent OS versions ( 21.05, 21.11, 22.05 ) do not exist right now but they can be added via the “create-gce.sh” script

Maybe @AmineChikhaoui can take care of that if possible ^^