Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: How to specify nixopsConfiguration.default? #1553

Open
tartavull opened this issue Mar 26, 2023 · 2 comments
Open

Documentation: How to specify nixopsConfiguration.default? #1553

tartavull opened this issue Mar 26, 2023 · 2 comments

Comments

@tartavull
Copy link

Hello, I'm new to nixops and couldn't find how to set up a flake. Is there any documentation explaining so?

nixops create                                                                                                                                                                ~/code/genetic-intelligence
error: attribute 'default' missing

       at /nix/store/6ax7j3zyv010j3093m73fxsppc5b3hfr-python3-3.10.10-env/lib/python3.10/site-packages/nix/eval-machine-info.nix:20:15:

           19|
           20|   flakeExpr = (builtins.getFlake flakeUri).outputs.nixopsConfigurations.default;
             |               ^
           21|

       … while evaluating the attribute 'outputs.nixopsConfigurations.default'

       at /nix/store/fy3x5qk811q1kjilcv1416p311pfh1a5-source/default.nix:136:17:

          135|               {
          136|                 ${key} = (attrs.${key} or { })
             |                 ^
          137|                   // (appendSystem key system ret);

       … while calling 'call'

       at /nix/store/6ax7j3zyv010j3093m73fxsppc5b3hfr-python3-3.10.10-env/lib/python3.10/site-packages/nix/eval-machine-info.nix:12:10:

           11| let
           12|   call = x: if builtins.isFunction x then x args else x;
             |          ^
           13|

       … from call site

       at /nix/store/6ax7j3zyv010j3093m73fxsppc5b3hfr-python3-3.10.10-env/lib/python3.10/site-packages/nix/eval-machine-info.nix:36:11:

           35|       ++ optional (flakeUri != null)
           36|         ((call flakeExpr) // { _file = "<${flakeUri}>"; });
             |           ^
           37|

       … while calling 'zipAttrs'

       at /nix/store/6ax7j3zyv010j3093m73fxsppc5b3hfr-python3-3.10.10-env/lib/python3.10/site-packages/nix/eval-machine-info.nix:17:14:

           16|
           17|   zipAttrs = set: builtins.listToAttrs (
             |              ^
           18|     map (name: { inherit name; value = builtins.catAttrs name set; }) (builtins.concatMap builtins.attrNames set));

       … from call site

       at /nix/store/6ax7j3zyv010j3093m73fxsppc5b3hfr-python3-3.10.10-env/lib/python3.10/site-packages/nix/eval-machine-info.nix:38:13:

           37|
           38|   network = zipAttrs networks;
             |             ^
           39|
error: evaluation of the deployment specification failed
@ldicarlo
Copy link

Hi, can you provide your flake.nix if any ?

@akavel
Copy link

akavel commented Aug 29, 2023

@tartavull Sooo, based on

flakeExpr = (builtins.getFlake flakeUri).outputs.nixopsConfigurations.default;
and some other lines in that file, as well as some rough understanding of flakes in general, I seem to believe a minimal flake.nix for nixopsUnstable would look like below:

{
  description = "NixOps config of my servers";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/release-22.11";
  };

  outputs = { self, ... }@inputs: {
    nixopsConfigurations.default = {
      inherit (inputs) nixpkgs;

      network.description = "my servers";
      network.storage.legacy = {};
      #network.storage.memory = {};  # what's the difference with above?
      #network.enableRollback = true;  # uncomment if you like/know what this even does

      ### Machines ###

      #my-machine-1 = { pkgs, ... }: {
      #  deployment.targetHost = "1.2.3.4";
      #  services.nginx.enable = true;
      #};
    };
  };
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants