NixOps deployment error

I am having a hard time deploying a server pool with NixOps. In my poor understandment it is looking for a image wich isn’t there, even I have pointed to specific image file.

> [wjjunyor@T101:/etc/nixos/redservers]$ sudo nixops deploy -d load-balancer --show-trace
> /nix/store/0rwyq0j954a7143p0wzd4rhycny8i967-bash-5.2-p15/bin/bash: warning: setlocale: LC_ALL: cannot change locale (pt_BR)
> /nix/store/0rwyq0j954a7143p0wzd4rhycny8i967-bash-5.2-p15/bin/bash: warning: setlocale: LC_ALL: cannot change locale (pt_BR)
> /nix/store/5f3mkj8c26hpc8ixb8cj8y5rripkg86r-python2.7-apache-libcloud-2.8.3/lib/python2.7/site-packages/libcloud/common/google.py:93: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
> from cryptography.hazmat.backends import default_backend
> /bin/sh: warning: setlocale: LC_ALL: cannot change locale (pt_BR)
> _findLib_gcc: line 1: warning: setlocale: LC_ALL: cannot change locale (pt_BR)
> /bin/sh: warning: setlocale: LC_ALL: cannot change locale (pt_BR)
> sh: warning: setlocale: LC_ALL: cannot change locale (pt_BR)
> trace: warning: The extraArgs argument to eval-config.nix is deprecated. Please set config._module.args instead.
> trace: warning: replaceChars is a deprecated alias of replaceStrings, replace usages of it with replaceStrings.
> trace: warning: The extraArgs argument to eval-config.nix is deprecated. Please set config._module.args instead.
> trace: warning: The extraArgs argument to eval-config.nix is deprecated. Please set config._module.args instead.
> trace: warning: The args argument to evalModules is deprecated. Please set config._module.args instead.
> trace: warning: The check argument to evalModules is deprecated. Please set config._module.check instead.
> trace: warning: replaceChars is a deprecated alias of replaceStrings, replace usages of it with replaceStrings.
> trace: `lib.nixpkgsVersion` is deprecated, use `lib.version` instead!
> error:
> … while evaluating call site
> 
> at «none»:0: (source not available)
> 
> … while calling anonymous lambda
> 
> at /nix/store/h4i74fr16imj0wza236snif0bmyqv9sj-nixos-23.05/nixos/lib/options.nix:323:41:
> 
> 322|     else if isList x then map scrubOptionValue x
> 323|     else if isAttrs x then mapAttrs (n: v: scrubOptionValue v) (removeAttrs x ["_args"])
> |                                         ^
> 324|     else x;
> 
> … while evaluating call site
> 
> at /nix/store/h4i74fr16imj0wza236snif0bmyqv9sj-nixos-23.05/nixos/lib/options.nix:323:44:
> 
> 322|     else if isList x then map scrubOptionValue x
> 323|     else if isAttrs x then mapAttrs (n: v: scrubOptionValue v) (removeAttrs x ["_args"])
> |                                            ^
> 324|     else x;
> 
> … while calling 'scrubOptionValue'
> 
> at /nix/store/h4i74fr16imj0wza236snif0bmyqv9sj-nixos-23.05/nixos/lib/options.nix:319:22:
> 
> 318|   */
> 319|   scrubOptionValue = x:
> |                      ^
> 320|     if isDerivation x then
> 
> … while evaluating call site
> 
> at /nix/store/h4i74fr16imj0wza236snif0bmyqv9sj-nixos-23.05/nixos/lib/options.nix:320:8:
> 
> 319|   scrubOptionValue = x:
> 320|     if isDerivation x then
> |        ^
> 321|       { type = "derivation"; drvPath = x.name; outPath = x.name; name = x.name; }
> 
> … while calling 'isDerivation'
> 
> at /nix/store/h4i74fr16imj0wza236snif0bmyqv9sj-nixos-23.05/nixos/lib/attrsets.nix:636:5:
> 
> 635|     # Value to check.
> 636|     value: value.type or null == "derivation";
> |     ^
> 637|
> 
> … while evaluating call site
> 
> at «none»:0: (source not available)
> 
> … while calling 'g'
> 
> at /nix/store/h4i74fr16imj0wza236snif0bmyqv9sj-nixos-23.05/nixos/lib/attrsets.nix:595:19:
> 
> 594|           g =
> 595|             name: value:
> |                   ^
> 596|             if isAttrs value && cond value
> 
> … while evaluating call site
> 
> at /nix/store/h4i74fr16imj0wza236snif0bmyqv9sj-nixos-23.05/nixos/lib/attrsets.nix:598:20:
> 
> 597|               then recurse (path ++ [name]) value
> 598|               else f (path ++ [name]) value;
> |                    ^
> 599|         in mapAttrs g;
> 
> … while calling anonymous lambda
> 
> at /nix/store/h4i74fr16imj0wza236snif0bmyqv9sj-nixos-23.05/nixos/lib/modules.nix:248:72:
> 
> 247|           # For definitions that have an associated option
> 248|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
> |                                                                        ^
> 249|
> 
> … while evaluating the attribute 'value'
> 
> at /nix/store/h4i74fr16imj0wza236snif0bmyqv9sj-nixos-23.05/nixos/lib/modules.nix:759:9:
> 
> 758|     in warnDeprecation opt //
> 759|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
> |         ^
> 760|         inherit (res.defsFinal') highestPrio;
> 
> … while evaluating the option `sourceUri':
> 
> … while evaluating the attribute 'mergedValue'
> 
> at /nix/store/h4i74fr16imj0wza236snif0bmyqv9sj-nixos-23.05/nixos/lib/modules.nix:794:5:
> 
> 793|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
> 794|     mergedValue =
> |     ^
> 795|       if isDefined then
> 
> error: A definition for option `sourceUri' is not of type `string'. Definition values:
> - In `<unknown-file>':
> {
> name = "nixos-image-20-09-3531-3858fbc08e6-x86-64-linux";
> project = "nixos-cloud";
> }
> error: evaluation of the deployment specification failed

This are my related nix files:

[wjjunyor@T101:/etc/nixos/redservers]$ cat lb-redservers.nix 
let

backend =
{ config, pkgs, ... }:
{ services.nginx.enable = true;
networking.firewall.allowedTCPPorts = [ 80 ];
};

in

{
network.description = "Load balancing network";

proxy =
{ config, pkgs, nodes, ... }:
{ services.nginx = {
enable = true;
additionalModules = [ pkgs.proxy_balancer pkgs.llbmethod_byrequests ];
appendHttpConfig = ''
<Proxy balancer://cluster>
Allow from all
BalancerMember http://galactica retry=0
BalancerMember http://pegasus retry=0
</Proxy>
ProxyPass         /    balancer://cluster/
ProxyPassReverse  /    balancer://cluster/
'';
networking.firewall.allowedTCPPorts = [ 80 ];
};
};

galactica = backend;
pegasus = backend;

}

and

[wjjunyor@T101:/etc/nixos/redservers]$ cat gce-lb-redservers.nix 
let

# change this as necessary or wipe and use ENV vars
credentials = {
project = "redservers";
serviceAccount = "google@service.account";
accessKey = "/W/Shared/RED/DEV/keys/redservers-9cabeb8e26de.json";
};

gce = { resources, ...}:  {
networking.firewall.allowedTCPPorts = [ 80 ];
deployment.targetEnv = "gce";
deployment.gce = credentials // {
region = "southamerica-east1-c";
tags = [ "public-http" ];
network = resources.gceNetworks.lb-net;
};
sourceUri = "gs://nixos-images-gcp/nixos-image-23.11pre514857.caac0eb6bdca-x86_64-linux.raw.tar.gz";
};

in {

# create a network that allows SSH traffic(by default), pings
# and HTTP traffic for machines tagged "public-http"
resources.gceNetworks.lb-net = credentials // {
addressRange = "192.168.4.0/24";
firewall = {
allow-http = {
targetTags = [ "public-http" ];
allowed.tcp = [ 80 ];
};
allow-ping.allowed.icmp = null;
};
};

# by default, health check pings port 80, so we don't have to set anything
resources.gceHTTPHealthChecks.plain-hc = credentials;

resources.gceTargetPools.backends = { resources, nodes, ...}: credentials // {
region = "southamerica-east1";
healthCheck = resources.gceHTTPHealthChecks.plain-hc;
machines = with nodes; [ galactica pegasus ];
};

resources.gceForwardingRules.lb = { resources, ...}: credentials // {
protocol = "TCP";
region = "southamerica-east1";
portRange = "80";
targetPool = resources.gceTargetPools.backends;
description = "Alternative HTTP Load Balancer";
};

proxy    = gce;
galactica = gce;
pegasus = gce;

}

1 Like