!UKDpaKNNsBpOPfLWfX:zhaofeng.li

Colmena

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

Load older messages


SenderMessageTime
3 Feb 2022
@buckley310:matrix.orgBuckleybecause colmena was created before flakes were stable02:07:42
@buckley310:matrix.orgBuckley(if i had to guess)02:07:49
@buckley310:matrix.orgBuckleycolmena just got flakes support in June02:08:44
@schnecfk:ruhr-uni-bochum.deCRTified
In reply to @buckley310:matrix.org
because colmena was created before flakes were stable
At least the flakes series on tweag is older than the first commit of colmena and documents the output schema in a similar way
02:10:20
@schnecfk:ruhr-uni-bochum.deCRTifiedI am asking because I'm trying to move my config to flakes and have a hard time with home-manager+NUR. At the same time, I can't really use other people's flake configurations as it's not properly (?) using flakes (this here is in theory exactly what I need, but I can't apply it: https://discourse.nixos.org/t/importing-nur-home-manager-modules-in-nix-flakes/16457/2 )02:12:02
@schnecfk:ruhr-uni-bochum.deCRTified * I am asking because I'm trying to move my config to flakes and have a hard time with home-manager+NUR. At the same time, I can't really use other people's flake configurations as it's not properly (?) using flakes (this here is in theory exactly what I need down to the module I want to import, but I can't apply it: https://discourse.nixos.org/t/importing-nur-home-manager-modules-in-nix-flakes/16457/2 )02:12:24
@buckley310:matrix.orgBuckley
In reply to @buckley310:matrix.org
So I'm curious. In my setup my servers all exist inside of my flake outputs.nixosConfigurations, and my outputs.colmena is just a stub that consumes nixosConfigurations and emits a colmena configuration. Is anyone else doing it this way, or just me? I really like the portability of keeping my hosts in nixosConfigurations
see also
02:12:29
@schnecfk:ruhr-uni-bochum.deCRTifiedMatrix won't show the reply, but the raw message (View source) is readable. I'll dig it up in the history02:13:59
@buckley310:matrix.orgBuckleytldr, my hosts are in nixosConfigurations, and my colmena output just translates that02:15:19
@buckley310:matrix.orgBuckleybecause i already had a flake with my servers 🤔02:15:31
@schnecfk:ruhr-uni-bochum.deCRTifiedFound it02:15:34
@schnecfk:ruhr-uni-bochum.deCRTifiedIt looks perfect for me, as I also want another possible flake output (to generate sd images for my SBCs with the same config)02:16:16
@schnecfk:ruhr-uni-bochum.deCRTifiedThanks, that's really useful 🙂02:16:22
@zhaofeng:zhaofeng.liZhaofeng Li
In reply to @schnecfk:ruhr-uni-bochum.de
Is there a specific reason for why colmena diverges from the "standard" flake output schema? (For reference: https://nixos.wiki/wiki/Flakes#Output_schema )
It's because Colmena needs to inject its own modules for deployment.* options as well as module arguments (nodes, name). This is also consistent with the way NixOps implements its flakes support (outputs.nixopsConfigurations).
02:16:35
@zhaofeng:zhaofeng.liZhaofeng LiIt also provides a clear upgrade path for users using legacy hive.nix to flakes02:17:13
@schnecfk:ruhr-uni-bochum.deCRTified Oh, that explains a lot. In that case, it might be great to document the shim-method that Buckley posted, as it should give "the best of both worlds" 02:17:50
@buckley310:matrix.orgBuckleythere has actually been an update since then as well, i have a custom module to store my deployment options, but you dont actually need that anymore, as the colmena flake exposes its modules as an output now02:18:27
@zhaofeng:zhaofeng.liZhaofeng Li
In reply to @zhaofeng:zhaofeng.li
It also provides a clear upgrade path for users using legacy hive.nix to flakes

Also regarding upgrading to flakes, note that Colmena can auto-call if hive.nix evaluates to a function, allowing you to do things like this:

{ pkgs ? import <nixpkgs> { system = "x86_64-linux"; } }: # or how you pin your nixpkgs
{
  meta = { ... };
}

and importing it like outputs.colmena = import ./hive.nix { pkgs = ...; }; in your flake. You can then deploy with either flake.nix and hive.nix during your transition period.

02:27:38
@zhaofeng:zhaofeng.liZhaofeng Li If the current directory contains both flake.nix and hive.nix, then flake.nix is always preferred 02:28:12
@zhaofeng:zhaofeng.liZhaofeng Li * If the current directory contains both flake.nix and hive.nix, then flake.nix is always preferred if you don't specify a config file explicitly 02:29:39
@schnecfk:ruhr-uni-bochum.deCRTifiedThat iirc fails as I previously imported channels directly all over the place 😅 So my goal is indeed to have a flake config without such a transition configuration 02:33:48
@winterqt:nixos.devWinter (she/her) joined the room.03:46:59
@janejasperous:one.ems.hostJane Jasperous
In reply to @phaer:matrix.org

Jane Jasperous:
Does this work for you?

colmena.my-host = { name, nodes, ... }:
{
   imports = [ self.nixosConfigurations.my-host ];
}; 

(if you get an error that deployment options are undefined, import colmena.nixosModules.deploymentOptions in your nixosConfiguration)

no exactly,
14:27:34
@janejasperous:one.ems.hostJane Jasperous
        deployment.allowLocalDeployment = true;
        nixpkgs.system = self.nixosConfigurations.x2100.config.nixpkgs.system;
        imports = self.nixosConfigurations.x2100.extraArgs.modules ;
      };
14:28:23
@janejasperous:one.ems.hostJane Jasperous *
colmena.node-a = {
        deployment.allowLocalDeployment = true;
        nixpkgs.system = self.nixosConfigurations.x2100.config.nixpkgs.system;
        imports = self.nixosConfigurations.x2100.extraArgs.modules ;
      };

nixosConfigurations.x2100 = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      specialArgs = { inherit inputs; };
      modules = [
          module-a
     ];
};
14:30:17
@janejasperous:one.ems.hostJane Jasperous *
colmena.node-a = {
        deployment.allowLocalDeployment = true;
        nixpkgs.system = self.nixosConfigurations.node-a.config.nixpkgs.system;
        imports = self.nixosConfigurations.node-a.extraArgs.modules ;
      };

nixosConfigurations.node-a = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      specialArgs = { inherit inputs; };
      modules = [
          module-a
     ];
};
14:30:53
@janejasperous:one.ems.hostJane Jasperous *
colmena.node-a = {
        deployment.allowLocalDeployment = true;
        nixpkgs.system = self.nixosConfigurations.node-a.config.nixpkgs.system;
        imports = self.nixosConfigurations.node-a.extraArgs.modules ;
      };

nixosConfigurations.node-a = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      specialArgs = { inherit inputs; };
      modules = [
          module-a
          #inputs.colmena.nixosModules.deploymentOptions
     ];
};
14:31:31
@janejasperous:one.ems.hostJane Jasperousonly this works to me. If I import nixosModules.deploymentOptions and move deployment directive to nixosConfiguration I get this error:14:33:32
@janejasperous:one.ems.hostJane Jasperous error: The option deployment.allowLocalDeployment' in <unknown-file>' is already declared in /nix/store/rz7wzrgh4fpdgab95dgrx46ig2gc2nym-source/flake.nix'.` 14:38:23
@janejasperous:one.ems.hostJane Jasperous * error: The option 'deployment.allowLocalDeployment' in '<unknown-file>' is already declared in '/nix/store/rz7wzrgh4fpdgab95dgrx46ig2gc2nym-source/flake.nix'. 14:38:45

Show newer messages


Back to Room ListRoom Version: 6