!UKDpaKNNsBpOPfLWfX:zhaofeng.li

Colmena

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

Load older messages


SenderMessageTime
11 Nov 2024
@tornax:matrix.orgtornax joined the room.18:49:13
@tornax:matrix.orgtornax
In reply to @luna:bddvlpr.com
Hi, I've recently found this project and was wondering if it's possible to just replace an existing deploy-rs setup with Colmena or would it cause some issues?
hi! As far as I know, colmena isn't a drop-in replacement for deploy-rs
18:49:37
@tornax:matrix.orgtornaxboth are using a different config structure18:49:47
13 Nov 2024
@luna:bddvlpr.comLunaWell besides reconfiguring the config structure, I’ve tried replacing deploy-rs’ flake structure with colmena’s but ran into some troubles. I’m guessing it’s because of the experimental flake support but haven’t had the time to properly look into it yet.11:53:02
15 Nov 2024
@ser:sergevictor.euser(ial)can colmena secrets deploy a whole directory, not single files only?09:51:15
@ibizaman:matrix.orgibizaman
In reply to @luna:bddvlpr.com
Well besides reconfiguring the config structure, I’ve tried replacing deploy-rs’ flake structure with colmena’s but ran into some troubles. I’m guessing it’s because of the experimental flake support but haven’t had the time to properly look into it yet.
I did the opposite for some of my machines recently to test deploy-es and had no issue. Feel free to post the log here next time.
12:25:29
@ibizaman:matrix.orgibizaman
In reply to @luna:bddvlpr.com
Well besides reconfiguring the config structure, I’ve tried replacing deploy-rs’ flake structure with colmena’s but ran into some troubles. I’m guessing it’s because of the experimental flake support but haven’t had the time to properly look into it yet.
*
12:25:36
16 Nov 2024
@luna:bddvlpr.comLuna
In reply to @ibizaman:matrix.org
I did the opposite for some of my machines recently to test deploy-es and had no issue. Feel free to post the log here next time.
Will do^
11:41:09
@rcouto:matrix.org@rcouto:matrix.org joined the room.21:35:13
@inomena:matrix.orginomena joined the room.22:45:18
@inomena:matrix.orginomena hi, looking at the docs w/flakes each host is defined in outputs.colmena.<hostname> similar to nixosConfigurations, but is it possible to instead read each host's configuration from separate files?
e.g. instead of outputs.colmena.host-a and outputs.colmena.host-b I could refer to files hosts/host-a.nix and hosts/host-b.nix (and all possible hosts within the hosts/ directory without specifying each one in flake.nix)
22:49:07
@inomena:matrix.orginomena I would still want to use outputs.colmena.meta and outputs.colmena.defaults in this scenario 22:51:13
17 Nov 2024
@inomena:matrix.orginomena

think I figured it out, or atleast it seems to work:

outputs = {nixpkgs, ...}:
  let
    hosts = nixpkgs.lib.mapAttrs'
      (filename: _: {
        name = nixpkgs.lib.nameFromURL filename ".";
        value = [ ./hosts/${filename} ];
      })
      (builtins.readDir ./hosts);
  in {
    colmena = hosts // {
      # ...
    };
};
08:39:26
@ibizaman:matrix.orgibizaman
In reply to @inomena:matrix.org

think I figured it out, or atleast it seems to work:

outputs = {nixpkgs, ...}:
  let
    hosts = nixpkgs.lib.mapAttrs'
      (filename: _: {
        name = nixpkgs.lib.nameFromURL filename ".";
        value = [ ./hosts/${filename} ];
      })
      (builtins.readDir ./hosts);
  in {
    colmena = hosts // {
      # ...
    };
};
Oh nice you went the extra mile with readDir. I was going to suggest plain imports but that works well!
08:57:01
@inomena:matrix.orginomenaI wanted it to be fully dynamic, so that the only thing I need to do to add a new host to the hive is to define a single <hostname>.nix file in the hosts dir and nothing else08:57:56
@inomena:matrix.orginomenanot having to also define it in a few other places08:58:09
@inomena:matrix.orginomena * not having to also define imports in a few other places08:58:18
@nixy:nixy.moenixy
In reply to @ser:sergevictor.eu
can colmena secrets deploy a whole directory, not single files only?
I don't believe so. But you can use the keyCommand option to create an archive (tar, zip) from a directory and then use systemd services to extract it. That's what I do for this at least
14:06:26
@ser:sergevictor.euser(ial)that's a nice concept, i didn't think about it, thanks!14:08:58
@jh-devv:matrix.org@jh-devv:matrix.org joined the room.18:39:43
@jh-devv:matrix.org@jh-devv:matrix.orgWhat tool do you people think would fit well with Colmena when deploying bare metal?18:50:44
@jh-devv:matrix.org@jh-devv:matrix.orgUnattended install etc.18:50:52
18 Nov 2024
@luna:bddvlpr.comLuna
In reply to@ibizaman:matrix.org
I did the opposite for some of my machines recently to test deploy-rs and had no issue. Feel free to post the log here next time.
Finally got to it, here's what I get:
[INFO ] Enumerating nodes...
error:
       … while calling the 'attrNames' builtin
         at «string»:1:190:
            1| with builtins; let assets = getFlake "path:/tmp/colmena-assets-HeCr3l?lastModified=1731921370&narHash=sha256-xWcw5WYfWGtmkZGFW7NjzxlGh8vDejJzDNJj2nJg7Dk%3D"; hive = assets.processFlake; in attrNames hive.nodes
             |                                                                                                                                                                                              ^

       … while calling the 'getFlake' builtin
         at «string»:1:29:
            1| with builtins; let assets = getFlake "path:/tmp/colmena-assets-HeCr3l?lastModified=1731921370&narHash=sha256-xWcw5WYfWGtmkZGFW7NjzxlGh8vDejJzDNJj2nJg7Dk%3D"; hive = assets.processFlake; in attrNames hive.nodes
             |                             ^

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: cannot update unlocked flake input 'hive' in pure mode
[ERROR] -----
[ERROR] Operation failed with error: Child process exited with error code: 1
Hint: Backtrace available - Use `RUST_BACKTRACE=1` environment variable to display a backtrace
09:17:57
@luna:bddvlpr.comLuna Oh my bad, I forgot --experimental-flake-eval, this is the log I get:
[WARN ] Using direct flake evaluation (experimental)
[INFO ] Enumerating nodes...
[INFO ] Selected all 4 nodes.
       ❌ 4s Failed: Child process exited with error code: 1
 (...) ❌ 4s Evaluation failed: Child process exited with error code: 1                                           
[ERROR] Failed to complete requested operation - Last 1 lines of logs:
[ERROR]  failure) Child process exited with error code: 1
[ERROR] Failed to evaluate phobos, ceres, deimos, and ariel - Last 20 lines of logs:
[ERROR]   stderr)          1575|         else
[ERROR]   stderr) 
[ERROR]   stderr)        … while evaluating the attribute 'value'
[ERROR]   stderr)          at /nix/store/hfz1qqd0z8amlgn8qwich1dvkmldik36-source/lib/modules.nix:816:9:
[ERROR]   stderr)           815|     in warnDeprecation opt //
[ERROR]   stderr)           816|       { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
[ERROR]   stderr)              |         ^
[ERROR]   stderr)           817|         inherit (res.defsFinal') highestPrio;
[ERROR]   stderr) 
[ERROR]   stderr)        … while evaluating the option `system.build.toplevel':
[ERROR]   stderr) 
[ERROR]   stderr)        … while evaluating definitions from `/nix/store/hfz1qqd0z8amlgn8qwich1dvkmldik36-source/nixos/modules/system/activation/top-level.nix':
[ERROR]   stderr) 
[ERROR]   stderr)        (stack trace truncated; use '--show-trace' to show the full, detailed trace)
[ERROR]   stderr) 
[ERROR]   stderr)        error:
[ERROR]   stderr)        Failed assertions:
[ERROR]   stderr)        - The ‘fileSystems’ option does not specify your root file system.
[ERROR]   stderr)        - You must set the option ‘boot.loader.grub.devices’ or 'boot.loader.grub.mirroredBoots' to make the system bootable.
[ERROR]  failure) Child process exited with error code: 1
[ERROR] -----
[ERROR] Operation failed with error: Child process exited with error code: 1
Hint: Backtrace available - Use `RUST_BACKTRACE=1` environment variable to display a backtrace
Is disko perhaps not compatible with colmena?
09:20:22
@ibizaman:matrix.orgibizaman
In reply to @jh-devv:matrix.org
What tool do you people think would fit well with Colmena when deploying bare metal?
Any tool should be compatible. I used nixos-anywhere successfully and heard about nixos-infect working too. I’ve got a flake template for the former https://github.com/ibizaman/skarabox if you want some inspiration.
09:27:06
@luna:bddvlpr.comLuna Perhaps its not reading any of the configuration as the log shows
 (...) | evaluation warning: system.stateVersion is not set, defaulting to 25.05. Read why this matters on https://nixos.org/manual/nixos/stable/options.html#opt-system.stateVersion.
While a repl shows
nix-repl> outputs.nixosConfigurations.ariel.config.system.stateVersion
"24.05"

nix-repl>
09:27:29
@ibizaman:matrix.orgibizaman
In reply to @luna:bddvlpr.com
Oh my bad, I forgot --experimental-flake-eval, this is the log I get:
[WARN ] Using direct flake evaluation (experimental)
[INFO ] Enumerating nodes...
[INFO ] Selected all 4 nodes.
       ❌ 4s Failed: Child process exited with error code: 1
 (...) ❌ 4s Evaluation failed: Child process exited with error code: 1                                           
[ERROR] Failed to complete requested operation - Last 1 lines of logs:
[ERROR]  failure) Child process exited with error code: 1
[ERROR] Failed to evaluate phobos, ceres, deimos, and ariel - Last 20 lines of logs:
[ERROR]   stderr)          1575|         else
[ERROR]   stderr) 
[ERROR]   stderr)        … while evaluating the attribute 'value'
[ERROR]   stderr)          at /nix/store/hfz1qqd0z8amlgn8qwich1dvkmldik36-source/lib/modules.nix:816:9:
[ERROR]   stderr)           815|     in warnDeprecation opt //
[ERROR]   stderr)           816|       { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
[ERROR]   stderr)              |         ^
[ERROR]   stderr)           817|         inherit (res.defsFinal') highestPrio;
[ERROR]   stderr) 
[ERROR]   stderr)        … while evaluating the option `system.build.toplevel':
[ERROR]   stderr) 
[ERROR]   stderr)        … while evaluating definitions from `/nix/store/hfz1qqd0z8amlgn8qwich1dvkmldik36-source/nixos/modules/system/activation/top-level.nix':
[ERROR]   stderr) 
[ERROR]   stderr)        (stack trace truncated; use '--show-trace' to show the full, detailed trace)
[ERROR]   stderr) 
[ERROR]   stderr)        error:
[ERROR]   stderr)        Failed assertions:
[ERROR]   stderr)        - The ‘fileSystems’ option does not specify your root file system.
[ERROR]   stderr)        - You must set the option ‘boot.loader.grub.devices’ or 'boot.loader.grub.mirroredBoots' to make the system bootable.
[ERROR]  failure) Child process exited with error code: 1
[ERROR] -----
[ERROR] Operation failed with error: Child process exited with error code: 1
Hint: Backtrace available - Use `RUST_BACKTRACE=1` environment variable to display a backtrace
Is disko perhaps not compatible with colmena?
There are two errors at the end there, setting root filesystem and grub stuff. Usually those come from running the hardware generator on the new machine and that gets you a hardware-configuration.nix file. You must include that file or recreate the options it is setting for the configuration to be happy.
09:29:54
@jh-devv:matrix.org@jh-devv:matrix.org
In reply to @ibizaman:matrix.org
Any tool should be compatible. I used nixos-anywhere successfully and heard about nixos-infect working too. I’ve got a flake template for the former https://github.com/ibizaman/skarabox if you want some inspiration.
Does this support iPXE?
09:30:06
@luna:bddvlpr.comLuna
In reply to@ibizaman:matrix.org
There are two errors at the end there, setting root filesystem and grub stuff. Usually those come from running the hardware generator on the new machine and that gets you a hardware-configuration.nix file. You must include that file or recreate the options it is setting for the configuration to be happy.
Those are correctly set and can be seen through the repl. Maybe I'm misunderstanding, does it (like deploy-rs) check for configurations at outputs.nixosConfigurations for matching attributes to outputs.colmena?
09:31:28
@luna:bddvlpr.comLuna
{
  self,
  inputs,
  ...
}: let
  inherit (self) outputs;
  inherit (builtins) mapAttrs;
in {
  flake = {
    colmena =
      (mapAttrs (host: value: {
          deployment = {
            targetHost = "${host}.cloud.bddvlpr.com";
          };
        })
        outputs.nixosConfigurations)
      // {
        meta = {
          nixpkgs = import inputs.nixpkgs {
            system = "x86_64-linux";
            overlays = [];
          };
        };
      };

    colmenaHive = inputs.colmena.lib.makeHive outputs.colmena;
  };
}
This is the current configuration, btw.
09:33:32

Show newer messages


Back to Room ListRoom Version: 6