!UKDpaKNNsBpOPfLWfX:zhaofeng.li

Colmena

299 Members
A simple, stateless NixOS deployment tool - https://github.com/zhaofengli/colmena104 Servers

Load older messages


SenderMessageTime
30 May 2023
@zhaofeng:zhaofeng.liZhaofeng LiIt definitely should work. What does your config look like?17:29:26
@the_observer:fairydust.space@the_observer:fairydust.space
In reply to @zhaofeng:zhaofeng.li
It definitely should work. What does your config look like?
Just using config. or how?
17:30:13
@zhaofeng:zhaofeng.liZhaofeng LiYes17:30:20
@the_observer:fairydust.space@the_observer:fairydust.space
{
  meta = {
    *shortened*
  };

  defaults = { pkgs, ... }: {
      *shortened*
  };

  web = {
    networking  = {
      hostName = "web";
      defaultGateway = "10.2.0.1";
      interfaces.eth0.ipv4.addresses = [ {
        address = "10.2.1.201";
        prefixLength = 16;
      } ];
    };

    deployment = {
      targetHost = "10.2.1.201";
      tags = [ "lxc" ];
    };
    boot.isContainer = true;
    systemd.suppressedSystemUnits = [
      "dev-mqueue.mount"
      "sys-kernel-debug.mount"
      "sys-fs-fuse-connections.mount"
    ];

    security = {
      dhparams = {
        enable = true;
        stateful = true;
        path = "/etc/dhparams";
        params.nginx = {
          bits = 4096;
        };
      };
    };

    services = {
      nginx = {
        enable =  true;
        sslDhparam = config.security.dhparams.params.nginx.path;
      };
    };
  };

}


This config gives error: undefined variable 'config'

17:33:36
@zhaofeng:zhaofeng.liZhaofeng Li

Do it like:

web = { pkgs, config, ... }: {
  networking = { ... };
};

or better,

web = ./web.nix; # which contains a lambda that takes { pkgs, config, ... }
17:34:50
@zhaofeng:zhaofeng.liZhaofeng LiFor each node you are passing a NixOS module17:35:21
@the_observer:fairydust.space@the_observer:fairydust.spaceThank you! :)17:38:51
@zhaofeng:zhaofeng.liZhaofeng Li

Note they are just regular NixOS modules, which means you can do

mkdir hosts
cp -r /etc/nixos ./hosts/web

And then

web = ./hosts/web/configuration.nix;
17:42:06
1 Jun 2023
@raphi:tapesoftware.netraphi changed their display name from raphi to raphi (element unread channel fix when).13:03:27
@solomon:cofree.coffee@solomon:cofree.coffee joined the room.18:38:18
2 Jun 2023
@alpha-centauri:matrix.orgAlexander joined the room.16:43:44
@alpha-centauri:matrix.orgAlexander

Hi there.
Have a question about nixpkgs per node inside a flake. I'm trying following configuration likewise in manual for a hive:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/7076110064c09f0b3942f609f2134c1358ef2e50";
  };

  outputs = { nixpkgs, ... }: {
    colmena = {
      meta = {
        nixpkgs = import nixpkgs {
          system = "x86_64-linux";
          overlays = [];
        };

        nodeNixpkgs.desktop = ./nixpkgs-23.05;
      };

      desktop = import ./desktop.nix;
    };
  };
}

But it does not work:

error: Passing a path to Nixpkgs as meta.nodeNixpkgs.pc is no longer accepted with Flakes.
       Please initialize Nixpkgs like the following:

       {
         # ...
         outputs = { nixpkgs, ... }: {
           colmena = {
             meta.nodeNixpkgs.pc = import nixpkgs {
               system = "x86_64-linux"; # Set your desired system here
               overlays = [];
             };
           };
         };
       }

Is it possible somehow to pin specific version of nixpkgs for a host in flake configuration?

16:53:06
@alpha-centauri:matrix.orgAlexander *

Hi there.
Have a question about nixpkgs per node inside a flake. I'm trying following configuration likewise in manual for a hive:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/7076110064c09f0b3942f609f2134c1358ef2e50";
  };

  outputs = { nixpkgs, ... }: {
    colmena = {
      meta = {
        nixpkgs = import nixpkgs {
          system = "x86_64-linux";
          overlays = [];
        };

        nodeNixpkgs.desktop = ./nixpkgs-23.05;
      };

      desktop = import ./desktop.nix;
    };
  };
}

But it does not work:

error: Passing a path to Nixpkgs as meta.nodeNixpkgs.pc is no longer accepted with Flakes.
       Please initialize Nixpkgs like the following:

       {
         # ...
         outputs = { nixpkgs, ... }: {
           colmena = {
             meta.nodeNixpkgs.desktop = import nixpkgs {
               system = "x86_64-linux"; # Set your desired system here
               overlays = [];
             };
           };
         };
       }

Is it possible somehow to pin specific version of nixpkgs for a host in flake configuration?

16:53:51
@zhaofeng:zhaofeng.liZhaofeng Li nodeNixpkgs.desktop has to be an initialized package set (see the error message), not a path 17:00:00
@zhaofeng:zhaofeng.liZhaofeng Li It accepts the exact type as meta.nixpkgs 17:00:18
@alpha-centauri:matrix.orgAlexander

There is only example for hive.nix:

    nodeNixpkgs = {
      node-b = ./another-nixos-checkout;
    };

I cannot find out where I should place a path to a nixpkgs when using flake

17:04:21
@zhaofeng:zhaofeng.liZhaofeng LiJust copy the nixpkgs pinning your have above17:05:27
@zhaofeng:zhaofeng.liZhaofeng LiBut there is no need to pin separately when it's the only node17:05:37
@zhaofeng:zhaofeng.liZhaofeng Li * Just copy the nixpkgs pinning you have above17:05:45
@zhaofeng:zhaofeng.liZhaofeng Li

In other words

        nodeNixpkgs.desktop = import nixpkgs {
          system = "x86_64-linux";
          overlays = [];
        };
17:06:16
@alpha-centauri:matrix.orgAlexander I have another nodes in my flake.nix and I want to upgrade some of them to 23.05 17:07:18
@alpha-centauri:matrix.orgAlexander

Oh, I understand how it should be assembled (I don't have a lot of experience with a NixOS):

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/7076110064c09f0b3942f609f2134c1358ef2e50";
    nixpkgs-23-05.url = "github:NixOS/nixpkgs/551a52bfdd02e7b75be5faf9b42f864112d88654";
  };

  outputs = { nixpkgs, nixpkgs-23-05, ... }: {
    colmena = {
      meta = {
        nixpkgs = import nixpkgs {
          system = "x86_64-linux";
          overlays = [];
        };

      };

      meta.nodeNixpkgs.desktop = import nixpkgs-23-05 {
        system = "x86_64-linux";
        overlays = [];
      };

      desktop = import ./desktop.nix;
    };
  };
}
17:21:25
3 Jun 2023
@rendakuenthusiast:imperishable.name@rendakuenthusiast:imperishable.name left the room.08:09:06
5 Jun 2023
@raitobezarius:matrix.orgraitobezarius is it possible to have the deployment options in a vanilla nixosConfigurations? 16:11:46
@raitobezarius:matrix.orgraitobezariusby passing the appropriate module16:12:15
@raitobezarius:matrix.orgraitobezariusindeed, it is as a flake input16:16:06
@raitobezarius:matrix.orgraitobezariusah but when I do this, I get duplicate modules16:20:45
@raitobezarius:matrix.orgraitobezariussuccess16:21:23
6 Jun 2023
@dminuoso:matrix.orgdminuosoMmmm. Im deploying to a server, but instead of substituting from a cache it copies all store paths from my local machine. How can I figure out what's going on?10:54:46
@me:indeednotjames.comemily
In reply to @dminuoso:matrix.org
Mmmm. Im deploying to a server, but instead of substituting from a cache it copies all store paths from my local machine. How can I figure out what's going on?
are you are using a flake based hive?
maybe related: https://github.com/zhaofengli/colmena/pull/156
12:20:17

Show newer messages


Back to Room ListRoom Version: 6