!UKDpaKNNsBpOPfLWfX:zhaofeng.li

Colmena

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

Load older messages


SenderMessageTime
18 Mar 2024
@dmoonfire:matrix.orgdmoonfireI struggle a lot translating those two concepts. Mostly I use a lot if Just file to handle what I couldn't figure out on my own. And trying to get home-manager into colmena took me months to puzzle out.02:23:17
@tcurdt:matrix.orgtcurdt
In reply to @dmoonfire:matrix.org
I struggle a lot translating those two concepts. Mostly I use a lot if Just file to handle what I couldn't figure out on my own.

And trying to get home-manager into colmena took me months to puzzle out.
Not good.
12:34:33
19 Mar 2024
@mjolnir:nixos.orgNixOS Moderation Botchanged room power levels.00:30:23
@dmoonfire:matrix.orgdmoonfireIts only been eighteen months if daily driving Nix. I'm sure in another couple years and I'll have it down.01:03:27
@me:indeednotjames.comemily
In reply to @hexa:lossy.network
but you can create nixosConfigurations and transform them into colmena outputs
you can also specify colmena as a flake input and pass your colmenaHive attrset to nixosConfiguration, one sec
01:21:22
@me:indeednotjames.comemily

take this slightly modified example from https://github.com/zhaofengli/colmena/blob/v0.4.0/src/nix/hive/tests/makehive-flake/flake.nix

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    colmena.url = "github:zhaofengli/colmena";
  };
  outputs = { nixpkgs, colmena, ... }: rec {
    colmenaHive = colmena.lib.makeHive {
      meta = {
        nixpkgs = import nixpkgs {
          system = "x86_64-linux";
        };
      };

      host-a = { name, nodes, pkgs, ... }: {
        boot.isContainer = true;
        time.timeZone = nodes.host-b.config.time.timeZone;
      };
      host-b = {
        deployment = {
          targetHost = "somehost.tld";
          targetPort = 1234;
          targetUser = "luser";
        };
        boot.isContainer = true;
        time.timeZone = "America/Los_Angeles";
      };
    };
    nixosConfigurations = colmenaHive.nodes;
  };
}

the diff to the upstream test is:

diff --git a/upstream-flake.nix b/flake.nix
index 11c7f62..a1f59d7 100644
--- a/upstream-flake.nix
+++ b/flake.nix
@@ -1,9 +1,9 @@
 {
   inputs = {
     nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
-    colmena.url = "git+file://@repoPath@";
+    colmena.url = "github:zhaofengli/colmena";
   };
-  outputs = { nixpkgs, colmena, ... }: {
+  outputs = { nixpkgs, colmena, ... }: rec {
     colmenaHive = colmena.lib.makeHive {
       meta = {
         nixpkgs = import nixpkgs {
@@ -25,5 +25,6 @@
         time.timeZone = "America/Los_Angeles";
       };
     };
+    nixosConfigurations = colmenaHive.nodes;
   };
 }

you can then use nix v3 (unstable) cli and nixos-rebuild as you wish:

❯ nixos-rebuild --flake .#host-a build
building the system configuration...
trace: warning: system.stateVersion is not set, defaulting to 24.05. Read why this matters on https://nixos.org/manual/nixos/stable/options.html#opt-system.stateVersion.
01:39:01
@me:indeednotjames.comemilyi am honestly a bit surprised this isn't documented lol01:39:20
@me:indeednotjames.comemily

you can also mix colmena nodes and your "vanilla" lib.nixosSystem in nixosConfigurations that way (for use with nixos-rebuild):

https://git.geklaute.cloud/emilylange/nixos-config/src/commit/22570786b24b606484447bef7a29fe565d475db7/flake.nix#L48-L76

01:41:46
@ar:is-a.catari ❄here's how I do this: https://code.hackerspace.pl/ar/nibylandia/src/branch/main/flake.nix#L115-L12310:35:29
@ar:is-a.catari ❄ tl;dr: automatically generate nixosConfiguration entries based on contents of a directory, and then generating colmena nodes based off of that 10:37:39
21 Mar 2024
@craige:mcwhirter.iocraige joined the room.05:41:34
@mjolnir:nixos.orgNixOS Moderation Botchanged room power levels.18:03:17
@grahamc:nixos.org@grahamc:nixos.org left the room.20:07:53
22 Mar 2024
@mrene:matrix.org@mrene:matrix.org left the room.00:51:08
25 Mar 2024
@badele:matrix.org@badele:matrix.org joined the room.20:26:10
@belak:matrix.org@belak:matrix.org joined the room.22:16:11
@belak:matrix.org@belak:matrix.org I'm looking at the multi-architecture-deployments page and I feel like I must be missing something. In this instance, when you set up meta.nixpkgs, do you specify your "default" architecture, and use the nixos configuration's nixpkgs.system to override when you're not on the default? 22:40:58
@belak:matrix.org@belak:matrix.org * I'm looking at the multi-architecture-deployments page and I feel like I must be missing something. In this instance, when you set up colmena.meta.nixpkgs, do you specify your "default" architecture, and use the nixos configuration's nixpkgs.system to override when you're not on the default? 22:41:20
@belak:matrix.org@belak:matrix.orgRedacted or Malformed Event22:41:32
@belak:matrix.org@belak:matrix.orgAlso, is there anything like deploy-rs's method of automatically rolling back if it determines something is broken?22:42:01
26 Mar 2024
@cblacktech:matrix.orgcblacktech joined the room.02:03:57
@badele:matrix.org@badele:matrix.org2024-03-26_08-22.png
Download 2024-03-26_08-22.png
07:25:17
@badele:matrix.org@badele:matrix.orgHi, i try to test the colmena project, i try test this tutorial => https://github.com/zhaofengli/colmena?tab=readme-ov-file#tutorial-with-flakes but i receive the error message. Are we in agreement that normally both hosts are supposed to run as guests (containers)?07:25:19
@craige:mcwhirter.iocraigeIt looks to me like your deployment host cannot resolve the hostnames / IPs you've used. I'd be checking simple things like "can I ping the hosts using the hostnames I've configured"08:35:13
@badele:matrix.org@badele:matrix.org2024-03-26_12-40.png
Download 2024-03-26_12-40.png
11:41:59
@badele:matrix.org@badele:matrix.org Thank you craige for your response. Yes, I had understood that was the issue, but the example suggests that we do a 'colmena build' and a 'colmena apply' and we have two instances available in containers (although I'm not sure if they are Docker containers, LXD containers, or something else). 11:42:10
@sammy:cherrykitten.dev@sammy:cherrykitten.devcolmena doesn't create the intances for you, it only connects to preexisting machines12:48:10
27 Mar 2024
@admin:nixos.org@admin:nixos.org joined the room.13:53:54
Room Avatar Renderer.13:54:04
@admin:nixos.org@admin:nixos.org left the room.13:54:15

Show newer messages


Back to Room ListRoom Version: 6